RoslynRules.EntityFrameworkCore 1.0.2

dotnet add package RoslynRules.EntityFrameworkCore --version 1.0.2
                    
NuGet\Install-Package RoslynRules.EntityFrameworkCore -Version 1.0.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="RoslynRules.EntityFrameworkCore" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RoslynRules.EntityFrameworkCore" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="RoslynRules.EntityFrameworkCore" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add RoslynRules.EntityFrameworkCore --version 1.0.2
                    
#r "nuget: RoslynRules.EntityFrameworkCore, 1.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package RoslynRules.EntityFrameworkCore@1.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=RoslynRules.EntityFrameworkCore&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=RoslynRules.EntityFrameworkCore&version=1.0.2
                    
Install as a Cake Tool

RoslynRules.EFCore

EF Core integration for RoslynRules. Provides entity mapping and lazy loading support while keeping the core Rule model sealed and immutable.

Problem

Rule is sealed to enforce immutability after compilation. This prevents EF Core lazy loading proxies from working (proxies require subclassing).

Solution

This package provides separate EF entities (RuleEntity, WorkflowEntity) that map to the same database schema. You use EF's entities for persistence and lazy loading, then convert to sealed domain models for execution.

Usage

1. Configure your DbContext

public class AppDbContext : DbContext
{
    public DbSet<WorkflowEntity> Workflows { get; set; } = null!;

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.ConfigureRoslynRules();
    }
}

2. Load with lazy loading, convert to domain model

// Lazy loading works — RuleEntity is NOT sealed
var entity = await db.Workflows.FirstAsync();

// Convert to sealed domain model
var workflow = entity.ToDomainModel();

// Compile and execute as usual
workflow.Compile(new[] { new RuleParameter("customer", typeof(Customer)) });
var results = workflow.Execute(new[] { new RuleParameter("customer", typeof(Customer), customer) });

How It Works

Layer Type Sealed Lazy Loading
RuleEntity EF persistence No Yes
Rule Domain/execution Yes No

The ToDomainModel() method recursively converts the entity graph to sealed Rule instances. Once converted, the domain model has full immutability and compilation safety.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2 41 6/4/2026
1.0.1 39 6/3/2026
1.0.0 41 6/3/2026