Learn Minimal APIs from start to finish. Perfect for beginners.

Entity Framework code examples

Keyset vs offset pagination in EF Core
Keyset vs offset pagination in EF Core

See how keyset and offset pagination are implemented in EF Core, how indexes affect performance, so you decide which approach suits your application.

EF Core temporal tables in an ASP.NET Core Web API
EF Core temporal tables in an ASP.NET Core Web API

Download an EF Core temporal table code example in an ASP.NET Core Web API with configuration and historic data queries

Reusable PagedResults type for Entity Framework Core
Reusable PagedResults type for Entity Framework Core

Download a code example that includes a reusable PagedResults type and query extension, ideal for pagination in Entity Framework Core.

Automated SQL scripts using Entity Framework Core migrations
Automated SQL scripts using Entity Framework Core migrations

Learn how to add Entity Framework Core migrations in an Web API and worker project and use it to automate SQL scripts across all environments.

Using transactions with Entity Framework Core
Using transactions with Entity Framework Core

See a code example of how transactions are used in Entity Framework Core and how they can be committed and rolled back

Using global query filters in Entity Framework Core
Using global query filters in Entity Framework Core

Download a .NET 10 sample project demonstrating Global Query Filters in Entity Framework Core, including soft delete and multitenancy, and run it in Visual Studio to see how they work in practice.

Get started with Entity Framework Core
Get started with Entity Framework Core

Get started with EF Core includes creating a DbContext, adding a migration, CRUD operations, the Include method, raw SQL queries and stored procedures.

Dynamic queries using LINQ expressions
Dynamic queries using LINQ expressions

Writing dynamic queries for Entity Framework. A sample .NET 5 MVC application, showing examples of LINQ expressions.