Ten.Generic.Repo
1.0.0-preview.1
This is a prerelease version of Ten.Generic.Repo.
dotnet add package Ten.Generic.Repo --version 1.0.0-preview.1
NuGet\Install-Package Ten.Generic.Repo -Version 1.0.0-preview.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Ten.Generic.Repo" Version="1.0.0-preview.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Ten.Generic.Repo" Version="1.0.0-preview.1" />
<PackageReference Include="Ten.Generic.Repo" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Ten.Generic.Repo --version 1.0.0-preview.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Ten.Generic.Repo, 1.0.0-preview.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Ten.Generic.Repo@1.0.0-preview.1
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Ten.Generic.Repo&version=1.0.0-preview.1&prerelease
#tool nuget:?package=Ten.Generic.Repo&version=1.0.0-preview.1&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Ten.Generic.Repo
A lightweight, reusable Generic Repository implementation for Entity Framework Core, designed for clean architecture and testable data access.
Supports async operations, filtering, ordering, eager loading, and works with any EF Core provider.
✨ Features
- Generic repository pattern
- Async CRUD operations
- Expression-based filtering
- Ordering and pagination support
- Optional eager loading via
Include - Provider-agnostic (SQL Server, PostgreSQL, SQLite, etc.)
- Compatible with .NET 8 and .NET 10 (preview)
📦 Installation
dotnet add package Ten.Generic.Repo --prerelease
Base Entity
public abstract class BaseEntity
{
public int Id { get; set; }
}
Example Entity
public class Product : BaseEntity
{
public string Name { get; set; } = string.Empty;
public decimal Price { get; set; }
}
Register Repository
services.AddScoped<IRepository<Product>, Repository<Product>>();
Usage Example
public class ProductService
{
private readonly IRepository<Product> _repository;
public ProductService(IRepository<Product> repository)
{
_repository = repository;
}
public async Task<IEnumerable<Product>> GetProductsAsync()
{
return await _repository.GetAllAsync();
}
public async Task<Product?> GetProductAsync(int id)
{
return await _repository.GetByIdAsync(id);
}
}
Querying with Filters & Includes
var products = await _repository.GetAllAsync(
filter: p => p.Price > 100,
includeProperties: "Category,Supplier",
orderBy: q => q.OrderBy(p => p.Name)
);
Tracking vs No-Tracking
var product = await _repository.GetFirstOrDefaultAsync(
p => p.Id == id,
tracked: false
);
Updating Entities
_repository.Update(entity);
OR
_repository.Update(sourceEntity, updatedEntity);
Deleting Entities
_repository.Remove(entity);
await _repository.RemoveByIdAsync(id);
Notes
includeProperties uses string-based Includes for flexibility
Designed to be EF Core provider-agnostic
Unit of Work pattern can be layered on top if needed
📄 License
This project is licensed under the MIT License.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Microsoft.EntityFrameworkCore.SqlServer (>= 8.0.16)
-
net8.0
- Microsoft.EntityFrameworkCore.SqlServer (>= 8.0.16)
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 |
|---|---|---|
| 1.0.0-preview.1 | 114 | 1/24/2026 |