Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Apr 25, 2012 03:10 PM by XIII
Apr 25, 2012 03:02 PM|LINK
How do I create a database context for MVC if I already have a database? Please provide a link with some sample code.
(All the sample i find wants to do code first.)
Apr 25, 2012 03:09 PM|LINK
You can most definitely build a context database first. In fact one of the modes you can use Entity Framework is EF Database First. In this case you can just create an edmx file and drag your tables and it generates the data context for you
If you don't want to use full fledged entities, you can still use EF code first models (raw pocos) with an existing database.
See this blog post on how to do that. ( you can easily modify th technique used in this post to work with mvc)
Also check out
Apr 25, 2012 03:10 PM|LINK
How do I create a database context for MVC if I already have a database?
If I understand your question correctly you're looking for this:
Building an MVC 3 App with Database First and Entity Framework.