IronAlpine.Data.EFCore 3.0.0

dotnet add package IronAlpine.Data.EFCore --version 3.0.0
                    
NuGet\Install-Package IronAlpine.Data.EFCore -Version 3.0.0
                    
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="IronAlpine.Data.EFCore" Version="3.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="IronAlpine.Data.EFCore" Version="3.0.0" />
                    
Directory.Packages.props
<PackageReference Include="IronAlpine.Data.EFCore" />
                    
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 IronAlpine.Data.EFCore --version 3.0.0
                    
#r "nuget: IronAlpine.Data.EFCore, 3.0.0"
                    
#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 IronAlpine.Data.EFCore@3.0.0
                    
#: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=IronAlpine.Data.EFCore&version=3.0.0
                    
Install as a Cake Addin
#tool nuget:?package=IronAlpine.Data.EFCore&version=3.0.0
                    
Install as a Cake Tool

IronAlpine.Data.EFCore

IronAlpine.Data.EFCore is the Entity Framework Core runtime for IronAlpine data access.

It provides:

  • repository implementations for read, write, aggregate, and projection access
  • EF Core IUnitOfWork
  • auditing and persistence interceptors
  • built-in audit-log persistence support
  • resilient save extensions
  • enumeration conversion helpers

Why

Use this package when your service persistence runtime is EF Core and you want repository/UoW abstractions with deterministic modeling and interceptor behavior.

It exists so services stop rebuilding the same repository, save, and auditing infrastructure.

Install

dotnet add package IronAlpine.Data.EFCore

Optional companion package:

dotnet add package IronAlpine.Data.EFCore.Mediator

Quick Start

builder.Services.AddIronAlpineDataEfCoreDbContext<AppDbContext>(builder.Configuration);

Public Surface

Primary registration methods:

  • AddIronAlpineDataEfCoreDbContext<TDbContext>(...)
  • AddIronAlpineDataEfCore<TDbContext>(...)

Important helpers:

  • SaveChangesResilientAsync(...)
  • HasEnumerationConversion<TEnum>()
  • HasNullableEnumerationConversion<TEnum>()

Configuration

Configuration root:

{
  "IronAlpine": {
    "Data": {
      "EFCore": {
        "ConnectionStringName": "DefaultConnection",
        "EnableSensitiveDataLogging": false,
        "EnableDetailedErrors": false,
        "CommandTimeoutSeconds": 30,
        "Auditing": {
          "DefaultActorValue": "system"
        }
      }
    }
  }
}

Runtime Responsibilities

This package registers:

  • IUnitOfWork
  • repository implementations
  • EF interceptors for auditing and persistence concerns
  • audit log writer
  • contributor/modeling runtime integration

Options and Behavior

Connection string selection

  • typically resolved from configuration by the consuming service registration
  • best practice: use explicit named connection strings per service database

Sensitive data logging

  • keep off in production unless diagnosing a contained problem
  • turning it on increases exposure risk for parameter values

Detailed errors

  • useful during troubleshooting
  • small runtime overhead, usually acceptable outside hot paths

Command timeout

  • keep explicit for services with long-running queries or replay workflows
  • do not hide slow-query problems by setting it arbitrarily high

Auditing default actor

  • used when runtime actor resolution is not available
  • design-time migrations and background maintenance paths commonly fall back to this value

Repositories

The package provides concrete implementations for:

  • aggregate repositories
  • projection repositories
  • read repositories
  • write repositories

Best practice:

  • use aggregate repositories for write models
  • use projection read repositories for query models
  • keep IQueryable usage inside handlers/repositories, not controllers

Unit of Work

IUnitOfWork remains handler-driven in the DPS migration strategy.

That means:

  • handlers decide when to save
  • transaction behaviors may wrap execution
  • save timing stays explicit

Use:

await _unitOfWork.SaveChangesAsync(cancellationToken);
await _unitOfWork.SaveChangesResilientAsync(cancellationToken);

Use the resilient variant when the operation should respect configured save resiliency policy.

Auditing

Built-in pieces include:

  • audit entity interceptors for CreatedBy, CreatedOnUtc, ModifiedBy, ModifiedOnUtc
  • AuditLog entity mapping and contributor
  • IAuditLogWriter EF implementation

This gives both row-level persistence auditing and audit log table support.

Enumerations and Value Objects

Enumeration helpers

Use:

  • HasEnumerationConversion<TEnum>()
  • HasNullableEnumerationConversion<TEnum>()

when mapping IronAlpine Enumeration<T> values.

Value object policy

Generic magic converters are intentionally not provided.

Use explicit EF mapping:

  • OwnsOne(...)
  • custom HasConversion(...)

This keeps query semantics and migrations deterministic.

Combinations

Data.EFCore + Data.EFCore.Mediator

Recommended when mediator pipeline transactions and domain-event dispatch are required.

Data.EFCore + Messaging.InboxOutbox.EFCore

Recommended for services publishing and consuming integration events with durable inbox/outbox tables.

Data.EFCore + Security.Authorization.EFCore

Use when permission projections must be persisted and kept queryable.

Troubleshooting

Repositories are registered but tables are missing

Cause:

  • model contributors or provider configuration missing

Fix:

  • verify service-level EF registration and contributor packages

Auditing fields stay empty

Cause:

  • no current-user provider
  • no fallback actor configured

Fix:

  • verify web/security runtime registration
  • verify default auditing actor for non-request flows

Enumeration columns fail at runtime

Cause:

  • entity mapping did not apply enumeration conversion

Fix:

  • add the explicit enumeration conversion helper in the entity configuration
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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 is compatible.  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 (1)

Showing the top 1 NuGet packages that depend on IronAlpine.Data.EFCore:

Package Downloads
IronAlpine.Data.EFCore.Mediator

Mediator pipeline behaviors that bridge IronAlpine.Mediator and IronAlpine.Data.EFCore.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.0 686 4/20/2026
2.2.0 110 4/17/2026
2.1.2 278 4/14/2026
2.1.1 177 4/10/2026
2.1.0 394 4/8/2026
2.0.10 112 4/8/2026
2.0.7 352 4/4/2026
Loading failed

Stable mediator release with request/response, notification publish strategies, streaming, and dependency injection integration.