wcfdynamicdatacontracticustomtypedescriptor

Creating WCF DataContracts dynamically from code


Given the fact that I have a fully dynamic object model, that is, I have no concrete classes defined anywhere in code, but I still want to be able to create WCF DataContracts for them so I can use them in operations. How can I achieve this?

My concrete class "Entity" implements ICustomTypeDescriptor which is used to present the various properties to the outside world, but my expeimentation with WCF suggests that WCF does not care about ICustomTypeDescriptor. Is this correct or have I missed something?

Is this possible? It cannot be so that the only way to create a DataContract is to actually have a concrete harcoded class, can it?


Solution

  • Things evolve :-) Thanks to the excellent blog series by Alex D James its very easy to implement this.