Blog136K views922 votes0 replies2,424 following
Building a Source Generator for DTO Validation in .NET 8
NET 8 doesn't include a built-in DataAnnotations source generator. This post shows how to write a minimal generator that emits a fast Validate method for your DTOs, moving validation from runtime reflection to compile-time code generation.