Link to home
Start Free TrialLog in
Avatar of mentor360
mentor360Flag for Colombia

asked on

Polymorphism in WCF DataContracts

Hi,

I would like to know if it's possible to use polymorphism in DataContract classes for a WCF service.

lets say i have a method GetAll
[OperationContract]
IEnumerable<BasicDTO> GetAll();

Open in new window

in my service. This method returns a collection of BasicDTO. This DTO has a code and a name properties.

Also I have several classes extending BasicDTO. Lets call one ComplexDTO a class that also has 2 more properties.(creatonDate and creationUser). Both properties with the [DataMember] attribute.

Is it possible to return a IEnumerable<ComplexDTO> in the GetAll Implementation? Will the extra properties of ComplexDTO arrive to the client?

Thank You.
ASKER CERTIFIED SOLUTION
Avatar of Anil Golamari
Anil Golamari
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial