Regira.Entities
6.1.2
dotnet add package Regira.Entities --version 6.1.2
NuGet\Install-Package Regira.Entities -Version 6.1.2
<PackageReference Include="Regira.Entities" Version="6.1.2" />
<PackageVersion Include="Regira.Entities" Version="6.1.2" />
<PackageReference Include="Regira.Entities" />
paket add Regira.Entities --version 6.1.2
#r "nuget: Regira.Entities, 6.1.2"
#:package Regira.Entities@6.1.2
#addin nuget:?package=Regira.Entities&version=6.1.2
#tool nuget:?package=Regira.Entities&version=6.1.2
Regira Entities
Regira Entities is a generic, extensible framework for managing data entities in .NET applications. It provides a standardized way to handle CRUD operations, filtering, sorting, and includes, while allowing customization through generic type parameters, interfaces and specialized helper services.
Installation
The core abstractions ship as Regira.Entities. The setup below additionally requires the DI, EF Core, and Web sibling packages:
<PackageReference Include="Regira.Entities" Version="6.*" />
<PackageReference Include="Regira.Entities.DependencyInjection" Version="6.*" />
<PackageReference Include="Regira.Entities.EFcore" Version="6.*" />
<PackageReference Include="Regira.Entities.Web" Version="6.*" />
Core Concepts
Generic Type Parameters
Understanding the generic type system is crucial:
| Type | Required | Purpose | Default (when omitted) | Example |
|---|---|---|---|---|
| TEntity | ✓ | The entity class | - | Product |
| TKey | ○ | Primary key type | int |
Guid, int |
| TSearchObject | ○ | Advanced filtering | SearchObject |
ProductSearchObject |
| TSortBy | ○ | Sorting enum | EntitySortBy |
ProductSortBy |
| TInclude | ○ | Navigation properties enum | EntityIncludes |
ProductIncludes |
| TDto | ○ | Read/display model (details & lists) | TEntity |
ProductDto |
| TInputDto | ○ | Create/update model | TEntity |
ProductInputDto |
Architecture
IEntityServiceis the central contract of this framework. Register an implementation for it — and all CRUD operations, filtering, sorting, and includes are handled through that single interface.EntityRepositoryprovides the default implementation, but any custom class can be used instead.- For APIs, using
EntityControllerBaseis sufficient: it registers theIEntityServiceautomatically, requiring no additional wiring. The controller's generic type arguments must match those used when configuring the entity (see example below).
Main functionality of the service:
| Action | Purpose |
|---|---|
| Details | Get a single item by ID, with all registered Navigation properties included (RefetchAfterSave, globally or via SetReadBehavior(...) per entity, tunes the save endpoints' response re-fetch) |
| List | Get a (filtered, sorted & paged) collection of items, usually with limited or no Navigation properties |
| Save | Create or Update an item, usually Navigation properties are excluded (when updating). However, child collections can be included |
| Remove | Delete an item |
Processing Pipeline
Assuming a Repository with a DbContext is being used.
Read Pipeline:
- EntitySet
- QueryBuilders
- Filters
- Sorting
- Paging
- Includes
- Processors
- Mapping (+AfterMapping)*
Write Pipeline:
- Input
- Mapping (+AfterMapping)*
- Preppers (Repository)
- SaveChanges (DbContext)
- Primers (Interceptors)
- Submit changes
*: only executed when using API controllers
Pipeline Details:
- QueryBuilders: Build IQueryable based on SearchObject, SortBy & Includes
- Processors: Modify entities after fetching (e.g. setting non-mapped properties)
- Preppers: Executed by the Repository before saving to prepare entities
- Primers: EF Core SaveChangesInterceptors triggered by DbContext when executing SaveChanges
- AfterMapper: Decorates DTOs or Entities after Mapper completes (e.g. calculating URIs)
Dependency Injection
basic sample setup which whill register a IEntityService for Category, Product and Order entities, using the default EntityRepository implementation.
builder.Services
.UseRegira(LICENSE) // free tier and trial available
.UseEntities<MyDbContext>(options => options.UseDefaults())
.For<Category>()
.For<Product, int, ProductSearchObject>(item => {
// inline configuration
item.SortBy(query => query.OrderBy(x => x.Title));
item.Includes((query, _) => query.Include(x => x.Category));
item.Filter((query, so) =>
{
if (so?.CategoryId?.Any() == true)
query = query.Where(x => so.CategoryId.Contains(x.CategoryId));
return query;
});
})
.For<Order, int, OrderSearchObject, OrderSortBy, OrderIncludes>(item => {
// external classes for configuration
item.AddSortBy<OrderSortedBuilder>();
item.AddIncludes<OrderIncludableBuilder>();
item.AddFilter<OrderQueryFilter>();
// OrderRepository will handle OrderItems
item.Related(c => c.OrderItems);
});
// controllers
[ApiController, Route("categories")]
public class CategoryController : EntityControllerBase<Category>;
[ApiController, Route("products")]
public class ProductController : EntityControllerBase<Product, int, ProductSearchObject, ProductDto, ProductInputDto>;
[ApiController, Route("orders")]
public class OrderController : EntityControllerBase<Order, int, OrderSearchObject, OrderSortBy, OrderIncludes, OrderDto, OrderInputDto>;
Free tier available: this package (
Regira.Entities) is Apache-2.0 — the abstractions are free to reference anywhere. The implementation packages (Regira.Entities.EFcore,Regira.Entities.DependencyInjection,Regira.Entities.Web, the mapping packages) carry the Regira Commercial License; the registration packageRegira.Entities.DependencyInjectionvalidates keys, with a free tier of 5 simple + 2 complex entity registrations per application, and a license key is required beyond that. Register the key withservices.UseRegira(configuration)(readsRegira:LicenseKeys) before callingUseEntities(). Without a key the free tier applies automatically. Obtain a key at https://regira.com/licensing.
Paging defaults: set
options.DefaultPageSize/options.MaxPageSizein theUseEntities()callback (or per entity withe.SetPageSize(...)) so List/Search endpoints page automatically instead of returning the full set. See Web Endpoints → Paging.
AI-assisted setup: connect the hosted Regira MCP server (
https://mcp.regira.com/mcp) and your coding agent can search these docs, fetch examples, and scaffold entities end-to-end — see the setup guide.
Overview
- Index — Overview of Regira Entities
- Entity Models — Creating and structuring entity models
- Services — Implementing entity services and repositories
- Mapping — Mapping Entities to and from DTOs
- Web Endpoints — Exposing entity operations as HTTP endpoints
- Normalizing — Data normalization techniques
- Attachments — Managing file attachments
- Built-in Features — Ready to use components
- Checklist — Step-by-step guide for common tasks
- Practical Examples — Complete implementation examples
License
Apache License 2.0 — this package contains no license validation and no runtime limits. See LICENSE. A few companion packages are commercially licensed with a free tier; see the licensing overview.
| 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. |
-
net10.0
- Regira.Common (>= 6.1.2)
- Regira.IO.Storage (>= 6.1.2)
-
net8.0
- Regira.Common (>= 6.1.2)
- Regira.IO.Storage (>= 6.1.2)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Regira.Entities:
| Package | Downloads |
|---|---|
|
Regira.Entities.EFcore
Entity Framework Core integration for the Regira entity framework. Free tier included — a license key removes the free-tier limits. |
GitHub repositories
This package is not used by any popular GitHub repositories.