Foundational .NET library with essential types, patterns, and interfaces for modern application development. Includes value objects, domain patterns, API handlers, and messaging contracts.
$ dotnet add package SimplyWorks.PrimitiveTypesFoundational .NET library with essential types, patterns, and interfaces for modern application development.
dotnet add package SimplyWorks.PrimitiveTypes
Ready-to-use business types with built-in validation and conversion:
Money - Currency handling with conversion supportWeight - Mass measurements (kg, lb, oz, g)Dimensions - 3D measurements with unit conversionStreetAddress - Structured address representationClean architecture building blocks:
IEntity<T> - Entity interfaces with identityIAggregateRoot<T> - Domain aggregate markersISpecification<T> - Business rule specificationsValueObject - Base class with equality semanticsCQRS-style interfaces for clean APIs:
IGetHandler<TKey, TResult> - Query operationsICommandHandler<TRequest, TResult> - Command operationsIDeleteHandler<TKey> - Delete operationsEvent-driven architecture interfaces:
IPublish / IConsume<T> - Message publishing/consumptionIBroadcast / IListen<T> - Event broadcasting/listening// Value Objects
var price = new Money(99.99m, "USD");
var weight = new Weight(2.5m, WeightUnit.kg);
var size = new Dimensions(30, 20, 10, DimensionUnit.cm);
// Domain Entity
public class Product : IAggregateRoot
{
public int Id { get; set; }
public Money Price { get; set; }
public Weight ShippingWeight { get; set; }
public Dimensions PackageDimensions { get; set; }
}
// API Handler
public class GetProductHandler : IGetHandler<int, Product>
{
public async Task<Product> Handle(int id)
{
// Retrieve and return product
return await productRepository.GetByIdAsync(id);
}
}
Part of the Simplify9 ecosystem:
Visit our GitHub repository for additional examples, source code, and contribution opportunities.
MIT Licensed | Made by Simplify9