dotnet-mapping-standard

Standardize .NET data mapping with source-generated mappers and explicit boundary conversions.

1|1|Updated Jan 3, 2026
One-click install
npx skills add https://github.com/mcj-coder/development-skills --skill dotnet-mapping-standard
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotnet-mapping-standard
Source: https://github.com/mcj-coder/development-skills/tree/main/skills/dotnet-mapping-standard
Command: npx skills add https://github.com/mcj-coder/development-skills --skill dotnet-mapping-standard

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill addresses the common challenge of inconsistent and error-prone data mapping between different layers (DTOs, domain models, persistence models) in .NET applications, promoting maintainability and reducing runtime errors.

Core Features & Use Cases

  • Source-Generated Mappers: Encourages the use of compile-time generated mappers (like Mapperly) for safety and performance.
  • Explicit Boundary Conversions: Enforces mapping logic at defined architectural boundaries, preventing scattering and improving clarity.
  • Typed ID Handling: Provides clear patterns for mapping strongly-typed IDs and value objects.
  • Use Case: When developing a new API endpoint that receives a CreateOrderRequest DTO and needs to map it to a CreateOrderCommand for the domain layer, this Skill guides the creation of a safe, explicit, and testable mapping.

Quick Start

Use the dotnet-mapping-standard skill to create a source-generated mapper for converting between OrderDto and Order domain objects.

Frequently Asked Questions about dotnet-mapping-standard

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I standardize .NET data mapping between DTOs and domain models?

You standardize .NET data mapping by using source-generated mappers and explicit boundary conversions between DTOs, domain models, and persistence models. This approach ensures deterministic, testable mapping paths while avoiding runtime reflection magic.

How does source generation work for mapping DTOs in .NET?

Source generation for mapping DTOs in .NET uses compile-time tools like Mapperly to generate mapping code automatically. This provides safety and performance by creating deterministic, testable mapping paths between objects without the runtime overhead of reflection.

What is the best way to map strongly-typed IDs and value objects in .NET?

The best way to map strongly-typed IDs and value objects in .NET is to use explicit patterns provided by source-generated mappers. This ensures clear, type-safe conversions between layers while maintaining the integrity of your domain model boundaries.

When do I need explicit boundary conversions for .NET application layers?

You need explicit boundary conversions for .NET application layers when translating data between API requests, domain models, and persistence models. Enforcing mapping at these defined architectural boundaries prevents logic scattering and improves overall code clarity and maintainability.

Can I use Mapperly to map a CreateOrderRequest DTO to a domain command?

Yes, you can use Mapperly to map a CreateOrderRequest DTO to a CreateOrderCommand. This Skill guides the creation of safe, explicit, and testable source-generated mappings for converting request DTOs into domain layer commands.

Why avoid runtime reflection magic for mapping in .NET?

You avoid runtime reflection magic for mapping in .NET to ensure deterministic, testable mapping paths. Source-generated mappers provide compile-time safety and better performance, reducing the runtime errors and inconsistencies common with reflection-based mapping approaches.