Monday, 15 April 2013

generics - Returning a List<SuperType> on a WCF service -


I am trying to get a WCF service to return a list containing examples of sections from A But the "underlying" connection is unexpectedly closed "when the service list returns."

I have the following

  [DataContract] [serialable] Public Class A {...} [DataContract] [Serialable] Public Class B: A {...} [Data Contract] [Serialable] Public Class C: A {...}  

Then I have a service defined

  [contact of service (namespace = "name space") ] Public Interface I {[OperationCactrext] list & lt; a & gt; GetList ();}  

If I try to return a list

 < Code> list & lt; a & gt; list = new list & lt; a & gt; () {new b (), new c ()}  

me in the proxy class above Error.

If the list & lt; B & gt; and just add it to BS, it fixes it, isel A. It is believed that it is related to the WCF, which is difficult subtypes.

  [ServiceKnownType  

So, is this possible? (Typef (b)) [service kentype (typef (c))]

To determine the class of A, there is no benefit.

To return a list of subtypes in the same list through WCF?

If so, am I wrong / wrong?

Thanks in advance for any assistance you can provide

Ah

Regards

Regards


No comments:

Post a Comment