C#C
C#4y ago
Dreams

How to structure this DTO?

Should I flatten this? I'm not sure how to make nested objects with C#.

My old-ish DTO model (before needing localization) looks like this:
c#
public class DynamicContentDTO
    {
        [Required(ErrorMessage = "Id is required.")]
        public string Id { get; set; } = null!;

        [Required(ErrorMessage = "Type is required.")]
        public string Type { get; set; } = null!;

        [Required(ErrorMessage = "Value is required.")]
        public string Value { get; set; } = null!;
    }
image.png
Was this page helpful?