MinimalCleanArch.DataAccess
0.1.18-preview
dotnet add package MinimalCleanArch.DataAccess --version 0.1.18-preview
NuGet\Install-Package MinimalCleanArch.DataAccess -Version 0.1.18-preview
<PackageReference Include="MinimalCleanArch.DataAccess" Version="0.1.18-preview" />
<PackageVersion Include="MinimalCleanArch.DataAccess" Version="0.1.18-preview" />
<PackageReference Include="MinimalCleanArch.DataAccess" />
paket add MinimalCleanArch.DataAccess --version 0.1.18-preview
#r "nuget: MinimalCleanArch.DataAccess, 0.1.18-preview"
#:package MinimalCleanArch.DataAccess@0.1.18-preview
#addin nuget:?package=MinimalCleanArch.DataAccess&version=0.1.18-preview&prerelease
#tool nuget:?package=MinimalCleanArch.DataAccess&version=0.1.18-preview&prerelease
MinimalCleanArch.DataAccess
Entity Framework Core implementation for MinimalCleanArch (repositories, unit of work, specifications, DbContext helpers).
Version
- Current preview: 0.1.18-preview (net9.0, net10.0). Latest stable: 0.1.17.
Why Use It
- implement repository and unit-of-work patterns with EF Core instead of hand-rolling the infrastructure layer
- use audited and soft-delete-aware base DbContexts that line up with the MCA domain abstractions
- execute MCA specifications against EF Core without leaking query logic into handlers or controllers
When to Use It
- use it when your application persists MCA domain models through EF Core and you want MCA repository/specification support on top
- keep it in the infrastructure project where DbContext, migrations, and repository implementations live
- skip it if you are using another persistence technology or you want to implement repository abstractions yourself
Dependency Direction
- Depends on:
MinimalCleanArch - Typically referenced by: infrastructure projects
- Used by: API/host projects indirectly through your infrastructure project
- Do not reference from: pure domain projects; application projects should normally depend on repository abstractions, not on this package
What's included
DbContextBaseandIdentityDbContextBasewith auditing/soft-delete support.Repository<TEntity,TKey>andUnitOfWorkimplementations.SpecificationEvaluatorto translate specifications (including composedAnd/Or/Not) to EF Core queries and honorIsCountOnly,AsSplitQuery, andIgnoreQueryFilters.- DI extensions to register repositories/unit of work.
- Common repository query methods such as
AnyAsync,SingleOrDefaultAsync, andCountAsync(ISpecification<T>). - optional execution-context-aware base constructors for user and tenant-aware stamping
Usage
builder.Services.AddDbContext<AppDbContext>(opt => opt.UseSqlite("Data Source=app.db"));
builder.Services.AddScoped<DbContext>(sp => sp.GetRequiredService<AppDbContext>());
builder.Services.AddScoped<IUnitOfWork, UnitOfWork>();
builder.Services.AddScoped(typeof(IRepository<,>), typeof(Repository<,>));
If you need a custom unit of work and access to IServiceProvider while configuring the DbContext:
builder.Services.AddMinimalCleanArch<AppDbContext, AppDbContext>((sp, options) =>
{
options.UseSqlite("Data Source=app.db");
});
Recommended DbContext base usage:
public sealed class AppDbContext : DbContextBase
{
public AppDbContext(
DbContextOptions<AppDbContext> options,
IExecutionContext? executionContext = null)
: base(options, executionContext)
{
}
}
Use the constructor overload that accepts IExecutionContext when you want audit stamping to flow from the current HTTP request or message-handler scope without overriding GetCurrentUserId().
Recommended specification usage
public sealed class IncompleteHighPrioritySpec : BaseSpecification<Todo>
{
public IncompleteHighPrioritySpec()
{
AddCriteria(t => !t.IsCompleted && t.Priority >= 3);
ApplyOrderByDescending(t => t.Priority);
UseNoTracking();
}
}
// Compose and run
var dueToday = new DueTodaySpec();
var spec = new IncompleteHighPrioritySpec().And(dueToday);
var todos = await repository.GetAsync(spec, cancellationToken);
var hasAny = await repository.AnyAsync(spec, cancellationToken);
var total = await repository.CountAsync(spec, cancellationToken);
public sealed class DueTodaySpec : BaseSpecification<Todo>
{
public DueTodaySpec() : base(t => t.DueDate != null && t.DueDate.Value.Date == DateTime.UtcNow.Date)
{
}
}
Use specifications through IRepository<TEntity, TKey> in application code. Treat SpecificationEvaluator as infrastructure-level plumbing for repository implementations and advanced EF integration points.
When using a locally built package, add a nuget.config pointing to your local feed (e.g., artifacts/nuget) before restoring.
| 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 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. |
-
net10.0
- Microsoft.AspNetCore.Identity.EntityFrameworkCore (>= 10.0.3)
- Microsoft.EntityFrameworkCore (>= 10.0.3)
- MinimalCleanArch (>= 0.1.18-preview)
-
net9.0
- Microsoft.AspNetCore.Identity.EntityFrameworkCore (>= 9.0.5)
- Microsoft.EntityFrameworkCore (>= 9.0.5)
- MinimalCleanArch (>= 0.1.18-preview)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.18-preview | 0 | 3/12/2026 |
| 0.1.17 | 41 | 3/12/2026 |
| 0.1.17-preview | 82 | 3/8/2026 |
| 0.1.16-preview | 73 | 3/7/2026 |
| 0.1.15-preview | 80 | 3/3/2026 |
| 0.1.14 | 92 | 3/2/2026 |
| 0.1.14-preview | 83 | 3/1/2026 |
| 0.1.13-preview | 87 | 2/28/2026 |
| 0.1.12-preview | 100 | 2/22/2026 |
| 0.1.11-preview | 98 | 12/27/2025 |
| 0.1.10-preview | 94 | 12/27/2025 |
| 0.1.9-preview | 124 | 12/21/2025 |
| 0.1.8-preview | 225 | 12/15/2025 |
| 0.1.7 | 163 | 12/14/2025 |
| 0.1.7-preview | 418 | 12/11/2025 |
| 0.1.6 | 438 | 12/9/2025 |
| 0.1.6-preview | 536 | 12/9/2025 |
| 0.1.5 | 223 | 12/6/2025 |
| 0.1.4 | 199 | 5/26/2025 |
| 0.1.3 | 189 | 5/25/2025 |