Resrcify.SharedKernel.Repository
4.0.0
dotnet add package Resrcify.SharedKernel.Repository --version 4.0.0
NuGet\Install-Package Resrcify.SharedKernel.Repository -Version 4.0.0
<PackageReference Include="Resrcify.SharedKernel.Repository" Version="4.0.0" />
<PackageVersion Include="Resrcify.SharedKernel.Repository" Version="4.0.0" />
<PackageReference Include="Resrcify.SharedKernel.Repository" />
paket add Resrcify.SharedKernel.Repository --version 4.0.0
#r "nuget: Resrcify.SharedKernel.Repository, 4.0.0"
#:package Resrcify.SharedKernel.Repository@4.0.0
#addin nuget:?package=Resrcify.SharedKernel.Repository&version=4.0.0
#tool nuget:?package=Resrcify.SharedKernel.Repository&version=4.0.0
Resrcify.SharedKernel.Repository
Resrcify.SharedKernel.Repository provides repository primitives and specification-based query support for aggregate roots.
Table of Contents
What you get
- Repository abstractions in
Resrcify.SharedKernel.Abstractions.Repository. - Base repository primitives in
Primitives/. - Specification pattern support through:
Specification<TEntity, TId>SpecificationEvaluator
Prerequisites
- .NET 10 SDK.
- Entity Framework Core in your consuming project.
Install
Option A: Project reference
<ProjectReference Include="..\path\to\Resrcify.SharedKernel.Repository.csproj" />
Option B: NuGet package
<PackageReference Include="Resrcify.SharedKernel.Repository" Version="<latest>" />
CLI:
dotnet add package Resrcify.SharedKernel.Repository
Quick Start
Register your concrete repository type in DI:
services.AddScoped<ICompanyRepository, CompanyRepository>();
Usage guide
Repository contract
IRepository<TEntity, TId> has what every repository needs: GetByIdAsync and FirstOrDefaultAsync (returning
the aggregate, or null), GetAllAsync, FindAsync, ExistsAsync, AddAsync, Remove. A per-aggregate
interface derives from it and adds only the queries its handlers need:
using Resrcify.SharedKernel.Abstractions.Repository;
public interface ICompanyRepository
: IRepository<Company, CompanyId>
{
Task<Company?> GetCompanyWithContactsAsync(
CompanyId companyId,
CancellationToken cancellationToken = default);
}
Repository implementation
internal sealed class CompanyRepository(
AppDbContext context)
: Repository<AppDbContext, Company, CompanyId>(context), ICompanyRepository
{
public Task<Company?> GetCompanyWithContactsAsync(
CompanyId companyId,
CancellationToken cancellationToken = default)
=> Context.Companies
.Include(x => x.Contacts)
.FirstOrDefaultAsync(x => x.Id == companyId, cancellationToken);
}
Not found is the handler's decision
A fetch returns null when there is nothing; whether that is an error depends on the use case (a 404 for "get",
the normal path for "create if missing"). The handler turns it into its own error:
var company = await companies
.GetCompanyWithContactsAsync(command.CompanyId, cancellationToken)
.ToResultAsync(() => DomainErrors.Company.NotFound(command.CompanyId.Value));
if (company.IsFailure)
return company;
ToResultAsync(error) takes the error itself; ToResultAsync(() => error) makes it only when nothing was found,
which saves formatting its message on every successful fetch. ToResult does the same for a value you already
have.
Specification usage
var specification = new ActiveCompaniesSpecification();
IEnumerable<Company> companies = await repository.FindAsync(
specification,
cancellationToken);
Common issues
- If includes/order clauses are ignored, verify they are defined on the specification and passed through evaluator.
- If generic constraints fail, ensure entity types implement the expected aggregate-root contracts.
- If queries are slow, evaluate specification complexity and EF tracking settings.
Sample project
See samples/Resrcify.SharedKernel.WebApiExample for repository and specification usage in an application flow.
| 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. |
-
net10.0
- Resrcify.SharedKernel.Abstractions (>= 4.0.0)
- Resrcify.SharedKernel.DomainDrivenDesign (>= 4.0.0)
- Resrcify.SharedKernel.Results (>= 4.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Resrcify.SharedKernel.Repository:
| Package | Downloads |
|---|---|
|
Resrcify.SharedKernel.PerformanceTests
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.0 | 21 | 10/13/2026 |
| 3.0.0 | 135 | 10/3/2026 |
| 2.2.0 | 133 | 9/13/2026 |
| 2.1.1 | 1,323 | 6/8/2026 |
| 2.1.0 | 136 | 5/24/2026 |
| 2.0.0 | 136 | 5/22/2026 |
| 1.16.3 | 200 | 5/7/2026 |
| 1.16.2 | 129 | 5/7/2026 |
| 1.16.1 | 117 | 5/7/2026 |
| 1.16.0 | 128 | 5/7/2026 |
| 1.15.0 | 202 | 4/18/2026 |
| 1.14.0 | 289 | 10/15/2025 |
| 1.13.0 | 338 | 6/27/2025 |
| 1.12.0 | 371 | 4/16/2025 |
| 1.11.0 | 290 | 4/15/2025 |
| 1.10.8 | 236 | 4/11/2025 |
| 1.10.7 | 254 | 4/9/2025 |
| 1.10.3 | 274 | 4/6/2025 |
| 1.10.2 | 244 | 4/6/2025 |
| 1.10.1 | 359 | 3/23/2025 |