tags:

views:

170

answers:

2

hi

I have one datacontract as base object and i have two derived datacontract object.

In Operation contract i return only base object.

SO since base object is represnted in service and opreational contract the derived class are not visible in client side (or) not publish in web service.?

how can i create the derived object in client side and return via operational contract through its base object reference.

(or)

How can I expose the datacontract object in service but not in operation contract to webservice that i can consume from web reference.

thks dinesh

+1  A: 

Use the KnownType Attribute.

davogones
A: 

I'm not sure that you can. The issue as I see it that you are moving the base class across the wire since that is what is defined in the operational contract. That means that any extensions you make with derived classes will not get moved across the wire since only the base class will be serialized.

edit: After reading davogones post, he definitely has a point. I guess it really hinges whether there is an expectation of additional fields being involved. That was my thinking above anyhow.

Mitch Baker