DddSeedwork 1.0.0
dotnet add package DddSeedwork --version 1.0.0
NuGet\Install-Package DddSeedwork -Version 1.0.0
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="DddSeedwork" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DddSeedwork" Version="1.0.0" />
<PackageReference Include="DddSeedwork" />
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 DddSeedwork --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: DddSeedwork, 1.0.0"
#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 DddSeedwork@1.0.0
#: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=DddSeedwork&version=1.0.0
#tool nuget:?package=DddSeedwork&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Seedwork
DDD building blocks for .NET — zero external dependencies.
What's Included
| Namespace | Types |
|---|---|
Seedwork.Domain |
Entity<TId>, ValueObject, AggregateRoot<TId>, Id<T>, Enumeration<TEnum> |
Seedwork.Abstractions |
IDomainEvent, IAggregateRoot, IRepository<,>, IUnitOfWork |
Seedwork.Guard |
DomainGuard (12 fluent validation methods) |
Seedwork.Exceptions |
DomainException, DomainValidationException, EntityNotFoundException, ForbiddenException |
Quick Start
Strongly-typed Id
using Seedwork.Domain;
public record OrderId(Guid Value) : Id<OrderId>(Value);
var id = OrderId.New(); // random
var id2 = OrderId.From(someGuid); // from existing
var id3 = OrderId.Parse("..."); // from string
Guid raw = id; // implicit conversion
Entity
public class OrderItem : Entity<Guid>
{
public string ProductName { get; private set; }
public OrderItem(Guid id, string productName) : base(id)
{
ProductName = DomainGuard.AgainstNullOrWhiteSpace(productName, nameof(productName));
}
private OrderItem() { ProductName = string.Empty; } // ORM
}
ValueObject
public class Money : ValueObject
{
public decimal Amount { get; }
public string Currency { get; }
public Money(decimal amount, string currency)
{
Amount = amount;
Currency = currency;
}
protected override IEnumerable<object?> GetEqualityComponents()
{
yield return Amount;
yield return Currency;
}
}
AggregateRoot
public class Order : AggregateRoot<OrderId>
{
public string CustomerName { get; private set; }
public static Order Create(string customerName)
{
var order = new Order(OrderId.New(), customerName);
order.RaiseDomainEvent(new OrderCreatedEvent(order.Id));
return order;
}
private Order(OrderId id, string customerName) : base(id)
{
CustomerName = DomainGuard.AgainstNullOrWhiteSpace(customerName, nameof(customerName));
}
private Order() { CustomerName = string.Empty; } // ORM
}
Smart Enum
public class OrderStatus : Enumeration<OrderStatus>
{
public static readonly OrderStatus Pending = new(0, "Pending");
public static readonly OrderStatus Confirmed = new(1, "Confirmed");
public static readonly OrderStatus Shipped = new(2, "Shipped");
private OrderStatus(int value, string name) : base(value, name) { }
}
var status = OrderStatus.FromName("Confirmed");
var all = OrderStatus.GetAll();
bool found = OrderStatus.TryFromValue(99, out var result); // false
Guard Clauses
All 12 methods return the validated value and throw DomainValidationException on failure:
Name = DomainGuard.AgainstNullOrWhiteSpace(name, nameof(name));
Email = DomainGuard.AgainstInvalidEmail(email, nameof(email));
Price = DomainGuard.AgainstNegativeOrZero(price, nameof(price));
Title = DomainGuard.AgainstLength(title, 200, nameof(title));
Code = DomainGuard.AgainstInvalidFormat(code, @"^[A-Z]{3}$", nameof(code));
Qty = DomainGuard.AgainstOutOfRange(qty, 1, 100, nameof(qty));
Items = DomainGuard.AgainstEmptyCollection(items, nameof(items));
Exceptions
// Validation — carries ParameterName for structured API errors
throw new DomainValidationException("Too short", "username");
// Entity not found — carries EntityType + EntityId
throw EntityNotFoundException.For<Order>(orderId);
// Authorization
throw new ForbiddenException("You do not own this resource.");
EF Core Integration
For EF Core support (value converters, comparers, domain event dispatch), install Seedwork.EntityFrameworkCore.
License
MIT
| 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 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 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.
-
net10.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on DddSeedwork:
| Package | Downloads |
|---|---|
|
DddSeedwork.EntityFrameworkCore
EF Core integration for Seedwork — value converters, comparers, configuration extensions, and domain event dispatch. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 4,023 | 3/2/2026 |