TailoredApps.Shared.EntityFramework 2.1.0

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package TailoredApps.Shared.EntityFramework --version 2.1.0
                    
NuGet\Install-Package TailoredApps.Shared.EntityFramework -Version 2.1.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="TailoredApps.Shared.EntityFramework" Version="2.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TailoredApps.Shared.EntityFramework" Version="2.1.0" />
                    
Directory.Packages.props
<PackageReference Include="TailoredApps.Shared.EntityFramework" />
                    
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 TailoredApps.Shared.EntityFramework --version 2.1.0
                    
#r "nuget: TailoredApps.Shared.EntityFramework, 2.1.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 TailoredApps.Shared.EntityFramework@2.1.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=TailoredApps.Shared.EntityFramework&version=2.1.0
                    
Install as a Cake Addin
#tool nuget:?package=TailoredApps.Shared.EntityFramework&version=2.1.0
                    
Install as a Cake Tool

TailoredApps.Shared.EntityFramework

Introduction

Nuget packages for integrating Unit of Work (a pattern for data management and handling transactions) into backend projects that rely on Microsoft Dependency Injection and Entity Framework Core.

ASP.NET Core Confguration

To start using simply register it within Microsoft Dependency Injection container using following extension method:

services.AddUnitOfWorkForWebApi<IDbContextInteface, DbContext>();

Register action filter:

// ASP.NET Core 
services.AddMvc(options =>
{
    options.Filters.AddUnitOfWorkTransactionAttribute();
});

Then inject IUnitOfWork<IDbContextInteface> into Your service.

Hooks

package allows user to use following hooks:

  • PreSaveChangesHook - executed before DbContext.SaveChanges() is executed.
  • PostSaveChangesHook - executed after DbContext.SaveChanges() is executed.
  • TransactionRollbackHook - executed after IDbContextTransaction.Rollback() is executed.
  • TransactionCommitHook - executed after IDbContextTransaction.Commit() is executed.

Configuration

services.AddUnitOfWorkForWebApi<IDbContextInteface, DbContext>()
    .WithPostSaveChangesHook<PostSaveChangesHook>() // interface IPostSaveChangesHook
    .WithPreSaveChangesHook<PreSaveChangesHook>() // interface IPreSaveChangesHook
    .WithTransactionRollbackHook<TransactionRollbackHook>() // interface ITransactionRollbackHook
    .WithTransactionCommitHook<TransactionCommitHook>(); // interface ITransactionCommitHook

TailoredApps.Shared.EntityFramework.UnitOfWork.Audit

This namespace is extension and it provides the user with ability to audit all changes that occurs within the scope of transaction while using Unit Of Work.

Confguration

To configure Audit you need to provide a list of entities that You would like to monitor as well as entity states. Apart from that you need to implelement an IEntityChangesAuditor intrface.

The IEntityChangesAuditor.AuditChanges(IEnumerable<EntityChange> entityChanges) is being called every time the transaction is commited. The parameter entityChanges will contain all of the entities in approperiate state corresponding with the setting you provided while registering the audit.

NOTE: It is recommended to narrow down those settings as much as possible to increase the performance.

var typesToCollect = new List<Type> { typeof(Entity1), typeof(Entity2), };
var entityStatesToCollect = new List<AuditEntityState> 
{ 
    AuditEntityState.Added, 
    AuditEntityState.Modified,
    AuditEntityState.Deleted  
};

services.AddUnitOfWorkForWebApi<IDbContextInteface, DbContext>()
    .WithUnitOfWorkAudit<DbContext, IEntityChangesAuditor>(settings =>
    {
        settings.TypesToCollect = typesToCollect;
        settings.EntityStatesToCollect = entityStatesToCollect;
    })
Product Compatible and additional computed target framework versions.
.NET 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.  net11.0 is compatible. 
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 TailoredApps.Shared.EntityFramework:

Package Downloads
TailoredApps.Shared.EntityFramework.UnitOfWork.WebApiCore

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.0-preview.2 54 11/12/2026
3.0.0-preview.1 59 11/12/2026
2.1.0 83 11/12/2026
2.0.1 77 11/12/2026
2.0.0 94 11/12/2026
1.6.0 84 11/12/2026
1.4.19 489 10/26/2026
1.4.18 708 10/23/2026
1.4.17 1,043 10/6/2026
1.4.16 127 9/28/2026
1.4.15 134 9/21/2026
1.4.14 152 8/20/2026
1.4.13 151 8/20/2026
1.4.12 161 8/20/2026
1.4.11 155 8/7/2026
1.4.10 265 7/8/2026
1.4.9 175 7/8/2026
1.4.8 178 7/6/2026
1.4.7 178 5/20/2026
1.4.6 170 5/20/2026
Loading failed