我試圖使用AutoMapper和它完美的作品,除了INT性質,因爲它只是取代了場0AutoMapper地圖詮釋
代碼:
public class Employee
{
public int E1 { get; set; }
public int E2 { get; set; }
}
Mapper.CreateMap<Employee, Employee>().ForAllMembers(opt => opt.Condition(srs => !srs.IsSourceValueNull));
Employee e1 = new Employee {E1 = 7};
Employee e2 = new Employee {E2 = 78};
Mapper.Map(e2, e1);
// //結果E1 = 0,E2 = 78 ....它是否應該只映射E2和 離開E1,因爲我沒有初始化它?