Extenso.Data.Entity
9.3.1
See the version list below for details.
dotnet add package Extenso.Data.Entity --version 9.3.1
NuGet\Install-Package Extenso.Data.Entity -Version 9.3.1
<PackageReference Include="Extenso.Data.Entity" Version="9.3.1" />
<PackageVersion Include="Extenso.Data.Entity" Version="9.3.1" />
<PackageReference Include="Extenso.Data.Entity" />
paket add Extenso.Data.Entity --version 9.3.1
#r "nuget: Extenso.Data.Entity, 9.3.1"
#:package Extenso.Data.Entity@9.3.1
#addin nuget:?package=Extenso.Data.Entity&version=9.3.1
#tool nuget:?package=Extenso.Data.Entity&version=9.3.1
<img src="https://github.com/gordon-matt/Extenso/blob/master/_Misc/ExtensoLogo.png" alt="Logo" width="250" />
Extenso.Data.Entity
Intro
This package contains a generic IRepository<TEntity> and IMappedRepository<TModel, TEntity> implementations for Entity Framework,
as well as other data-related extension methods and helper classes.
Getting Started
The first thing you're going to need to do is have an IDbContextFactory implementation. Example:
public class ApplicationDbContextFactory : IDbContextFactory
{
private readonly IConfiguration configuration;
public ApplicationDbContextFactory(IConfiguration configuration)
{
this.configuration = configuration;
}
private DbContextOptions<ApplicationDbContext> options;
private DbContextOptions<ApplicationDbContext> Options
{
get
{
if (options == null)
{
var optionsBuilder = new DbContextOptionsBuilder<ApplicationDbContext>();
optionsBuilder.UseSqlServer(configuration.GetConnectionString("DefaultConnection"));
options = optionsBuilder.Options;
}
return options;
}
}
public DbContext GetContext() => new ApplicationDbContext(Options);
public DbContext GetContext(string connectionString)
{
var optionsBuilder = new DbContextOptionsBuilder<ApplicationDbContext>();
optionsBuilder.UseInMemoryDatabase(connectionString);
return new ApplicationDbContext(optionsBuilder.Options);
}
}
Next, you can register the EntityFrameworkRepository in your dependency injection container. An example:
// Regular direct to entity repository:
services.AddScoped(typeof(IRepository<>), typeof(EntityFrameworkRepository<>));
// Mapped repository, which maps between entities and models:
services.AddScoped(typeof(IMappedRepository<,>), typeof(ExtensoMapperEntityFrameworkRepository<,>));
// Or using the Extenso.Data.Entity.AutoMapper package, you could do this:
services.AddScoped(typeof(IMappedRepository<,>), typeof(AutoMapperEntityFrameworkRepository<,>));
Now just inject the repository into your classes and use it:
public class BlogService
{
private readonly IRepository<BlogCategory> blogCategoryService;
private readonly IRepository<BlogPost> blogPostService;
private readonly IRepository<BlogTag> blogTagService;
public BlogCategoryService(
IRepository<BlogCategory> blogCategoryService,
IRepository<BlogPost> blogPostService,
IRepository<BlogTag> blogTagService)
{
this.blogCategoryService = blogCategoryService;
this.blogPostService = blogPostService;
this.blogTagService = blogTagService;
}
public async Task<IEnumerable<BlogCategory>> GetCategoriesAsync(int tenantId) =>
await blogCategoryService.FindAsync(new SearchOptions<BlogCategory>
{
Query = x =>
x.TenantId == tenantId,
Include = query => query
.Include(x => x.Posts)
.ThenInclude(x => x.Tags),
OrderBy = query => query.OrderBy(x => x.Name),
SplitQuery = true, // Optional, defaults to false
});
// etc...
}
All CRUD operations are supported, including paging, searching, and sorting.
Even projections are supported via method overloads of Find(), FindAsync(), FindOne(), and FindOneAsync().
| 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
- Extenso.Data (>= 9.3.0)
- Extenso.Data.Entity.Abstractions (>= 9.3.1)
- Extenso.Mapping (>= 9.3.1)
- Microsoft.EntityFrameworkCore (>= 9.0.5)
- Microsoft.EntityFrameworkCore.SqlServer (>= 9.0.5)
- Z.EntityFramework.Plus.EFCore (>= 9.103.8.1)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Extenso.Data.Entity:
| Package | Downloads |
|---|---|
|
Extenso.AspNetCore.OData
Package Description |
|
|
Extenso.Data.Entity.AutoMapper
Package Description |
|
|
MantleFramework.Data.Abstractions
Mantle - Data - Abstractions |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 10.0.1 | 722 | 11/20/2025 |
| 10.0.0 | 323 | 11/13/2025 |
| 9.5.0 | 332 | 11/13/2025 |
| 9.4.0 | 287 | 6/16/2025 |
| 9.3.2 | 314 | 6/9/2025 |
| 9.3.1 | 260 | 6/2/2025 |
| 9.3.0 | 221 | 5/25/2025 |
| 9.2.0 | 193 | 5/3/2025 |
| 9.1.0 | 549 | 3/23/2025 |
| 9.0.0 | 259 | 1/4/2025 |
| 8.0.0 | 241 | 5/15/2024 |
| 7.0.0 | 1,284 | 11/27/2022 |
| 6.1.0 | 596 | 11/18/2022 |
| 6.0.2 | 2,370 | 5/21/2022 |
| 6.0.1 | 1,175 | 2/21/2022 |
| 6.0.0 | 992 | 1/14/2022 |
| 5.0.0 | 988 | 12/6/2020 |
| 3.1.0 | 13,472 | 6/15/2020 |
| 2.0.1 | 966 | 3/22/2020 |
| 2.0.0 | 1,139 | 2/24/2020 |