EF 4 Self Tracking Entities does not work as expected

前端 未结 5 1294
不思量自难忘°
不思量自难忘° 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 18:58

    This is probably a long shot... but:

    I assume your Service is actually in another Tier? If you are testing in the same tier you will have problems.

    Self Tracking Entities (STEs) don't record changes until when they are connected to an ObjectContext, the idea is that if they are connected to a ObjectContext it can record changes for them and there is no point doing the same work twice.

    STEs start tracking once they are deserialized on the client using WCF, i.e. once they are materialized to a tier without an ObjectContext.

    If you look through the generated code you should be able to see how to turn tracking on manually too.

    Hope this helps

    Alex

提交回复
热议问题