Regira.DAL.EFcore 6.1.2

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

Regira DAL — EF Core

Regira DAL.EFcore provides Entity Framework Core extensions and utilities for change tracking, string normalization, auto-truncation, and model configuration.

Projects

Project Package Description
DAL.EFcore Regira.DAL.EFcore EF Core extensions for DbContext, ModelBuilder, and interceptors

Installation

<PackageReference Include="Regira.DAL.EFcore" Version="6.*" />

DbContext Extensions

GetPendingEntries

Returns all tracked entries with pending changes (Added, Modified, or Deleted).

var pending = dbContext.GetPendingEntries();
var pendingProducts = dbContext.GetPendingEntries<Product>();

SaveAndCleanUpOnError

Wraps SaveChangesAsync; on a DbUpdateException it resets the failing entries (detaches added, reverts modified/deleted to Unchanged) and then rethrows. Catch the exception and call save again to persist the remaining entries.

try
{
    await dbContext.SaveAndCleanUpOnError();
}
catch (DbUpdateException)
{
    // failing entries have been reset — retry saves the rest
    await dbContext.SaveChangesAsync();
}

AutoNormalizeStringsForEntries

Runs string normalization (via NormalizingUtility) over all pending non-deleted entries.

dbContext.AutoNormalizeStringsForEntries();
// or with custom options:
dbContext.AutoNormalizeStringsForEntries(new NormalizingOptions { … });

AddRegisteredInterceptors

Discovers all IInterceptor registrations from an IServiceCollection and adds them to the DbContextOptionsBuilder.

optionsBuilder.AddRegisteredInterceptors(services);

Auto-Truncate

Automatically truncates string values to the maximum length defined by [MaxLength] or [StringLength] attributes before saving.

AutoTruncateStringsToMaxLengthForEntries (extension method)

Call manually inside SaveChanges / SaveChangesAsync overrides:

public override async Task<int> SaveChangesAsync(CancellationToken ct = default)
{
    this.AutoTruncateStringsToMaxLengthForEntries();
    return await base.SaveChangesAsync(ct);
}

AutoTruncateDbContextInterceptor (.NET Core 3.1+)

Register as an interceptor for automatic truncation on every save without touching the DbContext:

// Manual registration
optionsBuilder.AddAutoTruncateInterceptors();

// Or register in DI and auto-discover with AddRegisteredInterceptors
services.AddSingleton<IInterceptor, AutoTruncateDbContextInterceptor>();
optionsBuilder.AddRegisteredInterceptors(services);

ModelBuilder Extensions

SetDecimalPrecisionConvention

Applies a uniform precision and scale to all decimal properties in the model.

// In OnModelCreating (all TFMs)
modelBuilder.SetDecimalPrecisionConvention(precision: 18, scale: 4);

// In ConfigureConventions (.NET 6+)
configurationBuilder.SetDecimalPrecisionConvention(precision: 18, scale: 4);

SetUtcDateTimeConvention

Applies UtcDateTimeConverter (Regira.DAL.EFcore.Conversions) to all DateTime (and DateTime?) properties: values are normalized to UTC when saving (local kinds converted, unspecified kinds assumed UTC) and materialized with DateTimeKind.Utc when reading, so JSON serialization produces ISO 8601 strings with the Z suffix.

The converter honors the process-wide Regira.Utilities.DateTimeDefaults.UseUtc policy (enabled by default): when the policy is disabled it passes values through unchanged. Properties that already have a value converter configured are skipped, so a per-property converter acts as an opt-out.

// In AddDbContext — DbContextOptionsBuilder extension
services.AddDbContext<AppDbContext>(options => options
    .UseSqlite(connectionString)
    .AddUtcDateTimeConvention());

// In OnModelCreating (all TFMs)
modelBuilder.SetUtcDateTimeConvention();

// In ConfigureConventions (.NET 6+)
configurationBuilder.SetUtcDateTimeConvention();

EntityType / Entry Extensions

GetPropertyAttributes

Retrieves the data-annotation attributes for each property of an entity entry, with results cached per entity type to avoid repeated reflection.

var attributes = entry.GetPropertyAttributes();
// IDictionary<IProperty, Attribute[]>

ServiceCollection Extensions

CollectDescriptors<TService>

Finds all service descriptors in an IServiceCollection that implement the given interface — used internally by AddRegisteredInterceptors.

var interceptorDescriptors = services.CollectDescriptors<IInterceptor>();

License

Apache License 2.0 — this package contains no license validation and no runtime limits. See LICENSE. A few companion packages are commercially licensed with a free tier; see the licensing overview.

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 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 Regira.DAL.EFcore:

Package Downloads
Regira.Entities.EFcore

Entity Framework Core integration for the Regira entity framework. Free tier included — a license key removes the free-tier limits.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
6.1.2 96 8/16/2026
6.1.1 122 8/12/2026
6.1.0 180 8/10/2026