Как сопоставить модель представления с моделью расширенного домена с помощью mapster
Хорошо
У меня есть объект с частными членами набора:
public class Tool : Entity<int> // this Entity has SetId() method to change the id of an object
{
public Tool(string name, string description)
{
Name = name;
Description = description;
MakeValidation(this, new ToolValidator());
}
public string Name { get; private set; }
public string Description { get; private set; }
public void UpdateName(string name)
{
Name = name;
MakeValidation(this, new ToolValidator());
}
public void UpdateDescription(string description)
{
Description = description;
MakeValidation(this, new ToolValidator());
}
}
И у меня есть модель просмотра:
public class ToolViewModel : ViewModel<int> // this ViewModel has the Id property
{
public string Name { get; set; }
public string Description { get; set; }
public bool Status { get; set; }
}
Я пытался использовать ConstructUsing и MapWith, но безуспешно. Как мне это сделать?