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?
thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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