开发者

Web Service Needs To Accept Unspecified Arguments

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜