Entity Framework

Entity Framework is a object-relational mapping (ORM) framework.

The advantages of using an ORM in the application is that it takes the security aspect away from the programmer. This means that the integration between application and database is likely to be more secure.

Available in .NET Framework and .NET Core, it integrates a .NET application with a database, with Microsoft SQL Server very well supported.

It has support for LINQ queries, change tracking, updates and schema migrations.

Previous versions of Entity Framework had support for "database-first". This is where you created the database, hook your application to that database and import the database structure into your .NET application.

However, latest versions of Entity Framework support "code-first". You build up your entities in your application and add them to a DbContext. Then, you can use EF Migrations to import the entities and properties to your database. The entities are translated into tables, and the properties are translated into columns.
EF Core 6 new features and changes for .NET 6 EF Core 6 new features and changes for .NET 6 Check out what's new in EF Core 6. As part of .NET 6, Entity Framework Core introduced migration bundles and support for temporal tables. 12th December 2021
Log Data Changes in Entity Framework Core – Part 3 - Ignore, Reference, SQL Server JSON and Testing Log Data Changes in Entity Framework Core – Part 3 - Ignore, Reference, SQL Server JSON and Testing Functionality to include reference properties when logging data changes in Entity Framework. Also look at merging JSON keys into SQL Server columns. 17th August 2020
Round The Code Log Data Changes in Entity Framework Core – Part 2 - Service Integration For Testing With An API Using entities & DbContext's for integrating services into our ASP.NET Core MVC API. We then use Postman to log data changes in Entity Framework. 12th August 2020
Round The Code Log Data Changes in Entity Framework Core - Part 1 - Create Entities & DbContext's Using Entity Framework to log data changes. We create our entities and our DbContext's. Next, we go ahead and set up EF Migrations. 7th August 2020
Round The Code Using Hosted Services in ASP.NET Core to Create a "Most Viewed" Background Service Using ASP.NET Core's Hosted Service for background tasks. Initialising a new scope in IServiceProvider to use Entity Framework in Hosted Services. 17th July 2020
Create CRUD API Endpoints with ASP.NET Core & Entity Framework Create CRUD API Endpoints with ASP.NET Core & Entity Framework We use an ASP.NET Core API to create generic CRUD Endpoints. Using Entity Framework's DbContext & Migrations, as well as Reflection & Controllers. 13th July 2020
Round The Code Create a Small Blog in Blazor - Part 3 - Build Entity Framework Queries We create services, with methods that contain Entity Framework queries for our blog before adding the services to Dependency Injection. 8th June 2020
Round The Code Create a Small Blog in Blazor - Part 2 - Entity Framework Integration We set up our entities and DbContext to integrate Entity Framework into our Blazor Server app. We also create the SQL Server database required. 29th May 2020
Using Entity Framework in a Blazor Server Application Using Entity Framework in a Blazor Server Application Find out how to change Entity Framework's scope to Transient and how to create new service scopes to use Entity Framework in Blazor. 9th April 2020
Round The Code Using Reflection to Create a Dynamic OnModelCreating in Entity Framework Using System.Reflection to invoke static OnModelCreating methods, allowing Entity Framework models to be invoked dynamically. 24th March 2020