A shared domain library for .NET projects developed at IATec. This package provides common building blocks for domain-driven design, including entities, results, errors, successes, logging models, contracts, and utility extensions used across multiple IATec applications.
Install the package via NuGet:
dotnet add package IATec.Shared.DomainOr via Package Manager:
Install-Package IATec.Shared.Domain- .NET 8.0, .NET 9.0, or .NET 10.0
- FluentResults (4.0.0)
- FluentValidation (12.1.1)
- Ulid (1.4.1)
Base entity classes for domain models:
| Class | Description |
|---|---|
Entity<T> |
Abstract base entity with a generic identifier type |
EntityInt32 |
Entity with a 32-bit integer identifier |
EntityUlidInt32 |
Entity with a 32-bit integer identifier and an external ULID |
EntityNullable |
Entity with a nullable string identifier |
Error and success result classes built on top of FluentResults:
| Class | Description |
|---|---|
BadRequestFieldsError |
Base class for bad-request field validation errors |
EmptyFieldError |
Error when a required field is empty |
EntityNotFoundError |
Error when an entity is not found |
InternalServerError |
Error for internal server failures |
InvalidFieldError |
Error when a field has an invalid value |
InvalidLengthError |
Error when a field value length is out of range |
InvalidMinValueError |
Error when a field value is below the minimum |
ResourceNotFoundError |
Error when a requested resource is not found |
ServiceUnavailableError |
Error when a service is unavailable |
| Class | Description |
|---|---|
CreatedSuccess |
Success result for resource creation |
EmptyResult |
Success result with no content |
NoContentSuccess |
Success result for no-content responses |
Interfaces defining contracts for common services and patterns:
| Interface | Description |
|---|---|
IEntity |
Contract for domain entities |
ILogDispatcher |
Contract for dispatching log entries |
ILogService |
Contract for logging service implementation |
IValidatorGeneric |
Contract for generic validator provider |
Data transfer objects for logging:
| Class | Description |
|---|---|
LogDto |
Log entry data transfer object |
LogCreateDto |
Data transfer object for creating a new log entry |
Type-safe identifiers for contexts and logging actions:
| Class | Description |
|---|---|
BaseIdentify |
Abstract base class for identification types |
ContextType |
Context type for categorizing errors (Domain, Application) |
LogActionType |
Log action types (Added, Modified, Deleted) |
Constants for error and status code message keys:
| Class | Description |
|---|---|
DefaultErrorMessageKeys |
Default error message key constants |
StatusCodeMessageKeys |
Status code message key constants |
Configuration option classes:
| Class | Description |
|---|---|
ContainerOption |
Configuration options for containers |
LogServiceOption |
Configuration options for the logging service |
Utility extension methods:
| Class | Description |
|---|---|
EnumExtension |
Extension methods for enum operations |
IntExtension |
Extension methods for integer and date calculations |
ResultExtension |
Extension methods for FluentResults |
StringExtension |
Extension methods for string manipulation |
using IATec.Shared.Domain.SeedWorks;
public class Product : EntityInt32
{
public string Name { get; set; } = string.Empty;
public decimal Price { get; set; }
}using IATec.Shared.Domain.Results.Errors.Default;
using IATec.Shared.Domain.Identifies.Contexts;
var error = new EmptyFieldError("Product", "Name", ContextType.Domain);using IATec.Shared.Domain.Results.Successes.Default;
var success = new CreatedSuccess(123);using IATec.Shared.Domain.Extensions;
// String extensions
bool isValid = "hello".IsValid();
string appended = "root".AppendString("child"); // "root.child"
// Integer extensions
bool inRange = 5.IsBetween(1, 10);
int age = birthDate.GetAge();
// Result extensions
bool isCreated = result.IsCreatedSuccess();
bool isNotFound = result.IsResourceNotFoundError();Copyright © IATec Solutions. All rights reserved.
This library is maintained by the IATec | Solution | Platform Team. For issues or contributions, please visit the GitHub repository.