Click here to Skip to main content
15,886,067 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Can I connect to the DB using DBContext in MVC3 by defining the ConnectionString in Web.config?

If possible can anyone provide me some links too?
Posted
Updated 7-Nov-12 0:18am
v2

The short answer is yes. You can use Entity Framework in your controller actions methods:

http://msdn.microsoft.com/en-gb/data/ee712907[^]

The view engine you use has no bearing on your data layer at all. It's one of the benefits of using MVC.
 
Share this answer
 
Comments
hemantwithu 7-Nov-12 6:27am    
Thanks for replying.Can we do this with Code First?If yes ,What are the Advantages and Disadvantages of CF?
jim lahey 7-Nov-12 6:29am    
That looks like a separate question to me. Please don't ask questions in the comments section, they get overlooked. If you ask that as another question, others can find it there.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900