Welcome to the Wangkanai Domain-Driven-Design Foundation repository - a robust framework providing essential building blocks for implementing Domain-Driven Design (DDD) patterns in .NET applications. This foundation library offers core domain modeling capabilities, comprehensive auditing features, and Entity Framework Core integrations to accelerate enterprise application development.
This repository produces three NuGet packages:
| Package | Release | Pre-Release |
|---|---|---|
| Wangkanai.Foundation.Domain | ||
| Wangkanai.Foundation.Application | ||
| Wangkanai.Foundation.Infrastructure |
Core domain-driven design patterns and fundamental building blocks for implementing DDD in .NET applications. This module provides the essential abstractions and base implementations for creating rich domain models.
Features:
- Entity Base Classes: Strongly-typed entities with generic ID support, optimized EF proxy handling, and performance caching
- Value Objects: Immutable value objects with structural equality, cache key generation, and optimized equality comparison
- Aggregate Roots: Support for aggregate boundaries with typed ID constraints (Int, Guid, String, Long, Byte)
- Domain Events: Event-driven architecture with versioning, timestamps, and event suppression capabilities
- Repository Pattern: Generic sync/async repository interfaces with Unit of Work pattern support
- Result Pattern: Railway-oriented programming for error handling with typed success/failure results
- Domain Exceptions: Structured exception hierarchy for domain-specific errors
- Cache Key Management: Advanced cache key generation with type-based and composite key support
- Change Tracking: Entity state tracking with entry state management (Unchanged, Modified, Added, Deleted)
- Performance Optimizations: Built-in performance monitoring and type caching for improved runtime efficiency
| Package | Release | Pre-Release |
|---|---|---|
| Wangkanai.Audit.Domain | ||
| Wangkanai.Audit.Application | ||
| Wangkanai.Audit.Infrastructure |
Comprehensive auditing module for maintaining complete audit trails and change history in your domain models. Seamlessly integrates with the Foundation module to provide automatic tracking capabilities.
Features:
- Audit Trail Entity: Comprehensive trail tracking with user, timestamp, and change details
- Auditable Entity Base Classes: Pre-built entities with Created, Updated, Deleted timestamps
- User Auditable Entities: Track CreatedBy, UpdatedBy, DeletedBy user information
- Trail Type Enumeration: Categorize changes as Create, Update, Delete, or None
- JSON Value Storage: Efficient storage of old/new values in optimized JSON format
- Field-Level Change Tracking: Monitor and record specific column modifications
- Trail Store Repository: Queryable store for managing and retrieving audit records
- Entity Configuration Builders: Fluent API for configuring audit behavior
- Soft Delete Support: Track deletions with timestamp and user information
- Row Version Support: Optimistic concurrency control with version tracking
| Package | Release | Pre-Release |
|---|---|---|
| Wangkanai.EntityFramework | ||
| Wangkanai.EntityFramework.Postgres | ||
| Wangkanai.EntityFramework.SqlServer | ||
| Wangkanai.EntityFramework.MySql | ||
| Wangkanai.EntityFramework.Sqlite |
Entity Framework Core integration module that bridges DDD patterns with EF Core's powerful ORM capabilities. Provides utilities and extensions for seamless database operations while maintaining domain model purity.
Features:
- Database Management Extensions: CreateDatabase, MigrateDatabase with async support
- Value Generators: DateTime and DateTimeOffset generators for automatic timestamps
- Database Provider Support: Specialized extensions for Postgres, SqlServer, MySql, Sqlite
- PostgreSQL Features: JSONB support, array types, full-text search, partitioning, real-time notifications
- SQL Server Features: Temporal tables, columnstore indexes, memory-optimized tables, change tracking
- MySQL Features: JSON support, replication configuration, partitioning, query optimization
- SQLite Features: JSON1 extension, full-text search, spatial data, version management
- Bulk Operations: Efficient bulk insert/update/delete across all providers
- Index Optimization: Provider-specific index configurations and strategies
- Connection Management: Advanced connection pooling and configuration options
We welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
- .NET 9.0 or later
- Entity Framework Core 9.0 or later (for EF-related packages)
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
If this project has helped you, please consider:
- β Starring the repository
- π Reporting bugs or requesting features
- π° Supporting via Open Collective
- π° Supporting via Patreon
For detailed documentation, examples, and API references, visit our Documentation.
Built with β€οΈ by Sarin Na Wangkanai and the community.