I'm trying to use the NetDataContract attribute (code taken from aaron's site) and have svcutil generate the stubs for me but am still unable to get the client to serialize my object correctly. In fact, I don't see a ref to NetDataContract in the proxy code at all and even when I manually add it, it still doesn't work. Is it possible to use svcutil with the NetDataContract attribute? If so, is there a special parameter one must use?
This blog also mentions it but doesn't offer any details. Can someone from msft comment?
"If you use the handy [NetDataContract] attribute, you have to mark it as such on both the service interface and the client interface, which means you need to hand-modify the generated client code."
Is there any way around this ?
I've added this code (below) to the client - but it gives me trouble.
The problem is that using nHibernate forces me to use svcutils, and Circular reference in the object model - make DataContractSerializer uselesss, so I have to use the NetDataContract.
So, I'm stuck.....
Client code to make the client know about the NetDataContract Serializer:)
foreach (OperationDescription desc in channelFactory.Endpoint.Contract.Operations)
DataContractSerializerOperationBehavior dcsOperationBehavior = desc.Behaviors.Find<DataContractSerializerOperationBehavior>();
if (dcsOperationBehavior != null)
int idx = desc.Behaviors.IndexOf(dcsOperationBehavior);
desc.Behaviors.Insert(idx, new NetDataContractOperationBehavior(desc));