Franz.Common.EntityFramework
1.4.4
See the version list below for details.
dotnet add package Franz.Common.EntityFramework --version 1.4.4
NuGet\Install-Package Franz.Common.EntityFramework -Version 1.4.4
<PackageReference Include="Franz.Common.EntityFramework" Version="1.4.4" />
<PackageVersion Include="Franz.Common.EntityFramework" Version="1.4.4" />
<PackageReference Include="Franz.Common.EntityFramework" />
paket add Franz.Common.EntityFramework --version 1.4.4
#r "nuget: Franz.Common.EntityFramework, 1.4.4"
#:package Franz.Common.EntityFramework@1.4.4
#addin nuget:?package=Franz.Common.EntityFramework&version=1.4.4
#tool nuget:?package=Franz.Common.EntityFramework&version=1.4.4
Franz.Common.EntityFramework
A comprehensive library within the Franz Framework, designed to extend and simplify the integration of Entity Framework Core in .NET applications. It provides clean abstractions, auditing, soft deletes, repositories, and seamless integration with Franz Business and Mediator packages.
Features
Database Configurations*
- Flexible options for Cosmos DB (
CosmosDBConfig
) and MongoDB (MongoDBConfig
). - Centralized management of connection settings (
DatabaseOptions
).
- Flexible options for Cosmos DB (
Repositories (Separation of Entity and Aggregate Repositories)
EntityRepository<TEntity>
: CRUD operations for standalone entities.AggregateRepository<TAggregateRoot>
: For event-sourced aggregates.ReadRepository<T>
: Optimized read-only data access.
DbContextBase (π canonical context)
- Built-in auditing (
CreatedBy
,CreatedOn
,LastModifiedBy
,LastModifiedOn
). - Soft deletes (
IsDeleted
,DeletedBy
,DeletedOn
) with global query filters. - Domain event dispatching via Franz Mediator.
- Removes the need for
SaveEntitiesAsync
β now everything happens inSaveChangesAsync
.
- Built-in auditing (
Conversions
EnumerationConverter
: Easily map domain enumerations to EF Core-friendly values.
Extensions
ModelBuilderExtensions
: Simplify entity configuration.ServiceCollectionExtensions
: Wire up repositories and context with DI.
Version Information
- Current Version: 1.4.3
- Part of the private Franz Framework ecosystem.
π DbContextBase Example
public class AppDbContext : DbContextBase
{
public AppDbContext(DbContextOptions<AppDbContext> options, IDispatcher dispatcher, ICurrentUserService currentUser)
: base(options, dispatcher, currentUser)
{
}
public DbSet<Order> Orders => Set<Order>();
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.ApplyConfigurationsFromAssembly(GetType().Assembly);
}
}
Key behaviors
- Automatically sets CreatedBy / CreatedOn when entities are added.
- Automatically sets LastModifiedBy / LastModifiedOn when entities are updated.
- Marks IsDeleted / DeletedOn / DeletedBy instead of physical deletes.
- Dispatches domain events after each save.
Repositories
1οΈβ£ Entity Repository (CRUD Operations)
public class OrderRepository : EntityRepository<AppDbContext, Order>
{
public OrderRepository(AppDbContext dbContext) : base(dbContext) { }
}
β Best for:
- Entities that donβt require aggregate consistency.
- Simple CRUD operations.
2οΈβ£ Aggregate Repository (Event-Sourced Aggregates)
public class ProductRepository : AggregateRepository<AppDbContext, Product, ProductEvent>
{
public ProductRepository(AppDbContext dbContext, IEventStore eventStore)
: base(dbContext, eventStore) { }
}
β Best for:
- Aggregates requiring event sourcing.
- Complex domain rules.
- Systems that replay history for consistency.
3οΈβ£ Choosing the Right Repository
Feature | EntityRepository | AggregateRepository |
---|---|---|
Use Case | Standalone entities | Event-sourced aggregates |
CRUD Support | β Yes | β No (event-only) |
Supports Event Sourcing | β No | β Yes |
Direct Entity Access | β Yes | β No (root only) |
Auditing & Soft Deletes
All entities deriving from Franzβs Entity<TId>
automatically get:
CreatedOn
,CreatedBy
LastModifiedOn
,LastModifiedBy
IsDeleted
,DeletedOn
,DeletedBy
Example Entity
public class Order : Entity<Guid>
{
public string CustomerName { get; private set; } = string.Empty;
public decimal TotalAmount { get; private set; }
// Domain behavior...
}
EF Core automatically filters out IsDeleted
entities via a global query filter.
Installation
From Private Azure Feed
dotnet nuget add source "https://your-private-feed-url" \
--name "AzurePrivateFeed" \
--username "YourAzureUsername" \
--password "YourAzurePassword" \
--store-password-in-clear-text
Install the package:
dotnet add package Franz.Common.EntityFramework
Integration with Franz Framework
- Franz.Common.Business β DDD & CQRS building blocks.
- Franz.Common.Mediator β Pipeline behaviors & domain event dispatching.
- Franz.Common.Errors β Standardized error handling.
Contributing
This package is part of a private framework. Contributions are limited to the internal team.
- Clone the repository: GitHub - Franz.Common
- Create a feature branch.
- Submit a pull request.
License
Licensed under the MIT License.
Changelog
1.4.2
- ποΈ Removed
DbContextMultiDatabase
(useDbContextBase
instead). - ποΈ Removed
SaveEntitiesAsync
(merged intoSaveChangesAsync
). - β
Unified auditing, soft deletes, and domain events under
DbContextBase
.
1.4.1
- Patch bump (package cleanup & docs).
1.4.0
- Migrated to C# 12 typing rules.
- Introduced auditing and soft delete handling in
DbContextBase
. - Aligned
EnumerationConverter
with stricter typing constraints.
1.2.65
- Split repositories into
EntityRepository
andAggregateRepository
. - Upgraded to .NET 9.
1.3
- Upgraded to .NET 9.0.8.
- Added new features and improvements.
- Separated business from mediator concepts.
- Compatible with Franz mediator and MediatR.
Product | Versions 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 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. |
-
net9.0
- Franz.Common.Business (>= 1.4.4)
- Franz.Common.DependencyInjection (>= 1.4.4)
- Franz.Common.Errors (>= 1.4.4)
- Franz.Common.MultiTenancy (>= 1.4.4)
- Franz.Common.Reflection (>= 1.4.4)
- Microsoft.EntityFrameworkCore (>= 9.0.8)
- Microsoft.EntityFrameworkCore.Cosmos (>= 9.0.8)
- Microsoft.EntityFrameworkCore.Relational (>= 9.0.8)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.8)
- Microsoft.Extensions.Hosting.Abstractions (>= 9.0.8)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 9.0.8)
- MongoDB.Driver (>= 3.4.3)
NuGet packages (7)
Showing the top 5 NuGet packages that depend on Franz.Common.EntityFramework:
Package | Downloads |
---|---|
Franz.Common.EntityFramework.MariaDB
Shared utility library for the Franz Framework. |
|
Franz.Common.EntityFramework.PostGres
Shared utility library for the Franz Framework. |
|
Franz.Common.SSO
Shared utility library for the Franz Framework. |
|
Franz.Common.EntityFramework.SQLServer
Shared utility library for the Franz Framework. |
|
Franz.Common.EntityFramework.Oracle
Shared utility library for the Franz Framework. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
1.5.3 | 29 | 9/21/2025 |
1.5.2 | 30 | 9/21/2025 |
1.5.0 | 32 | 9/21/2025 |
1.4.4 | 75 | 9/20/2025 |
1.3.14 | 240 | 9/18/2025 |
1.3.13 | 235 | 9/18/2025 |
1.3.5 | 249 | 9/17/2025 |
1.3.4 | 263 | 9/16/2025 |
1.3.3 | 262 | 9/16/2025 |
1.3.2 | 263 | 9/15/2025 |
1.3.1 | 85 | 9/12/2025 |
1.3.0 | 290 | 8/25/2025 |
1.2.65 | 220 | 3/3/2025 |
1.2.64 | 156 | 1/29/2025 |
1.2.63 | 171 | 1/27/2025 |
1.2.62 | 157 | 1/8/2025 |