Made in USA: Enterprise Application Services

Ringing PhoneCall Today!817-210-4042

MVC and Entity Framework

MVC and Entity Framework

January 29, 2014

We love Microsoft’s Entity Framework and the MVC framework. Put together, they make development a lot easier because they take care of a lot of the heavy lifting. As a bonus, they help make applications more structured, more easily testable and more fun to work on.  Below are some steps for setting up a Code First entity framework MVC4 project in Visual Studio:
1. Define the model
2. Create the DBcontext
3. Add a connection string
4. Add a data initializer
5. Set the initializer in global.asax.cs
6. Add the DBcontext object to a view order to test

As with all technologies, it takes a while to get comfortable with how to apply these steps in an accurate manner. This is in part because most tutorials focus on the details. They explain how to use a given technology, pattern or framework, however it is often hard to find a practical ‘use case’.

Here is a link to some practical use cases:
1. Scaffolding
2. Unit Testing
3. Paging ans Sorting

Related Posts