开发者

what is the default pattern in entity framework?

what is the default pattern using in entity framework?

is it the Simple Entities or Change Set?

Can you give me a simple code for each one?

tha开发者_开发知识库nks


Default pattern would be Simple Entities

However, both patterns are supported, and the use would depend on the application. If you want a Change Set pattern i would suggest an alternative "Self-Tracking" entities.

EF supports Simple Entities pattern by allowing you to attach/detach your object from a context by calling Attach/Detach/ApplyPropertyChanges

EF 3.5 makes it a little more challenging to pull of the change set pattern. Because it does not give you means to pass around changes to entities. However if you have the flexibility to use data services you could pull this off.

EF 4 Supports Self-Tracking Pattern by allowing you to customize tracking code that gets generated based on your EF model.

As for the details an examples MS has actually provided a good set of definition of the patterns as well as example implementations

The below blog gives you everything you need.

Building N-Tier Apps with EF4

Example implementation of change set

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜