EF 4 Self Tracking Entities does not work as expected

前端 未结 5 1268
不思量自难忘°
不思量自难忘° 2021-01-25 18:16

I am using EF4 Self Tracking Entities (VS2010 Beta 2 CTP 2 plus new T4 generator). But when I try to update entity information it does not update to database as expected.

<
5条回答
  •  长情又很酷
    2021-01-25 19:13

    After reading the following tip from Daniel Simmons, the STE starts tracking. Here is the link for the full article. http://msdn.microsoft.com/en-us/magazine/ee335715.aspx

    Make certain to reuse the Self-Tracking Entity template’s generated entity code on your client. If you use proxy code generated by Add Service Reference in Visual Studio or some other tool, things look right for the most part, but you will discover that the entities don’t actually keep track of their changes on the client.

    so in the client make sure you don't use add service reference to get the proxy instead access service through following code.

    var svc = new ChannelFactory("BasicHttpBinding_IMyService").CreateChannel();
    var res = svc.GetResource(1);
    

提交回复
热议问题