E13.Common.Domain
2025.117.22
dotnet add package E13.Common.Domain --version 2025.117.22
NuGet\Install-Package E13.Common.Domain -Version 2025.117.22
<PackageReference Include="E13.Common.Domain" Version="2025.117.22" />
<PackageVersion Include="E13.Common.Domain" Version="2025.117.22" />
<PackageReference Include="E13.Common.Domain" />
paket add E13.Common.Domain --version 2025.117.22
#r "nuget: E13.Common.Domain, 2025.117.22"
#:package E13.Common.Domain@2025.117.22
#addin nuget:?package=E13.Common.Domain&version=2025.117.22
#tool nuget:?package=E13.Common.Domain&version=2025.117.22
E13.Common.Domain
Overview
E13.Common.Domain is a package within the E13.Common collection that provides core domain abstractions and patterns for building domain-driven applications. It defines interfaces and base classes for domain entities and implements the specification pattern for encapsulating business rules.
Features
- Entity Interfaces: Core interfaces for domain entities (IEntity, ICreatable, IModifiable, IDeletable)
- Specification Pattern: Implementation of the specification pattern for business rules
- Composable Specifications: Support for combining specifications using logical operators (And, Or, Not)
- Entity Lifecycle: Interfaces for tracking entity lifecycle (creation, modification, deletion)
- Expiration Support: Interface for entities with expiration dates
Installation
dotnet add package E13.Common.Domain
Usage
Creating Domain Entities
using E13.Common.Domain;
// Basic entity
public class Product : IEntity
{
public Guid Id { get; set; }
public string Name { get; set; }
public decimal Price { get; set; }
}
// Entity with tracking information
public class Customer : IEntity, ICreatable, IModifiable, IDeletable
{
public Guid Id { get; set; }
public string Name { get; set; }
// ICreatable implementation
public string? CreatedBy { get; set; }
public string? CreatedSource { get; set; }
public DateTime? Created { get; set; }
// IModifiable implementation
public string? ModifiedBy { get; set; }
public string? ModifiedSource { get; set; }
public DateTime? Modified { get; set; }
// IDeletable implementation
public string? DeletedBy { get; set; }
public string? DeletedSource { get; set; }
public DateTime? Deleted { get; set; }
// IDeletable provides this method automatically
// public bool IsDeleted() => Deleted != null;
}
Using the Specification Pattern
using E13.Common.Domain.Specifications;
// Create a specification for active customers
public class ActiveCustomerSpecification : Specification<Customer>
{
public override Expression<Func<Customer?, bool>> ToExpression()
{
return customer => customer != null && customer.Deleted == null;
}
}
// Create a specification for premium customers
public class PremiumCustomerSpecification : Specification<Customer>
{
public override Expression<Func<Customer?, bool>> ToExpression()
{
return customer => customer != null && customer.IsPremium;
}
}
// Using specifications
var activeSpec = new ActiveCustomerSpecification();
var premiumSpec = new PremiumCustomerSpecification();
// Combine specifications
var activePremiumSpec = activeSpec.BitwiseAnd(premiumSpec);
// Check if a customer satisfies the specification
bool isPremiumActive = activePremiumSpec.IsSatisfiedBy(customer);
// Use with LINQ
var activePremiumCustomers = dbContext.Customers
.Where(activePremiumSpec.ToExpression())
.ToList();
Dependencies
- .NET 9.0
Related Packages
E13.Common.Domain is part of the E13.Common collection, which includes:
- E13.Common.Core - Core utilities and base classes
- E13.Common.Data.Db - Database access components
- E13.Common.Api - Web API layer components
- E13.Common.AspNet - ASP.NET shared components
- E13.Common.Logic - Business logic components
Contributing
Contributions to E13.Common.Domain are welcome. If you have suggestions or improvements, please submit an issue or create a pull request in the GitHub repository.
License
This project is licensed under the MIT License. For more details, see the LICENSE file in the repository.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. 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. |
-
net9.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on E13.Common.Domain:
| Package | Downloads |
|---|---|
|
E13.Common.Data.Db
Common package for defining a Data layer against an EFCore accessible backend |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2025.117.22 | 214 | 4/27/2025 |
| 2025.114.21 | 259 | 4/24/2025 |
| 2025.114.20 | 263 | 4/24/2025 |
| 2025.114.19 | 280 | 4/24/2025 |
| 2025.114.18 | 256 | 4/24/2025 |
| 2025.112.17 | 297 | 4/22/2025 |
| 2025.112.16 | 275 | 4/22/2025 |
| 2025.111.15 | 305 | 4/21/2025 |
| 2025.106.14 | 326 | 4/16/2025 |
| 2025.106.12 | 343 | 4/16/2025 |
| 2025.97.11 | 286 | 4/7/2025 |
| 2025.97.10 | 302 | 4/7/2025 |
| 2025.96.9 | 235 | 4/6/2025 |
| 2025.96.8 | 252 | 4/6/2025 |
| 2025.91.7 | 265 | 4/1/2025 |
| 2025.91.6 | 284 | 4/1/2025 |
| 2025.90.4 | 304 | 3/31/2025 |
| 2023.30.1 | 518 | 1/30/2023 |
| 2023.18.1 | 492 | 1/18/2023 |
| 1.0.0 | 233 | 4/1/2025 |