WCF 数据服务属性添加破坏了客户端
我们有一个带有生成的 DataServiceClient 的 WCF 数据服务。我们向服务器上的实体添加(而不是删除)一个属性。客户端现在抛出:
Type 'OrderIOI' does not have a property named 'total_ioi_qty'
at System.Data.Services.Client.QueryResult.Execute()
at System.Data.Services.Client.DataServiceRequest.Execute[TElement](DataServiceContext context, QueryComponents queryComponents)
--- End of inner ExceptionDetail stack trace ---
我们如何解决这个错误?我们不能每次在服务器上添加属性时都重新生成客户端引用......(我认为这就是 WCF 和数据契约的全部意义)?
We have an WCF Data Service with a generated DataServiceClient. We added (not removed) a property to the entity on the server. The client now throws:
Type 'OrderIOI' does not have a property named 'total_ioi_qty'
at System.Data.Services.Client.QueryResult.Execute()
at System.Data.Services.Client.DataServiceRequest.Execute[TElement](DataServiceContext context, QueryComponents queryComponents)
--- End of inner ExceptionDetail stack trace ---
How do we resolve this error? We can't go regenerating client references every time a property is added on the server....(I thought that was the whole point of WCF and Data Contracts)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 DataServiceContext 实例上,将 IgnoreMissingProperties 属性设置为 true。
On the DataServiceContext instance, set the IgnoreMissingProperties property to true.