I work with a senior developer who is an architect. Over the past 6 months, we have had many constructive arguments, and in most of our discussions I have conceded defeat. I learned to stacks to work with him. However, there is one design problem with which we currently disagree, and I would like to receive some opinions / suggestions because he did not manage to convince me of his position, and I will stick to my weapon until someone gives me evidence that I am wrong.
We use Entity Framework 4.0, and we use BOTH, which support persistence, and Self Tracked Entities in different models. We started using Self Tracked Entities to track changes in entity diagrams that we serialized / deserialized by WCF wiring in our Silverlight application. It works fantastic. We also started using Self Tracked Entities for models that we DO NOT accept during WCF, but many of them remain constant knowledge of Entities / Models.
My colleague believes that ObjectContext Entity Frameworks should be stored as soon as possible. He insists that he should be only for the time necessary to complete the request, and the time necessary to save something. Any work with entrepreneurs should be carried out separately. For each Entity model, we have a request class and a constant class, which are IDisposable and have an ObjectContext in the instance area and have request / persistence logic in the methods. We use these request / persistence classes in our business logic, and not directly use the ObjectContext in business logic. When these class instances are constructed like this, it is an ObjectContext, and when Disposed, so is ObjectContext Disposed. These classes are like wrappers around our LINQ operations,Separating EFs from business logic and helping reuse LINQ queries
:
, ObjectContext, , , - ObjectContext , , ObjectContext , -, . , Entities -, . . , , EF .
Self-Tracked Entities , , -, , , , , Self -Tracked Entities.
, Entity Framework Entity Framework DAL? ObjectContext? - ObjectContext? , ObjectContext? , , - Self-Tracked Entities , Self Tracking , ( , , Self-Tracked Entities -)...
, ObjectContext , , , ObjectContext ... EntityFramework...
... .