Do you use any of the Entity Framework Core tracking functionality?
Are there any current, well known design patterns that are complemented by any kind of persistence in data access layer?
I am a .net consultant in a very large market (13 years) and never once have I been approached by any client who has asked me to design a service layer that requires any kind of state i.e. tracking. Also, for the many large clients I have worked for, none of them have software running in their organization that implements such a design.
Entity Framework Core is supposedly a new beginning for EF yet tracking remains a core design feature. If no one uses designs that require or even use EF's tracking features than why is tracking still part of the framework?
Here is how I use EF in a stateless service layer i.e. REST or WCF
User requests data:
using(context = new DbContext()) { // get some data and dispose context }
User modifies data and posts:
using(context = new DbContext()) { // add or update as necessary and dispose }
In above example we create two instances of the context - neither depends on the other or needs tracking/state. For data I need fast access too I use a cache or dictionary.
0 comments:
Post a Comment