Incorrect generating of service reference

40 Views Asked by At

I have class Request derived from Dictionary<string, string>. It has additional fields. Then I have Service Contract: string MakeRequest(Request request); After that I generate Service Reference for this contract. But VS by some reason generates next code:

string MakeRequest(System.Collections.Generic.Dictionary<string, string> request);

My question is how to tell VS that I want derived class and not base.

1

There are 1 best solutions below

0
usr On

I doubt this is possible. Dictionary support seems to be intrinsic. Dictionary is not a type understood by SOAP so it can't be serialized literally. For example it does not have a [DataContract] attribute. A derived type (maybe with custom fields) could not be serialized.

Deriving from Dictionary is a bad idea anyway. You probably should either derive from IDictionary and wrap a Dictionary exposing it as a property:

class MyDict { public Dictionary<...> Items; }