好吧
我有一个带有私人集合成员的实体:
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,但没有成功。我该怎么办?