简体   繁体   中英

context instancing in entity framework class library used by different kinds of applications

I am using the latest Entity Framework with a code-first approach to create a data access assembly that can then be used by multiple projects. Many threads on stackoverflow seem to suggest creating one context per request in an MVC web app. But I also want to use the same assembly from WinForms or console applications - what kind of approach should one use in regards to context instancing if it is to be shared between such different programs?

约翰·桑德斯(John Saunders)所说的每个逻辑操作一个上下文听起来不错,猜想我只需要在不同类型的应用程序中以不同的方式使用它(例如,将其放在网页的请求对象中,或者为控制台应用程序传递一个实例)。

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM