Ghanavats.Domain.Factory.Abstractions
1.0.4
dotnet add package Ghanavats.Domain.Factory.Abstractions --version 1.0.4
NuGet\Install-Package Ghanavats.Domain.Factory.Abstractions -Version 1.0.4
<PackageReference Include="Ghanavats.Domain.Factory.Abstractions" Version="1.0.4" />
<PackageVersion Include="Ghanavats.Domain.Factory.Abstractions" Version="1.0.4" />
<PackageReference Include="Ghanavats.Domain.Factory.Abstractions" />
paket add Ghanavats.Domain.Factory.Abstractions --version 1.0.4
#r "nuget: Ghanavats.Domain.Factory.Abstractions, 1.0.4"
#addin nuget:?package=Ghanavats.Domain.Factory.Abstractions&version=1.0.4
#tool nuget:?package=Ghanavats.Domain.Factory.Abstractions&version=1.0.4
Ghanavats.Domain.Factory.Abstractions
Overview
Ghanavats.Domain.Factory.Abstraction is the contract package for Ghanavats.Domain.Factory, defining the core interface and configuration structures used to support factory-based entity creation in a Domain-Driven Design (DDD) architecture.
This package is ideal for applications or libraries that want to depend on abstractions without coupling to any specific factory implementation.
π¦ Installation
dotnet add package Ghanavats.Domain.Factory.Abstraction
β Supports .NET 8 and .NET 9
π§ Whatβs Included
This package contains the following key elements:
β IDomainFactory<TRequest, TResponse>
A generic interface that defines the contract for creating domain entity objects in a configurable way.
public interface IDomainFactory<in TRequest, out TResponse>
where TRequest : class
where TResponse : EntityBase
{
TResponse? CreateEntityObject(TRequest request, [Optional] Action<DomainFactoryOption> action);
}
- TRequest: Input request object, typically a command or DTO.
- TResponse: A domain entity that inherits from EntityBase.
- Optional DomainFactoryOption: Allows the caller to influence how the object is constructed.
β DomainFactoryOption
A flexible configuration object that lets consumers:
- Ignore specific properties from the request object.
- Inject additional properties into the creation process.
- Customise how the factory interprets the input data.
Example:
option.IgnoreProperties(["PropertyA", "PropertyB"]);
option.AddProperties(new Dictionary<string, object>
{
{ "SomeNewProperty", 123 },
{ "CreatedOn", DateTime.UtcNow }
}.ToImmutableDictionary());
π€ Why Use the Abstractions Package?
This package follows the dependency inversion principle, allowing application layers to depend on abstractions β not implementations.
Use Ghanavats.Domain.Factory.Abstraction when:
- You want to mock or stub the factory for unit testing.
- You are building your own custom factory implementation.
- You want to decouple your application logic from the Domain.Factory implementation.
π Related Packages
Ghanavats.Domain.Factory
The full implementation that uses reflection to create domain entities based on request objects and DomainFactoryOption.
Ghanavats.Domain.Primitives
Used to define base types like EntityBase. This package is required in both abstraction and implementation libraries.
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 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. |
-
net8.0
- Ghanavats.Domain.Primitives (>= 1.0.2)
-
net9.0
- Ghanavats.Domain.Primitives (>= 1.0.2)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Ghanavats.Domain.Factory.Abstractions:
Package | Downloads |
---|---|
Ghanavats.Domain.Factory
A lightweight .NET library that implements the Factory pattern in line with Domain-Driven Design (DDD) principles. Ghanavats.Domain.Factory enables the creation of complex entities and aggregates through a configurable, reflection-based factory mechanism. Supports customisation via options to ignore or inject properties. Designed to enforce consistency, encapsulate construction logic, and reduce boilerplate in your domain layer. |
GitHub repositories
This package is not used by any popular GitHub repositories.