my task is to have a component that allows persistent data reads/writes utilizing Entity Framework. Keeping in mind the following:
So the question is: is this a good idea to have two separate contexts, that will live as long as components lives. One context is for write/update (with periodically SaveChanges call), another one is for reading (with entities tracking off).
Will I potentially gain benefits or on the contrary have issues with this approach?
Thanks in advance.
我认为这不是一个好主意,因为您将成为无法控制的数据模型的重复。
the recommended practice is to have shorter lived contexts, so they dont endup holding too many objects in memory and thus conflicting changes and complex relationships
this might help
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.