views:

324

answers:

3

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?

A: 

you may use untyped service and message contract IIRC http://geekswithblogs.net/claeyskurt/archive/2008/09/24/125430.aspx

Krzysztof Koźmic
But in that sample it seams the message still uses an internal class that is decorated with [DataContract]. Ideally I would like consumers to see a service operation like:Company GetCustomerByCustomerNumber( string customerNumber )And this is of course possible using a [DataContract] decorated class called Company. But in my case I do not have an actual class for Company. I am able to add the operation by taking the ServiceHost and adding new Operations dynamically, so that part I have solved :-)
Fredrik Tonn
A: 

I am looking for the same solution , can someone give a suggestion?

Vincent
A: 

Like Vincent, I'm looking for same solution. I have a dynamic data model where users essentially create, modify, and delete object types at run-time (not true .NET object classes but mimicked object classes with their own extensible storage). I would like to put an OData interface on it using WCF Data Services and can know at run-time what object classes are defined, but not at compile-time as WCF DataContract decorations seem to require. -Andy