通过WCF重新附加实体。 [英] Re-Attaching Entities over WCF.

查看:162
本文介绍了通过WCF重新附加实体。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我通过basicHttpBinding将实体通过WCF发送到ASP.NET客户端。此客户端通过GridView等绑定到WCF方法,用于SelectMethod,UpdateMethod等。



不幸的是,我的在WCF端实现这些方法,返回的对象丢失了它的EntityKey,因此我无法重新附加它。我暂时做了一些丑陋的代码来重新构建EntityKey,但它非常具体。



我能做什么吗这样做,EntityKey不会丢失,因为它通过WCF发送并返回,所以我可以轻松地重新附加它?



非常感谢任何帮助!


谢谢。

解决方案

首先,我应该确保您使用的是beta3或更高版本。接下来,我需要确定密钥被丢弃的位置:客户端是否收到密钥然后不将它们发送回服务器?如果客户端没有收到它们,请发送客户端用来填充网格的代码。此外,当您添加服务引用时,您是否告诉svcutil从生成的代理中从System.data.entity.dll和模型程序集中排除类型?这将有助于我追踪问题。


So I am sending Entities over WCF via basicHttpBinding to an ASP.NET client end. This client binds to the WCF methods via GridView etc for SelectMethod, UpdateMethod etc.

 

Unfortunately my implementations of these methods on the WCF side the object coming back lost its EntityKey so I cannot re-attach it. I did some ugly code temporarily to re-build the EntityKey but its very specific.

 

Is there anything I can do so the EntityKey isn't lost as it gets sent over WCF and back so I can easily re-attach it?

 

Any help would be greatly appreciated!

Thanks.

解决方案

First I should make sure you are using beta3 or later. Next, I need to determine at what point the keys are getting dropped: does the client receive the keys and then not send them back to server? If the client doesn't receive them, please send the code the client uses to populate the grid. Also, when you added the service reference, did you tell svcutil to exclude types from System.data.entity.dll and your model assembly from the generated proxy? This will help me track down the issue.


这篇关于通过WCF重新附加实体。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆