Welcome to BeyondNet.Ddd! A library for implementing Domain-Driven Design patterns in .NET with clean, maintainable code.
# Core DDD library
dotnet add package BeyondNetCode.Shell.Ddd
# Value Objects
dotnet add package BeyondNetCode.Shell.Ddd.ValueObjects
# AutoMapper integration
dotnet add package BeyondNetCode.Shell.Ddd.AutoMapper| Package | Description | NuGet |
|---|---|---|
BeyondNetCode.Shell.Ddd | Core DDD abstractions (Entity, AggregateRoot, DomainEvents, Rules) | link |
BeyondNetCode.Shell.Ddd.ValueObjects | Pre-built value objects (IdValueObject, AuditValueObject, Validators) | link |
BeyondNetCode.Shell.Ddd.AutoMapper | AutoMapper integration for DDD entities | link |
- Entity Base Class: Full-featured entity implementation with tracking, validation, and business rules
- Aggregate Root: Specialized entity for aggregate roots with domain events support
- Value Objects: Immutable value objects with built-in validation
- Business Rules: Rule engine with
BrokenRulesManagerfor domain validation - Property Change Tracking: INotifyPropertyChanged implementation with change tracking
- AutoMapper Integration: Seamless mapping between DTOs and domain entities
- MediatR Integration: Built-in support for domain events via MediatR
publicclassSampleName:ValueObject<SampleName>{publicstringValue{get;}publicSampleName(stringvalue){if(string.IsNullOrWhiteSpace(value))thrownewArgumentNullException(nameof(value));Value=value;}protectedoverrideIEnumerable<object>GetEqualityComponents(){yieldreturnValue;}}publicclassSampleEntityProps:IProps{publicSampleNameName{get;set;}}publicclassSampleEntity:Entity<SampleEntity,SampleEntityProps>{publicSampleEntity(SampleEntityPropsprops):base(props){}publicstaticSampleEntityCreate(stringname){varprops=newSampleEntityProps{Name=newSampleName(name)};returnnewSampleEntity(props);}publicoverridevoidAddValidators(){ValidatorRules.Add(newSampleNameValidator());}}publicclassSampleCreatedDomainEvent:DomainEvent{publicGuidEntityId{get;}publicstringName{get;}publicSampleCreatedDomainEvent(GuidentityId,stringname){EntityId=entityId;Name=name;}}publicclassSampleAggregateRootProps:IProps{publicSampleNameName{get;set;}}publicclassSampleAggregateRoot:AggregateRoot<SampleAggregateRoot,SampleAggregateRootProps>{publicSampleAggregateRoot(SampleAggregateRootPropsprops):base(props){}publicstaticSampleAggregateRootCreate(stringname){varprops=newSampleAggregateRootProps{Name=newSampleName(name)};varentity=newSampleAggregateRoot(props);entity.DomainEvents.Add(newSampleCreatedDomainEvent(entity.Id.Value,name));returnentity;}}// Configure AutoMappervarconfig=newMapperConfiguration(cfg =>{cfg.AddProfile<ParentRootProfile>();});varmapper=newMapper(config);// Map DTO to Entityvardto=newSampleEntityDto{Id="1",Name="test"};varprops=mapper.Map<SampleEntityProps>(dto);varentity=newSampleEntity(props);For detailed documentation, see the language-specific README files:
If you were using Ums.Shell.Ddd, update your NuGet references:
# Before (Ums.Shell.Ddd)
dotnet add package Ums.Shell.Ddd
# After (BeyondNetCode.Shell.Ddd)
dotnet add package BeyondNetCode.Shell.DddUpdate namespaces in your code:
// BeforeusingUms.Shell.Ddd;// AfterusingBeyondNetCode.Shell.Ddd;See CONTRIBUTING.md for GitFlow workflow, commit conventions, and coding standards.
See VERSIONING.md for SemVer strategy and release process.
Licensed under the MIT License. See LICENSE for details.
See DISCLAIMER.md for original code authorship attribution.