This package defines the interfaces, contracts, and domain exceptions that all RepositoryKit providers depend on.
It contains no external dependencies.
| Interface | Purpose |
|---|---|
IReadOnlyRepository<T> |
Abstraction for read-only queries |
IRepository<T> |
Generic CRUD operations for an entity |
IUnitOfWork<TContext> |
Transaction boundary for one context (DbContext) |
IUnitOfWorkManager |
Multi-context Unit of Work provider |
| Exception | Purpose |
|---|---|
RepositoryException |
Standard error with context (type, op, entity) |
- Provides rich error information with type, entity, operation, and inner exception.
- Used by all RepositoryKit providers for consistent exception handling.
You don't use RepositoryKit.Core directly, but instead reference it from your repository implementation or consume its abstractions:
public class EfRepository<TEntity, TContext> : IRepository<TEntity>
where TEntity : class
where TContext : DbContext
{
// Implementation using RepositoryKit.Core interfaces
}
// Exception usage in a provider implementation:
throw new RepositoryException(
"A database error occurred while adding an entity.",
RepositoryErrorType.Add,
typeof(Product),
nameof(AddAsync),
ex
);var mock = new Mock<IRepository<Product>>();
mock.Setup(repo => repo.GetAllAsync()).ReturnsAsync(productsList);- Microsoft.EntityFrameworkCore (for
DbContext-based contracts) - No other dependencies
- Designed to be stable, lightweight, and fully mockable
MIT © Ataberk Kaya
📎 This package is automatically referenced by all RepositoryKit.* implementations
