Thursday, January 24, 2008 8:44 PMHi,
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?
Thursday, January 24, 2008 11:48 PMYou cannot use svcutil for services using the NetDataContractSerializer. If you are attempting to use the NetDataContractSerializer, you need to be working in a shared library environment (the same library is shipped to both client and host).
Friday, January 25, 2008 1:11 AMEric, is this documented somewhere? I ask because this msg: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1325936&SiteID=1 refers to "generated" code that, to me, implies svcutil.
Friday, January 25, 2008 12:25 PMThis 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."
Saturday, January 26, 2008 12:47 AMSvcUtil does not support NetDataContract based services. You will either need to use the same types on both sides explicitly (which is essentially what you're doing anyway).
Thursday, October 15, 2009 4:29 PMHi Martin,
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));