2

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?

dsgriffin
  • 66,495
  • 17
  • 137
  • 137
Hemant Kumar
  • 4,593
  • 9
  • 56
  • 95
  • Yes, it is entirely possible, but there are certain things you have to do first. What you do depends on the approach you are taking e.g. code first, model first etc. – Justin Harvey Nov 07 '12 at 10:56
  • you can of course, but should you? no business logic or DAL project? do you really want to handle the EF connectivity in the UI level? see my answer here: http://stackoverflow.com/a/7474357/559144 – Davide Piras Nov 07 '12 at 10:57
  • @Jai Ganesh, do you want to use EF for this ? – Yasser Shaikh Nov 07 '12 at 11:08
  • This will be more helpful for you: http://msdn.microsoft.com/en-us/data/ff191186.aspx – Rusty Nov 07 '12 at 11:03
  • Yes, of course you can. See theese links: - http://blogs.msdn.com/b/brada/archive/2008/01/29/asp-net-mvc-example-application-over-northwind-with-the-entity-framework.aspx - http://www.youtube.com/watch?v=j8Ij3TeZKZo - http://www.codeproject.com/Articles/70061/Architecture-Guide-ASP-NET-MVC-Framework-N-tier- – Lukas Winzenried Nov 07 '12 at 10:59

0 Answers0