As .Net developer, I believe it would be an excellent characteristic of WCF behavior to support DataContract inheritance out of the box.
Currently I'm able to overcome this issue by doing one of two things:
- Decorate the base DataContract classes with [KnownType] attribute for each child DataContract class (which is not elegant and violates class inheritance principle)
- Use the generic resolver:
These two solutions work but none of them is good enough to avoid writting custom code just to allow using of simple DataContracts, besides the second approach, which is far more flexible, finds its handicap when related with WCF Routing or WF Services where
I'm not able to apply the generic resolver to overcome this issue.
I believe this should be an out of the box functionality of WCF so it would allow every WCF possible scenario to understand the inheritance without any extra code.