Answer the question
In order to leave comments, you need to log in
How to implement custom object mapping in ASP NET CORE MVC?
Such a question
I was told that the Automapper is evil and it is better not to use it.
How then to deal with my implementation of the mapper without displaying c#
I mean, it’s tedious for me to use and create my own mapper class for each DTO for each VIewModel?
For example there
public class RoleMapperUpdateModel : IMapper<RoleDTO, UpdateRoleViewModel>
{
public UpdateRoleViewModel Map(RoleDTO source)
{
return new UpdateRoleViewModel()
{
Id = source.Id,
Name = source.Name,
Users = source.Users
};
}
public RoleDTO MapBack(UpdateRoleViewModel destination)
{
return new RoleDTO()
{
Id = destination.Id,
Name = destination.Name,
Users = destination.Users
};
}
}
Answer the question
In order to leave comments, you need to log in
Might be worth asking
I was told that the Automapper is evil and should not be used.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question