CleanArchAcceleratorTools.Domain
1.0.1
dotnet add package CleanArchAcceleratorTools.Domain --version 1.0.1
NuGet\Install-Package CleanArchAcceleratorTools.Domain -Version 1.0.1
<PackageReference Include="CleanArchAcceleratorTools.Domain" Version="1.0.1" />
<PackageVersion Include="CleanArchAcceleratorTools.Domain" Version="1.0.1" />
<PackageReference Include="CleanArchAcceleratorTools.Domain" />
paket add CleanArchAcceleratorTools.Domain --version 1.0.1
#r "nuget: CleanArchAcceleratorTools.Domain, 1.0.1"
#:package CleanArchAcceleratorTools.Domain@1.0.1
#addin nuget:?package=CleanArchAcceleratorTools.Domain&version=1.0.1
#tool nuget:?package=CleanArchAcceleratorTools.Domain&version=1.0.1
CleanArchAcceleratorTools.Domain
This module is part of CleanArchAcceleratorTools, a toolkit to accelerate building applications with Clean Architecture. The Domain module contains the core model and business rules. It is persistence and framework agnostic: focus on Entities, Aggregates, Domain Services, Validations, and domain messages.
Related modules:
- CleanArchAcceleratorTools.Controller
- CleanArchAcceleratorTools.Application
- CleanArchAcceleratorTools.Infrastructure
- CleanArchAcceleratorTools.AllInOne
📄 License: MIT
🧠 Principles
🔗 Role in the architecture
- Controller: Exposes endpoints, it does not contain business rules.
- Application: Orchestrates use cases and references the Domain and repository.
- Domain: Pure domain with business rules and validations.
- Infrastructure: Implements persistence/mapping for Domain entities.
- Mediator: Handles commands, queries, and notifications.
✨ Features
Repositories methods through repository dependency injection
- Dynamic Selects – Project typed objects based on property names.
- Dynamic Filtering – Filter queries with a fluent builder using clauses and operators.
- Dynamic Sort – Sort queries with multiple fields and directions.
- Pagination Utilities – Helpers for
IQueryableincluding filtering and ordering. - Repositories Methods Use all repositories methods without any extra code.
- Extensible & Lightweight – Modular, discoverable, and easy to integrate.
Mediator pattern for domain events and notifications.
- Domain Events – Define and dispatch events for domain changes.
- Domain Notifications – Publish notifications for domain events.
Exceptions
- DomainException – Custom exceptions for domain errors.
QuickSearch
- Mark properties for quick search functionality. It searches all the entities properties marked with
[QuickSearch]recursively, restricted to one-to-one relationships.
Models
- DynamicFilter – Class for building dynamic filters for queries.
- DynamicSort – Class for building dynamic sort orders for queries.
- Entity base Class for domain entities with common properties.
- PaginationResult – Class for paginated query results.
- ParallelParams – Support for parallel query execution.
- QueryFilter – Class for encapsulating query filter parameters used in pagination.
🧩 Compatibility
Multi-target:
- .NET 6
- .NET 7
- .NET 8
- .NET 9
Use an EF Core version compatible with your target framework.
✅ Prerequisites
- FluentValidation 11.x (see version in the
.csproj)
🚀 Installation
dotnet add package CleanArchAcceleratorTools.Domain --version 1.0.0
⚡ Quickstart
- If you have separated Infrastructure and Application projects add this module reference on it. Add allInOne if using a single project.
- Model your Entities inheriting from
Entity. - Add validations with FluentValidation (use
.resxfiles for messages to standardize). - Create your services inheriting from
IGenericDomainService<TEntity>andGenericDomainService<TEntity>. - Use all available repository methods without extra code.
- Create your custom methods if needed.
- Enjoy all features provided!
🛠️ Usage Examples
Creating a Domain Entity
public class Course : Entity
{
public long? InstructorId { get; set; }
public string? Title { get; set; }
public Instructor? Instructor { get; set; }
public ICollection<Module>? Modules { get; set; }
public Course()
{
}
}
Creating a Domain Service
public interface ICourseDomainService : IGenericDomainService<Course> { }
public class CourseDomainService : GenericDomainService<Course>, ICourseDomainService
{
private readonly ICourseRepository _courseRepository;
public CourseDomainService(
ICleanArchMediator mediator,
INotificationHandler<DomainNotificationEvent> notifications,
ICourseRepository courseRepository,
IValidator<Course> courseValidator,
IApplicationLogger applicationLogger) : base(mediator, notifications, courseRepository, courseValidator, applicationLogger)
{
_courseRepository = courseRepository;
}
}
...
// Usage
var allCourses = await _courseDomainService.GetAllAsync();
📚 Example Project
See the - CleanArchAcceleratorTools.Examples project for a complete working example, including setup and advanced scenarios. It implements a fully working API with all other modules implemented.
🧠 Tips
- Prefer
DynamicSelectto reduce materialization and network payloads. - Centralize selection fields in a constant for reuse as in CourseSelects.
🤝 Contributing
Contributions are welcome! Open issues or submit PRs for features, bug fixes, or documentation improvements. Contributing guidelines are under construction.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. 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 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. |
-
net6.0
- FluentValidation (>= 11.12.0)
-
net7.0
- FluentValidation (>= 11.12.0)
-
net8.0
- FluentValidation (>= 11.12.0)
-
net9.0
- FluentValidation (>= 11.12.0)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on CleanArchAcceleratorTools.Domain:
| Package | Downloads |
|---|---|
|
CleanArchAcceleratorTools.Infrastructure
This module is part of CleanArchAcceleratorTools, a toolkit to accelerate building applications with Clean Architecture. |
|
|
CleanArchAcceleratorTools.Application
This module is part of CleanArchAcceleratorTools, a toolkit to accelerate building applications with Clean Architecture. |
|
|
CleanArchAcceleratorTools.AllInOne
This module is part of CleanArchAcceleratorTools, a toolkit to accelerate building applications with Clean Architecture. |
GitHub repositories
This package is not used by any popular GitHub repositories.