Entity Framework in Asp .Net Core MVC Part 1
Entity Framework in Asp.net Core MVC By Sagar Jaybhay
Entity framework core also called an EF core. EF is completely re-written from the ground up. Also, we found Entity framework very much similar feature like old versions. EF core is ORM (Object Relational Mapper).
It actually some enhancements in ADO.Net which give some automated data accessing and storing functionality.
Entity Framework is an extensible and opensource framework and it is worked on Windows, Linux, Mac. Entity framework is cross-platform and the main thing is it is official data access platform by Microsoft. The use is it enables the developer to work with the database with business object.
So what it means that as we are a developer we worked with business objects like class variables and methods and underlying business object generate SQL for the database. By using ORM we avoid writing lots of code for interaction with database.
EF Core Version History
|EF Core Version||Release Date|
|EF Core 2.0||August 2017|
|EF Core 1.1||November 2016|
|EF Core 1.0||June 2016|
- EF Core on GitHub: https://github.com/aspnet/EntityFrameworkCore
- EF Core Roadmap: docs.microsoft.com/en-us/ef/core/what-is-new/roadmap
- TrackEFCore’sissues https://github.com/aspnet/EntityFrameworkCore/issues
- EF Core Official Documentation: https://docs.microsoft.com/ef/core
In this, we have some domain classes which means it is almost clone of our database table. EF core supports both 2 approaches.
- Code first approach
- Database first approach
We have some limited support for database first approach right now because a visual designer and wizard-like previous entity framework is not supported right now.
Code First Approach:
In code first approach we created domain class like an employee, student, customer like that. We also create special class which derives from entity framework which is DBContext class. By using this domain and Dbcontext class entity framework create a database by using entity framework default conventions and you can change default conventions.
Database First Approach
In the database first approach, we generate domain classes and Dbcontext class from underlying table which is already present in the database.
EF Core Database Providers:
EF core supports many relational and non-relational databases how it supports because of database providers and you can easily add this in your project using Nuget package manager.
Entity Framework Core can access many different databases through plug-in libraries called database providers.
Complete list of database providers: link
Database providers usually sit between a database and EF core.
In Entity Framework core the functionality which is common to all database is present in EF Core and database-specific functionality is present in specific database providers nugget packages.
Sagar Jaybhay, from Maharashtra, India, is currently a Senior Software Developer. He has continuously grown in the roles that he has held in the more than seven years he has been with this company. Sagar Jaybhay is an excellent team member and prides himself on his work contributions to his team and company as a whole.