Andrew.Domain.SharedKernel
1.1.5
dotnet add package Andrew.Domain.SharedKernel --version 1.1.5
NuGet\Install-Package Andrew.Domain.SharedKernel -Version 1.1.5
<PackageReference Include="Andrew.Domain.SharedKernel" Version="1.1.5" />
<PackageVersion Include="Andrew.Domain.SharedKernel" Version="1.1.5" />
<PackageReference Include="Andrew.Domain.SharedKernel" />
paket add Andrew.Domain.SharedKernel --version 1.1.5
#r "nuget: Andrew.Domain.SharedKernel, 1.1.5"
#:package Andrew.Domain.SharedKernel@1.1.5
#addin nuget:?package=Andrew.Domain.SharedKernel&version=1.1.5
#tool nuget:?package=Andrew.Domain.SharedKernel&version=1.1.5
π§© Domain.SharedKernel
Domain.SharedKernel is a clean, reusable shared library tailored for Domain-Driven Design (DDD) applications. It encapsulates core domain logic, base entity definitions, Snowflake ID generation, and abstraction contractsβideal for use across multiple bounded contexts or microservices.
π¦ Installation
Install via NuGet:
.NET CLI
dotnet add package Andrew.Domain.SharedKernel
Package Manager
NuGet\Install-Package Andrew.Domain.SharedKernel
π Getting Started
1. Install in the Domain Layer of your solution.
2. Add configuration to appsettings.json
:
"Snowflake": {
"WorkerId": 1
}
βΉοΈ Use different WorkerIds for each microservice instance or physical machine to avoid ID collisions.
3. Register services via Dependency Injection (in Infra layer or Program.cs
):
services.AddDomainShardKernelCollection(configuration);
π¦ What's Included
β
BaseEntity
A common abstract base class for domain entities, offering:
- Unique identifier with Snowflake ID generation
- Domain event support (using [MediatR])
π HashHelper
A utility class for secure hash generation:
SHA256
MD5
Useful for token generation, password hashing, and more.
βοΈ Snowflake ID Generator
Generates globally unique 64-bit IDs based on time and machine identity. Perfect for distributed systems that require high-performance and collision-free ID generation.
π§© Core Domain Abstractions
Includes key interfaces for domain architecture:
IAggregateRoot
β Marks an entity as an aggregate root.ICurrentUser
β Access the current user context (UserId
,TenantId
, etc.).IUnitOfWork
β Defines transactional boundaries for your repositories.
π‘ Why Use a Shared Kernel?
Implementing a Shared Kernel brings:
- π Consistency across bounded contexts
- π§Ό Separation of domain logic from infrastructure concerns
- π Reusability across projects and microservices
- π Clarity through standard interfaces and patterns
π License
MIT License
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
- IdGen (>= 3.0.7)
- MediatR (>= 12.5.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.6)
- Microsoft.Extensions.Configuration.Binder (>= 9.0.6)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Andrew.Domain.SharedKernel:
Package | Downloads |
---|---|
Andrew.Infrastructure.SharedKernel
Making it easier to use Infrastructure layer in DDD. Contains Unit of Work,AppHelper,Dbcontext,CurrentUser . |
GitHub repositories
This package is not used by any popular GitHub repositories.