TailoredApps.Shared.EntityFramework
2.1.0
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
<PackageReference Include="TailoredApps.Shared.EntityFramework" Version="2.1.0" />
<PackageVersion Include="TailoredApps.Shared.EntityFramework" Version="2.1.0" />
<PackageReference Include="TailoredApps.Shared.EntityFramework" />
paket add TailoredApps.Shared.EntityFramework --version 2.1.0
#r "nuget: TailoredApps.Shared.EntityFramework, 2.1.0"
#:package TailoredApps.Shared.EntityFramework@2.1.0
#addin nuget:?package=TailoredApps.Shared.EntityFramework&version=2.1.0
#tool nuget:?package=TailoredApps.Shared.EntityFramework&version=2.1.0
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 beforeDbContext.SaveChanges()is executed.PostSaveChangesHook- executed afterDbContext.SaveChanges()is executed.TransactionRollbackHook- executed afterIDbContextTransaction.Rollback()is executed.TransactionCommitHook- executed afterIDbContextTransaction.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 | Versions 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. |
-
net10.0
- Microsoft.EntityFrameworkCore (>= 10.0.15)
- Microsoft.EntityFrameworkCore.Relational (>= 10.0.15)
- System.Linq.Dynamic.Core (>= 1.7.4)
- TailoredApps.Shared.Querying (>= 2.1.0)
-
net11.0
- Microsoft.EntityFrameworkCore (>= 11.0.0)
- Microsoft.EntityFrameworkCore.Relational (>= 11.0.0)
- System.Linq.Dynamic.Core (>= 1.7.4)
- TailoredApps.Shared.Querying (>= 2.1.0)
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 |