开发者

Change Tracking with DTO to POCO Entity Framework 4/4.1

I've used Entity Framework 4.0 POCO entities for persistence layer in the current project.

I've used DTO's to send the data from Service Layer to UI Layer. Repositories and inside of Service Layer have used POCO.

There is a Mapping Layer to map (DTO to Domain(POCO) and (Domain(POCO) to DTO). At the moment, we manu开发者_开发百科ally track the changes.

For example, If entity id is zero we assume that entity is a new one and if not entity is an update.

Is there any way to achieve this other than implementing IsTransient(New), IsDirty(Update) or IsDeleted(Delete) properties manually in Entity Framework 4.0?


If you use your custom DTO you must always implement your own change tracking.

EF 4 offers only self tracking entities but that would require you to use these entities directly instead of DTOs and they have some other disadvantages.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜