Answer the question
In order to leave comments, you need to log in
How to organize a complex DTO from multiple entities?
Let's say there is an entity user
the user has roles the role has permissions
the user has a subject
I do something for the data from the form, with the usual one I just encapsulate the input and form the entity.
And how do they do this when there are nestings, you can link to the article.
Answer the question
In order to leave comments, you need to log in
Well, you can create several DTOs by analogy with the necessary entities from the database.
For example,
class User {
Role role;
}
class Role {
List<Privilege> privileges;
}
class UserDto {
RoleDto role;
}
class RoleDto {
List<PrivilegeDto> privileges;
}
Converter<>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question