Mapping Validation Attributes From Domain Entity to DTO
If you’re using something supporting DataAnnotations, you should be able to use a metadata class to contain your validation attributes: public class ProductMetadata { [NotEmpty, NotShorterThan10Characters, NotLongerThan100Characters] public string Name { get; set; } [NotLessThan0] public decimal Price { get; set;} } and add it in the MetadataTypeAttribute on both the domain entity & DTO: … Read more