I have a dictionary like this:
/// <summary>
/// Gets the leave entitlement details.
/// </summary>
/// <value>The leave entitlement details.</value>
public Dictionary<string, EmployeeLeaveEntitlement> LeaveEntitlementDetails { get; set; }
And I want to map it to the database. Is it possible to use a protected or private List<> for that? such as:
/// <summary>
/// Gets the leave entitlement details.
/// </summary>
/// <value>The leave entitlement details.</value>
public Dictionary<string, EmployeeLeaveEntitlement> LeaveEntitlementDetails { get; set; }
public List<EmployeeLeaveEntitlement> LeveEntitlementStore
{
get
{
List<EmployeeLeaveEntitlement> leaveEntitlements = new List<EmployeeLeaveEntitlement>();
foreach (KeyValuePair<string, EmployeeLeaveEntitlement> leaveType in LeaveEntitlementDetails)
{
leaveEntitlements.Add(leaveType.Value);
}
return leaveEntitlements;
}
set
{
foreach (EmployeeLeaveEntitlement item in value)
{
this.LeaveEntitlementDetails.Add(item.LeaveType, item);
}
}
}
Can anyone help me?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…