OnlineMenu.DomainCore 1.0.1

dotnet add package OnlineMenu.DomainCore --version 1.0.1
                    
NuGet\Install-Package OnlineMenu.DomainCore -Version 1.0.1
                    
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="OnlineMenu.DomainCore" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="OnlineMenu.DomainCore" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="OnlineMenu.DomainCore" />
                    
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 OnlineMenu.DomainCore --version 1.0.1
                    
#r "nuget: OnlineMenu.DomainCore, 1.0.1"
                    
#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 OnlineMenu.DomainCore@1.0.1
                    
#: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=OnlineMenu.DomainCore&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=OnlineMenu.DomainCore&version=1.0.1
                    
Install as a Cake Tool

DomainCore

NuGet License: MIT

Domain primitives, base entities, aggregate roots, and domain events for building Domain-Driven Design applications with .NET.

📦 Installation

dotnet add package DomainCore

🚀 Features

  • Base Entities: BaseEntity with Id, ExternalId, and audit fields
  • Tenant Entities: BaseTenantEntity for multi-tenant applications
  • Aggregate Roots: IAggregateRoot marker interface
  • Domain Events: DomainEventBase and HasDomainEventsBase for event-driven design
  • Value Objects: Base classes for implementing value objects
  • Audit Fields: Built-in CreatedAt, CreatedBy, UpdatedAt, UpdatedBy tracking

📖 Usage

Basic Entity

using DomainCore.Entities;

public class Product : BaseEntity
{
    public string Name { get; set; }
    public decimal Price { get; set; }

    public Product(string name, decimal price, Guid userId)
    {
        Name = name;
        Price = price;
        SetUser(userId);
    }
}

Multi-Tenant Entity

using DomainCore.Entities;

public class Order : BaseTenantEntity
{
    public Guid ProductId { get; set; }
    public int Quantity { get; set; }
    public decimal TotalPrice { get; set; }

    public Order(Guid productId, int quantity, decimal totalPrice, Guid tenantId, Guid userId)
    {
        ProductId = productId;
        Quantity = quantity;
        TotalPrice = totalPrice;
        SetTenant(tenantId);
        SetUser(userId);
    }
}

Domain Events

using DomainCore.Events;

public class OrderPlacedEvent : DomainEventBase
{
    public Guid OrderId { get; }
    public decimal TotalAmount { get; }

    public OrderPlacedEvent(Guid orderId, decimal totalAmount)
    {
        OrderId = orderId;
        TotalAmount = totalAmount;
    }
}

public class Order : BaseTenantEntity
{
    public void Place()
    {
        // Business logic...
        IsPlaced = true;
        UpdateTimestamp();

        // Raise domain event
        RegisterDomainEvent(new OrderPlacedEvent(ExternalId, TotalPrice));
    }
}

🏗️ Base Classes

BaseEntity

Provides common entity properties:

  • Guid Id - Internal database ID
  • Guid ExternalId - Public-facing UUID
  • DateTime CreatedAt - Creation timestamp
  • Guid? CreatedBy - User who created the entity
  • DateTime? UpdatedAt - Last update timestamp
  • Guid? UpdatedBy - User who last updated the entity

BaseTenantEntity

Extends BaseEntity with multi-tenancy:

  • Guid TenantId - Tenant identifier for data isolation
  • void SetTenant(Guid tenantId) - Set the tenant ID

HasDomainEventsBase

For entities that raise domain events:

  • List<DomainEventBase> DomainEvents - Collection of events
  • void RegisterDomainEvent(DomainEventBase domainEvent) - Add event
  • void ClearDomainEvents() - Clear all events

🤝 Contributing

Contributions are welcome! Please open an issue or submit a pull request.

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

💬 Support

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 was computed.  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.
  • net8.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on OnlineMenu.DomainCore:

Package Downloads
OnlineMenu.MultiTenancy.EntityFrameworkCore

Multi-tenant data isolation for Entity Framework Core. Provides tenant context services, base tenant entity, and query filtering for SaaS applications.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 40 12/28/2025
1.0.0 55 12/28/2025