开发者

DataTable not accepted by svcutil - WCF Service

开发者 https://www.devze.com 2023-02-28 01:15 出处:网络
I\'m having very strange issue with my WCF Service Proxy client generated by \"svcutil.exe\" . My WCF Service works very fine if I don\'t have a function that returns DataTable. As soon as I开发者_如何

I'm having very strange issue with my WCF Service Proxy client generated by "svcutil.exe" . My WCF Service works very fine if I don't have a function that returns DataTable. As soon as I开发者_如何学Python add a method that returns a DataTable the client generated by svcutil.exe is behaving very strangely. The Interface is no longer found and client is not able to call the service. But if I add as a Service Reference its working very smoothly. I know its not a good habit to use DataTable as a return type but I need to. I cannot use the Service Reference :-( Any idea why its behaving or what I'm missing!!!


Have a look at the DataTableSurrogate class. It is used by the SyncFramework for serialization and really easy to use. MSDN DataTableSurrogate


You shouldn't really serialize datasets, instead you should use datamodels and keep anything to do with datasets, tables, readers etc on your backend & in the business layer.

But.. if you want to do so you need to add the following "include" in svcutil, which is causing your issue. (Tells to reuse the types defined in System.Data.dll and not generate them in the proxy)

/r:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号