DKNet.EfCore.Repos.Abstractions
9.0.6
See the version list below for details.
dotnet add package DKNet.EfCore.Repos.Abstractions --version 9.0.6
NuGet\Install-Package DKNet.EfCore.Repos.Abstractions -Version 9.0.6
<PackageReference Include="DKNet.EfCore.Repos.Abstractions" Version="9.0.6" />
<PackageVersion Include="DKNet.EfCore.Repos.Abstractions" Version="9.0.6" />
<PackageReference Include="DKNet.EfCore.Repos.Abstractions" />
paket add DKNet.EfCore.Repos.Abstractions --version 9.0.6
#r "nuget: DKNet.EfCore.Repos.Abstractions, 9.0.6"
#:package DKNet.EfCore.Repos.Abstractions@9.0.6
#addin nuget:?package=DKNet.EfCore.Repos.Abstractions&version=9.0.6
#tool nuget:?package=DKNet.EfCore.Repos.Abstractions&version=9.0.6
DKNet.EfCore.Repos.Abstractions
A library providing abstraction definitions for repository patterns tailored for Entity Framework Core (EF Core). This package includes interfaces and base classes that define the contract for repository implementations, enabling consistent and reusable data access logic across applications.
Overview
This project defines the core abstractions needed to implement repository patterns in EF Core. It allows developers to separate concerns by encapsulating data access logic behind well-defined interfaces, promoting maintainable and scalable codebases.
Features
Generic Repository Interfaces: Declarative contracts for common CRUD operations (Create, Read, Update, Delete).
Customizable Abstractions: Extensible interface definitions that can be adapted to specific domain requirements.
Consistent API Design: Ensures uniformity across repository implementations, making it easier to switch or replace repositories as needed.
Installation
To use DKNet.EfCore.Repos.Abstractions in your project, install the NuGet package:
dotnet add package DKNet.EfCore.Repos.Abstractions --version 1.0.0-alpha
Replace --version 1.0.0-alpha
with the appropriate version number when available.
Basic Usage
Here's an example of how to use the provided abstractions in your EF Core applications:
Defining a Repository Interface
public interface IRepository<T> where T : class
{
Task<T> GetByIdAsync(int id);
Task<List<T>> GetAllAsync();
// Additional methods as needed
}
Implementing the Repository Interface
public class UserRepository : IRepository<User>
{
private readonly YourDbContext _dbContext;
public UserRepository(YourDbContext dbContext)
{
_dbContext = dbContext;
}
public async Task<User> GetByIdAsync(int id)
{
return await _dbContext.Users.FindAsync(id);
}
public async Task<List<User>> GetAllAsync()
{
return await _dbContext.Users.ToListAsync();
}
}
Detailed Features
Generic Repository Interfaces
The provided IRepository<T>
interface defines the core operations necessary for interacting with a typical entity set in EF Core. This includes methods such as:
GetByIdAsync: Retrieves a single entity by its primary key.
GetAllAsync: Retrieves all entities of a specific type.
These interfaces can be extended or specialized to include additional domain-specific methods, ensuring flexibility while maintaining consistency across different repository implementations.
Extensible Design
The abstractions are designed to allow for extension through the use of base classes and multiple interface inheritance. This makes it easy to add custom functionality without violating the Liskov Substitution Principle.
Consistent API Across Implementations
By standardizing on these abstractions, all repositories within your application will expose a familiar set of methods and behaviors. This reduces cognitive overhead for developers and simplifies the process of swapping out or updating repository implementations as needed.
Contributing
Contributions are welcome! If you'd like to contribute to this project:
- Fork the repository on GitHub.
- Create a feature branch for your changes.
- Commit your changes with clear, descriptive messages.
- Push your branch back to GitHub and create a Pull Request.
Please ensure that any new features or changes adhere to the existing coding standards and design principles of the project.
License
This project is licensed under the MIT License.
Acknowledgments
- Thanks to the Entity Framework Core team for providing a robust framework upon which this library is built.
- Special thanks to contributors who have enhanced the abstractions in this library.
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
- DKNet.EfCore.Abstractions (>= 9.0.6)
- Meziantou.Analyzer (>= 2.0.202)
- Microsoft.EntityFrameworkCore (>= 9.0.6)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on DKNet.EfCore.Repos.Abstractions:
Package | Downloads |
---|---|
DKNet.EfCore.Repos
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
9.0.20 | 123 | 7/15/2025 |
9.0.19 | 143 | 7/14/2025 |
9.0.18 | 145 | 7/14/2025 |
9.0.17 | 138 | 7/14/2025 |
9.0.16 | 124 | 7/11/2025 |
9.0.15 | 125 | 7/11/2025 |
9.0.14 | 125 | 7/11/2025 |
9.0.13 | 134 | 7/11/2025 |
9.0.12 | 154 | 7/8/2025 |
9.0.11 | 143 | 7/8/2025 |
9.0.10 | 147 | 7/7/2025 |
9.0.9 | 145 | 7/2/2025 |
9.0.8 | 144 | 7/2/2025 |
9.0.7 | 154 | 7/1/2025 |
9.0.6 | 148 | 6/30/2025 |
9.0.5 | 148 | 6/24/2025 |
9.0.4 | 146 | 6/24/2025 |
9.0.3 | 151 | 6/23/2025 |
9.0.2 | 151 | 6/23/2025 |
9.0.1 | 152 | 6/23/2025 |