Interface IDomainFactory
- Namespace
- JD.Domain.Abstractions
- Assembly
- JD.Domain.Abstractions.dll
Defines the contract for creating domain instances with validation.
public interface IDomainFactory
Methods
CreateAsync<TDomain>(object, DomainCreateOptions?, CancellationToken)
Creates a domain instance from the specified input with validation asynchronously.
ValueTask<Result<TDomain>> CreateAsync<TDomain>(object input, DomainCreateOptions? options = null, CancellationToken cancellationToken = default) where TDomain : class
Parameters
inputobjectThe input data for creating the instance.
optionsDomainCreateOptionsThe creation options.
cancellationTokenCancellationTokenThe cancellation token.
Returns
Type Parameters
TDomainThe type of the domain instance to create.
Create<TDomain>(object, DomainCreateOptions?)
Creates a domain instance from the specified input with validation.
Result<TDomain> Create<TDomain>(object input, DomainCreateOptions? options = null) where TDomain : class
Parameters
inputobjectThe input data for creating the instance.
optionsDomainCreateOptionsThe creation options.
Returns
- Result<TDomain>
A result containing the created instance or validation errors.
Type Parameters
TDomainThe type of the domain instance to create.