Skip to content

Entity Framework Core

The implementation of database sessions using Entity Framework Core provides configuration and registration for using EF.

To add Raiqub.Expressions.EntityFrameworkCore library to a .NET project, go get it from Nuget:

shell
dotnet add package Raiqub.Expressions.EntityFrameworkCore
powershell
PM> Install-Package Raiqub.Expressions.EntityFrameworkCore
shell
paket add nuget Raiqub.Expressions.EntityFrameworkCore

DbContext Registration

You need to register the factory of your DbContext by using AddDbContextFactory extension method:

csharp
services.AddDbContextFactory<YourDbContext>();

WARNING

Registering using AddDbContext method does not work and will prevent the creation of database sessions.

Register Database Session

Register the session and session factories using the following extension method:

csharp
services.AddEntityFrameworkExpressions()
    .AddSingleContext<YourDbContext>();

Released under the MIT License.