我的任务是使AbsenceDTO具有两个属性DateFrom和DateTO,其中Domain Absence可以是一天,具有三个属性Day,Month和Year。贝娄是代码示例:
public class Absence
{
#region Properties
/// <summary>
/// A unique id
/// </summary>
public int Id { get; set; }
/// <summary>
/// Day of the absence
/// </summary>
public int Day { get; set; }
/// <summary>
/// Month of the absence
/// </summary>
public int Month { get; set; }
/// <summary>
/// Year of the absence
/// </summary>
public int Year { get; set; }
}
public class AbsenceDTO
{
private List<Absence> absences = null;
public AbsenceDTO()
{
}
public AbsenceDTO(List<Absence> absences)
{
this.absences = absences;
}
public DateTime DateFrom
{
get
{
return //TO DO
}
}
public DateTime DateTO
{
get
{
return //TO DO
}
}
}
那么在这里我应该如何计算DTO日期属性以及制作映射器/转换器时最佳模式/实践应该是什么?