How to get original Entity from ChangeTracker

前端 未结 4 1932
执笔经年
执笔经年 2021-02-04 11:50

Is there a way to get the original Entity itself from the ChangeTracker (rather than just the original values)?

If the State is Modified<

4条回答
  •  被撕碎了的回忆
    2021-02-04 12:34

    While working with EF 6 i used the following code to get the underlying POCO entity type from proxy type,

    var entityType = ObjectContext.GetObjectType(dbEntitymodifiedEntry.Entity.GetType());
    

    ObjectContext.GetObjectType : Return the POCO from proxy object

提交回复
热议问题