What is Entity Framework?
In this article i will resume my researches about EF hopefully this can help you to understand it generally.
EF is an ORM (Object Relational Mapping) provided by .Net Framework developed by Microsoft using CSharp programming language. It is an essential part of the ASP.NET web stack.
With EF, you will no longer write code for SQL queries, managing your database becomes easy, first relating the database entities as objects then to classes with their properties. So you create a set of entities using Plan Old C# Objects (POCO).
Entity Framework Versions
EF is an ORM (Object Relational Mapping) provided by .Net Framework developed by Microsoft using CSharp programming language. It is an essential part of the ASP.NET web stack.
With EF, you will no longer write code for SQL queries, managing your database becomes easy, first relating the database entities as objects then to classes with their properties. So you create a set of entities using Plan Old C# Objects (POCO).
Entity Framework Versions
- EF6 released in 2013 with .Net 4.0 and .Net 4.5, VS 2012
- EF5 released in 2012 with .Net 4.0, VS 2012
- EF4.3 released in 2011 with .Net 4.0, VS 2012
- EF4.0 released in 2010 with .Net 4.0, VS 2012
- EF1.0(or 3.5) released in 2008 with .Net 3.5 SP1, VS 2008
Entity Framework Features
Cross-platform(EF Core), Modelling, Querying, Change Tracking, Saving, Concurrency, Transactions, Caching, Built-in Conventions, Configurations, Migrations.
Entity Framework Workflows Cross-platform(EF Core), Modelling, Querying, Change Tracking, Saving, Concurrency, Transactions, Caching, Built-in Conventions, Configurations, Migrations.
Database First
If you have DB designed by DBAs, developed separately or if you have existing DB, EF create entities for you and after modification of mapping you will generate POCO entities.
Manual changes to the database are possible because the database defines your domain model. You can always update model from database.
Model First
You will draw your model and let workflow generate your database ad T4 template generate your POCO(plain old CLR object) entities. Better using it for small easy projects to not to lose part of the control on both entities and DB.
Manual changes to database will be most probably lost because your model defines the database. This works better if you have Database generation power pack installed. It will allow you updating database schema (instead of recreating) or updating database projects in VS.
Code First
Is the most popular approach, you get full control over the code (no autogenerated code which is hard to modify).
It let you transform your coded classes into database application and vice versa.
Manual changes to database will be most probably lost because your code defines the database.
The development workflow in the code-first approach would be: Create or modify domain classes -> configure these domain classes using Fluent-API or data annotation attributes -> Create or update the database schema using automated migration or code-based migration.
It let you transform your coded classes into database application and vice versa.
Manual changes to database will be most probably lost because your code defines the database.
The development workflow in the code-first approach would be: Create or modify domain classes -> configure these domain classes using Fluent-API or data annotation attributes -> Create or update the database schema using automated migration or code-based migration.
Post a Comment