Despro.Framework.Base
2.1.7
dotnet add package Despro.Framework.Base --version 2.1.7
NuGet\Install-Package Despro.Framework.Base -Version 2.1.7
<PackageReference Include="Despro.Framework.Base" Version="2.1.7" />
<PackageVersion Include="Despro.Framework.Base" Version="2.1.7" />
<PackageReference Include="Despro.Framework.Base" />
paket add Despro.Framework.Base --version 2.1.7
#r "nuget: Despro.Framework.Base, 2.1.7"
#:package Despro.Framework.Base@2.1.7
#addin nuget:?package=Despro.Framework.Base&version=2.1.7
#tool nuget:?package=Despro.Framework.Base&version=2.1.7
Despro.Framework.Base
The core abstractions layer of Despro Framework.
Despro.Framework.Base is the innermost package of the framework's Clean Architecture. It
holds the contracts, base models and cross-cutting utilities that every other layer
depends on and defines no concrete infrastructure of its own — the higher layers
(Infrastructure, Presentation, WebClient, …) implement the interfaces declared here.
- Package:
Despro.Framework.Base - Version:
2.1.0 - Target framework:
net10.0
┌──────────────────────────── everything depends on Base ────────────────────────────┐
Base ◄── Domain Application Infrastructure Presentation WebClient
Installation
dotnet add package Despro.Framework.Base
Base is pulled in transitively by every other Despro package, so you rarely install it directly unless you are authoring shared contracts/DTOs.
Dependencies
| Package | Version | Purpose |
|---|---|---|
| MediatR | 14.0.0 | INotification base for domain events |
| FluentValidation | 12.1.1 | Base validators (FileValidator) |
| FluentValidation.DependencyInjectionExtensions | 12.1.1 | Validator registration helpers |
| Mapster | 7.4.0 | DTO projection support |
| Microsoft.EntityFrameworkCore | 10.0.2 | IQueryable filtering / include helpers (PrivateAssets) |
| Newtonsoft.Json | 13.0.4 | BaseGrid (de)serialization |
What's inside
Repository & Unit of Work contracts (IBaseServices)
The persistence abstractions implemented by Despro.Framework.Infrastructure.
| Contract | Responsibility |
|---|---|
IBaseReadRepository<TEntity> |
Read side: GetByIdAsync, GetAllAsync, AnyAsync, CountAsync, Table(), paging via GetFilterPaging / GetFilterPagingDtoAsync<TDto>. |
IBasePublisherRepository<TEntity> |
Write side: AddAsync, UpdateAsync, UpdatePartialAsync, soft RemoveAsync, HardDeleteAsync. |
IBaseRepository<TEntity> |
Composition of the read + write repositories. |
IDapperRepository<TEntity> |
Raw/high-performance access: paged reads, FindAsync, raw SQL, stored procedures (incl. output params). |
IUnitOfWork |
Transaction boundary: SaveChangesAsync, Begin/Commit/RollbackTransaction, ExecuteTransactionAsync(...), Detach. |
IAuthService |
Current-user/role identity resolved from JWT claims (GetUserId, GetRoleId, GetRolesGuid, CheckRoleValidation, …). |
IErrorLogger |
LogError(Exception, object?) plus error-file path resolution. |
All repository contracts are constrained to where TEntity : BaseEntity.
Base models (BaseModels)
| Type | Description |
|---|---|
BaseEntity |
Root entity with an identity plus soft-delete/audit fields (IsDelete, CreateDate, CreateUserId, UpdateDate, …). Mutations go through explicit SetCreate / SetUpdate / SetDelete methods — setters are private. |
AggregateRoot |
BaseEntity that collects BaseDomainEvents (AddDomainEvent / RemoveDomainEvent) for later dispatch. |
BaseDomainEvent |
MediatR INotification carrying audit metadata. |
BaseDto |
Marker base type for DTOs (used by the grid query abstractions). |
OperationResult / OperationResult<T> |
Standardized command result with a factory API (Success, Error, NotFound, NoContent, UnAuthorize, Forbidden) and an OperationResultStatus code. |
OperationQueryResult / OperationQueryResult<T> |
Query-side equivalents of the above. |
SystemError |
Persisted error record (user, roles, message, file, …). |
MongoDbConfig |
Connection-string / database-name options for MongoDB logging. |
ApiResultHttp / ApiResultHttp<T> |
HTTP envelope consumed by Despro.Framework.WebClient. |
Grid, filtering & paging (BaseModels/GridData)
BaseGrid— pagination + ordering +FilterParamlist; can hydrate itself from a JSON string (Set(string)) with sensible defaults.GridData<TData>— a materialized page (Data,EntityCount,PageCount).FilterService—IQueryable<T>extensions (FilterList,PagingList,FilterPagingList) that translateBaseGridfilters into EF Core expression trees, including nested property paths, collectionAny(...), case-insensitiveLIKE, enum, numeric, decimal, bool and date comparisons.
var page = dbSet.AsQueryable()
.FilterPagingList(baseGrid) // apply filters + ordering + skip/take
.ProjectToType<ProductDto>();
Exceptions (BaseExceptions)
An abstract exception hierarchy that the higher layers extend and the presentation
middleware maps to HTTP status codes:
BaseException, BaseForbiddenException, BaseInvalidDataException, BaseNotFoundException.
Extensions & helpers (BaseExtensions)
IncludeExtensions—IncludeFiltered/ThenIncludeFilteredthat transparently filter out soft-deleted (IsDelete) navigations.PersianConvertorDate— Gregorian ⇄ Shamsi (Jalali) conversion (ToShamsi,ToShamsiWithTime,ShamsiToMiladi).StringExtensions— Persian/Arabic digit & character normalization.DateTimeExtension(IsBetween),MoneyHelper(Tooman formatting).
Validators (Validator)
FileValidator— a configurableAbstractValidator<IFormFile>(max size, allowed extensions, required/optional) with localized failure messages.
Constants
Constants.HttpClientName (named HttpClient) and Constants.RoleIdKey.
Usage
public class Product : AggregateRoot // gets Id, audit fields, domain events
{
public string Name { get; private set; } = string.Empty;
public decimal Price { get; private set; }
}
public class ProductDto : BaseDto // eligible for grid queries
{
public long Id { get; set; }
public string Name { get; set; } = string.Empty;
}
// Command handlers return standardized results:
return OperationResult<ProductDto>.Success(dto);
return OperationResult.NotFound();
Project structure
Despro.Framework.Base
├── BaseExceptions/ # abstract exception hierarchy
├── BaseExtensions/ # IQueryable includes, Persian date, string/date/money helpers
├── BaseModels/ # BaseEntity, AggregateRoot, OperationResult, DTOs
│ ├── DbModels/ # MongoDbConfig
│ ├── GridData/ # BaseGrid, GridData<>, FilterService
│ └── HttpModels/ # ApiResultHttp envelope
├── IBaseServices/ # repository / UoW / auth / logger contracts
│ └── IDbServices/ # IDapperRepository
├── Validator/ # FileValidator
└── Constants.cs
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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
- FluentValidation (>= 12.1.1)
- FluentValidation.DependencyInjectionExtensions (>= 12.1.1)
- Mapster (>= 10.0.10)
- MediatR (>= 14.2.0)
- Newtonsoft.Json (>= 13.0.4)
NuGet packages (5)
Showing the top 5 NuGet packages that depend on Despro.Framework.Base:
| Package | Downloads |
|---|---|
|
Despro.Framework.Infrastructure
Infrastructure Framework For Despro |
|
|
Despro.Framework.Domain
Domain Framework For Despro |
|
|
Despro.Framework.Presentation
Presentation Framework For Despro |
|
|
Despro.Framework.WebClient
WebClient Framework For Despro |
|
|
Despro.Framework.Application
Application Framework For Despro |
GitHub repositories
This package is not used by any popular GitHub repositories.