0

Im working on a MVC application, and was just wondering.. Should I be using the singleton pattern on my dbcontext object or is it safe to just instantiate one in every controller needed ?

1 Answer 1

2

You should not use a singleton pattern. Use one DbContext for one unit of work. The controller seems like a reasonable place to instantiate the context.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.