.Net WCF data contracts inheritance

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sporob
    New Member
    • Sep 2007
    • 1

    .Net WCF data contracts inheritance

    Issue:

    Each webpage/screen in our project has a corresponding WCF class and also a proxy is generated per class. We are inheriting Data Contract declared in a common WCF class, though WCF allows inheritance we are facing problem when we generate the proxy. When the proxy is generated all inherited DataContracts are also auto-generated in each proxy class. Since all classes belong to one common namespace and are partial, code compilation throws an error as properties are repeated in each proxy class.



    Possible workarounds:

    1) Have separate namespace per DataContract class, will involve code refactoring.

    2) Comment the repeated code in each proxy class, need to manually do this every time a proxy class is regenerated.



    Donot want to use interfaces as datacontract implementation needs to repeated in each class.
Working...