开发者

Inheritance in datacontracts

I have a class say supplierAddress which comes from a webservice (it is a datacontact). I then have a second class myAddress which inherits from that class and has a few more constructors and metods.

What I want to do is pass a myAddress back to the webservice. When I pass a cast down myAddress it throws seri开发者_Python百科azation errors, which makes sence as its a refrence object and the whole object is still being passed even if im casting down.

Is it possible to clone just the base class of an object? Is what im trying to do possible/correct ?


You should specify Known types for your base class.

UPDATE: additional clarification.

SOA (Service-Oriented Architecture) paradigm doesn't support such common features like polymorphism or method overloading. This behaviour based on very simple fact: you don't know which platform will consume your service. Its definitely possible to consume your service in platform or language that doesn't support such thing like inheritance or method overloading.

That's why you should create your service functions with unique names and that's why you should explicitly stated what types you're going to pass instead of base class reference.

When you specify known types this information would expose out of your service through metadata and every client could understand how to deal with your responses.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜