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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Ghanavats.Domain.Factory.Abstractions" Version="1.0.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Ghanavats.Domain.Factory.Abstractions" Version="1.0.4" />
                    
Directory.Packages.props
<PackageReference Include="Ghanavats.Domain.Factory.Abstractions" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Ghanavats.Domain.Factory.Abstractions --version 1.0.4
                    
#r "nuget: Ghanavats.Domain.Factory.Abstractions, 1.0.4"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=Ghanavats.Domain.Factory.Abstractions&version=1.0.4
                    
Install Ghanavats.Domain.Factory.Abstractions as a Cake Addin
#tool nuget:?package=Ghanavats.Domain.Factory.Abstractions&version=1.0.4
                    
Install Ghanavats.Domain.Factory.Abstractions as a Cake Tool

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.

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.

Version Downloads Last updated
1.0.4 166 4/21/2025
1.0.3 192 4/16/2025
1.0.2 195 4/16/2025
1.0.1 176 4/13/2025
1.0.0 175 4/13/2025