MVC and Entity Framework

By Teodora, Quality assurance specialist at Flat Rock

One of the most popular design patterns, used in the development of web applications is the MVC or Model View Controller. One of its most important advantages is the so called SoC (Separation of concerns). To put it simply – MVC allows separating the logic of an application and the user interface. It consists of three main components:

→ Model – where the data is maintained and some of the processing takes place

→ View – represents the data to the user (user interface)

→ Controller – manages the communication between the other two elements (handles the user requests) and some of the processing

MVC allows independent development of the components relying on the principles of loose coupling. That means that each of the parts of the project (View, Model and Controller) depend on very few common parts. When the design of a page needs improvement, for example, only the view files will need to be edited and the models and controllers associated with it can be left unchanged.

MVC, however, requires careful and detailed planning of the application’s architecture, so it is necessary to think beforehand if it will be the right solution for the specific product. It also lacks the great variety of user controls provided by Web Forms. MVC requires custom implementations or the use of JavaScript plugins for user interface elements.

What is Entity Framework?

Entity framework is an object-relational mapper that is used by .NET developers to abstract away the database and use plain objects instead. It can be viewed as an extra layer between the database and the software application that enables programmers to reduce the amount of used code in the process of development. Its main advantages include:

→ Easy to access and perform CRUD operations

→ No necessity to use SQL statements to access the database – a single common syntax is used for all queries (LINQ)

→ Possibility to choose between Model first, Database first or Code first approach

→ Fewer possibilities for SQL injection attacks

Want to learn more or hire a specialist? Contact us at [email protected]


Referral posts