© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
8 replies
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:
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!;
    }
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
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ How to structure DTOs
C#CC# / help
4y ago
✅ Theoretical question. MediatR and DTO and onion structure
C#CC# / help
2y ago
Model to DTO
C#CC# / help
3y ago
How are DTO utilized
C#CC# / help
3y ago