OnlineMenu.DomainCore
1.0.1
dotnet add package OnlineMenu.DomainCore --version 1.0.1
NuGet\Install-Package OnlineMenu.DomainCore -Version 1.0.1
<PackageReference Include="OnlineMenu.DomainCore" Version="1.0.1" />
<PackageVersion Include="OnlineMenu.DomainCore" Version="1.0.1" />
<PackageReference Include="OnlineMenu.DomainCore" />
paket add OnlineMenu.DomainCore --version 1.0.1
#r "nuget: OnlineMenu.DomainCore, 1.0.1"
#:package OnlineMenu.DomainCore@1.0.1
#addin nuget:?package=OnlineMenu.DomainCore&version=1.0.1
#tool nuget:?package=OnlineMenu.DomainCore&version=1.0.1
DomainCore
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:
BaseEntitywithId,ExternalId, and audit fields - Tenant Entities:
BaseTenantEntityfor multi-tenant applications - Aggregate Roots:
IAggregateRootmarker interface - Domain Events:
DomainEventBaseandHasDomainEventsBasefor event-driven design - Value Objects: Base classes for implementing value objects
- Audit Fields: Built-in
CreatedAt,CreatedBy,UpdatedAt,UpdatedBytracking
📖 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 IDGuid ExternalId- Public-facing UUIDDateTime CreatedAt- Creation timestampGuid? CreatedBy- User who created the entityDateTime? UpdatedAt- Last update timestampGuid? UpdatedBy- User who last updated the entity
BaseTenantEntity
Extends BaseEntity with multi-tenancy:
Guid TenantId- Tenant identifier for data isolationvoid SetTenant(Guid tenantId)- Set the tenant ID
HasDomainEventsBase
For entities that raise domain events:
List<DomainEventBase> DomainEvents- Collection of eventsvoid RegisterDomainEvent(DomainEventBase domainEvent)- Add eventvoid 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.
🔗 Related Packages
- OnlineMenu.Security - Security claims and roles
- OnlineMenu.MultiTenancy.EntityFrameworkCore - Multi-tenant EF Core support
- OnlineMenu.Identity.Abstractions - Authentication abstractions
💬 Support
- 🐛 Issues: GitHub Issues
- 💬 Discussions: GitHub Discussions
| Product | Versions 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. |
-
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.