DDD.Core.Components
1.0.4
dotnet add package DDD.Core.Components --version 1.0.4
NuGet\Install-Package DDD.Core.Components -Version 1.0.4
<PackageReference Include="DDD.Core.Components" Version="1.0.4" />
<PackageVersion Include="DDD.Core.Components" Version="1.0.4" />
<PackageReference Include="DDD.Core.Components" />
paket add DDD.Core.Components --version 1.0.4
#r "nuget: DDD.Core.Components, 1.0.4"
#:package DDD.Core.Components@1.0.4
#addin nuget:?package=DDD.Core.Components&version=1.0.4
#tool nuget:?package=DDD.Core.Components&version=1.0.4
Domain Driven Design Core Helpers
Domain Driven Design Core Helpers is a lightweight helper library for implementing Domain-Driven Design (DDD) in .NET applications.
It provides abstract base classes for common building blocks such as Value Objects and Entities, along with a simple Result type to standardize success/failure handling.
✨ Features
- 🔹 Abstract Entity base class with identity handling.
- 🔹 Abstract ValueObject base class with equality and immutability support.
- 🔹 Result class for clean success/failure operations without exceptions.
- 🔹 Designed for .NET 9.0+ and modern C#.
✨ Result Types
The package introduces different Results to represent the outcome of operations, allowing for clear handling of success, failure, and error propagation. Results are designed to be hierarchically convertible, meaning lower-level results can be implicitly converted into higher-level results while preserving their data.
There are two main categories of results:
Non-typed results: These contain general information about the operation, including:
- Success status
- Failure types (if any)
- Error messages
- The layer in which the failure occurred (e.g., Service layer)
Typed results: These inherit all functionality from non-typed results, in addition to:
- the result's output type
- The result's output (will throw error if the result is a failure)
Hierarchical Conversion
Results can be converted up the hierarchy. For instance, an EntityResult can be implicitly converted to a ServiceResult. This conversion retains all original values, and if the target result type is associated with a specific layer, the conversion will automatically assign the layer information.
Result Hierarchy
From lowest to highest in the hierarchy:
- 🔹 ValueObjectResult: Used for creating value objects.
- 🔹 EntityResult: Used within entity classes for domain-specific operations. The typed version only returns an
Entity
object. - 🔹 MapperResult: Used for object mapping operations.
- 🔹 InfraResult: Used in the infrastructure layer for non-repository operations.
- 🔹 RepoResult: Used in the infrastructure layer for repository operations. Can only contain an
AggregateRoot
. - 🔹 ServiceResult: Used in the service layer for domain-specific applications.
- 🔹 UseCaseResult: Used in the use case layer. Typically, results are converted to this type when propagating outward.
- 🔹 Result: A generic result type that can be used anywhere in the application.
📦 Installation
dotnet add package DDD.Core.Components
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
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.