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 ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.