Creating DTO-Mapping (Part 2)
Structuring Code with Clean Architecture, DDD Principles, and Robust Framework Patterns
Why Use a Framework for DTO & Mapping?
Using the Asp.Net Unique Architecture (AUA) Framework allows for faster, cleaner, and more orderly coding. It is built on cutting-edge software paradigms including Clean Architecture, Clean Code, Domain-Driven Design (DDD), LMAX Architecture, SOLID principles, Code Refactoring, and GRASP object-oriented design principles.
Without a proper architectural structure, software projects suffer from complex, nested code where modifying one layer disrupts others. Architectural patterns emerge from decades of collective developer feedback to maximize flexibility, extensibility, and reusability while saving time and cost.
Clean Architecture
Structured layering for maintainability and scalability.
DDD Concepts
Focusing deeply on business domain models and logic.
SOLID Principles
Ensuring modularity, decoupled design, and robust code.
Code Refactoring
Continuous improvement of internal code structures.
When primary keys are explicitly specified and passed directly to SQL Server rather than being auto-generated by identity columns:
public class UserAccessConfig : IEntityTypeConfiguration<UserAccess>
{
public void Configure(EntityTypeBuilder<UserAccess> builder)
{
// Disable Identity auto-generation
builder.Property(p => p.Id)
.ValueGeneratedNever();
builder.Property(p => p.Title)
.HasMaxLength(LengthConsts.MaxStringLen300);
}
}
Configuring automatic global filters so that soft-deleted entities are filtered out from all default database queries:
public class AppUserConfig : IEntityTypeConfiguration<AppUser>
{
public void Configure(EntityTypeBuilder<AppUser> builder)
{
// Global Query Filter for logical deletion
builder.HasQueryFilter(p => !p.IsDeleted);
}
}
"If you think good architecture is expensive, try bad architecture."AUA Framework Philosophy