Question about entityframework instances (this post is used to count usage habits and causes)

Source: Internet
Author: User

First, ask the Administrator to allow me to count the solution in a few places on the homepage. I have asked this question in the group, and I have to ask for more comments and ideas, at the same time, let's solve a question for everyone.

When using entityframework in combination with web, I found the following problems:

1): If the repository mode is used, generally, each specific repository has a context (objectcontext, or dbcontext) attribute to perform specific data access operations.

2): a page (or a controller/Action), that is, a request, usually faces multiple Repository

3) the cache is not shared among multiple context instances.

--------------------------------------------------------------------------

My problem is:

In the process of using it, is it an httprequest context instance, or is it used to create a new instance every time.

If your policy is: An httprequest corresponds to a context instance, please reply to

If you adopt the following policy: reply to B every time you create a new context instance.

If you adopt other policies, please reply to C.

If you can, please attach your reason (very important)

Thank you.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.