Tolitech.Domain 1.0.0-preview.11

This is a prerelease version of Tolitech.Domain.
dotnet add package Tolitech.Domain --version 1.0.0-preview.11
                    
NuGet\Install-Package Tolitech.Domain -Version 1.0.0-preview.11
                    
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="Tolitech.Domain" Version="1.0.0-preview.11" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Tolitech.Domain" Version="1.0.0-preview.11" />
                    
Directory.Packages.props
<PackageReference Include="Tolitech.Domain" />
                    
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 Tolitech.Domain --version 1.0.0-preview.11
                    
#r "nuget: Tolitech.Domain, 1.0.0-preview.11"
                    
#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.
#:package Tolitech.Domain@1.0.0-preview.11
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Tolitech.Domain&version=1.0.0-preview.11&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Tolitech.Domain&version=1.0.0-preview.11&prerelease
                    
Install as a Cake Tool

Tolitech.Domain

Overview

Tolitech.Domain provides the core abstractions and primitives for building robust domain layers in .NET applications, following Clean Architecture principles. It includes base classes and interfaces for Entities, Aggregates, Domain Events, Smart Enums, and Repositories.

Features

  • Entities & Aggregates: Abstract base classes and interfaces for domain modeling.
  • Domain Events: Interfaces for event-driven domain logic.
  • SmartEnum: Type-safe, extensible enums with custom logic.
  • Repositories: Generic repository interfaces for persistence abstraction.
  • Validation: Entity validation via the Result pattern.

Installation

Add a reference to the Tolitech.Domain project or install via NuGet:

# .NET CLI
 dotnet add package Tolitech.Domain

Usage

Entity & Aggregate Example

public class ProductId : IEntityId<Guid>
{
    public Guid Value { get; init; }
    public ProductId(Guid value) => Value = value;
}

public class Product : Entity<ProductId>
{
    public string Name { get; set; }
    public Product(ProductId id, string name) : base(id) => Name = name;
}

public class Order : Aggregate<Guid>
{
    public List<Product> Products { get; set; } = new();
    public Order(Guid id) : base(id) { }
}

SmartEnum Example

public class CreditCard : SmartEnum<CreditCard>
{
    public static readonly CreditCard Standard = new(1, "Standard", 0.0);
    public static readonly CreditCard Premium = new(2, "Premium", 0.05);
    public static readonly CreditCard Platinum = new(3, "Platinum", 0.10);
    public double Discount { get; }
    private CreditCard(int value, string name, double discount) : base(value, name) => Discount = discount;
}

// Usage
var platinum = CreditCard.FromName("Platinum");

Domain Event Example

public class ProductCreatedEvent : IDomainEvent
{
    public ProductId ProductId { get; }
    public ProductCreatedEvent(ProductId productId) => ProductId = productId;
}

Repository Interface Example

public interface IProductRepository : IRepository<Product> { }

Validation Example

var product = new Product(new ProductId(Guid.NewGuid()), "Laptop");
var result = Tolitech.Results.Result.OK();
bool isValid = product.IsValid(result);

Notes

  • Designed for extensibility and integration with other Tolitech libraries.
  • Follows Clean Architecture and DDD best practices.
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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 Tolitech.Domain:

Package Downloads
Tolitech.Infrastructure.Persistence.EntityFrameworkCore

The Tolitech.Infrastructure.Persistence.EntityFrameworkCore repository provides a foundational implementation for the Repository pattern, Unit of Work, and Specification Query Builder using Entity Framework Core. Simplify database interaction, promote code organization, and maintenance using these widely recognized patterns.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-preview.11 47 11/1/2025
1.0.0-preview.10 162 9/20/2025
1.0.0-preview.9 158 8/4/2025
1.0.0-preview.8 398 7/21/2025
1.0.0-preview.7 137 7/7/2025
1.0.0-preview.6 122 7/7/2025
1.0.0-preview.5 131 7/3/2025
1.0.0-preview.4 133 7/3/2025
1.0.0-preview.3 130 1/27/2025
1.0.0-preview.2 89 1/6/2025
1.0.0-preview.1 113 12/8/2024