开发者

Web Service Needs To Accept Unspecified Arguments

开发者 https://www.devze.com 2023-03-14 00:18 出处:网络
I have a web service that is used to manage various \"events\" that occur in a live telephony system.

I have a web service that is used to manage various "events" that occur in a live telephony system.

The method I am working on really needs to accept two arguments.

  1. The type of event
  2. Some arguments

The "some arguments" is a number of key/value pairs.

The web service is going to be called from other languages - not just .NET languages.

What should my method signature look like...

public bool Notify(string eventType, IEnumerable<KeyValuePair<string, string> argu开发者_开发技巧ments)

Or...

public bool Notify(string eventType, IDictionary<string, string> arguments)

Or something else.


I would stay away from interfaces when defining data contracts. Maybe something like this:

public bool Notify(string eventType, KeyValuePair<string, string>[] arguments)
{

}

Or define a custom class:

public class Argument
{
    public string Name { get; set; }
    public string Value { get; set; }
}

and then:

public bool Notify(string eventType, Argument[] arguments)
{

}
0

精彩评论

暂无评论...
验证码 换一张
取 消