DKNet

Generate DTO properties

Part of DKNet.EfCore.DtoGenerator. The Quick Start declares a public partial record. Replace its ProductDto shell to keep one property under your control:

[GenerateDto(typeof(Product))]
public partial record ProductDto
{
    public string Name { get; init; } = "fallback";
}

DtoGenerator walks readable entity properties through the base chain, removes static members and indexers, and emits selected properties except names already declared by the DTO.

Candidate properties must be public instance properties with public getters and no index parameters. Base-type properties are included and de-duplicated by name. A partial class or partial record struct also receives a matching partial declaration.

🧱 Where it fits

The compiler component diagram shows the analyzer boundary. GenerateDtoAttribute is internal source compiled into your project; GlobalDtoConfiguration is a documentation marker inside the analyzer, not a runtime configuration API.

⚠️ Gotchas & limits