Hi Rocky,
On ProjectGetter.cs file of ProjectTracker sample, is there a reason why
private void DataPortal_Fetch(Criteria criteria)
{
if (criteria.ProjectId == -1)
Project = ProjectEdit.NewProject();
else
Project = ProjectEdit.GetProject(criteria.ProjectId);
if (criteria.GetRoles)
RoleList = RoleList.GetList();
}
can't call the DataPortal methods directly and read like this
private void DataPortal_Fetch(Criteria criteria)
{
if (criteria.ProjectId == -1)
Project = DataPortal.Create<ProjectEdit>();
else
Project = DataPortal.Fetch<ProjectEdit>(criteria.ProjectId);
if (criteria.GetRoles)
RoleList = DataPortal.Fetch<RoleList>();
}
Why do I ask this question?
Suppose you have a CriteriaBase criteria with several properties. In this case, I would receive this criteria as a parameter of this DataPortal_Fetch and re-send it directly to the respective DataPortal.
Otherwise I must have a ProjectEdit.GetProject factory method that accepts the referred CriteriaBase criteria as parameter, just to call DataPortal.Fetch<ProjectEdit> relaying the same parameter.
This is for consistency sake. Creator and Getter Unit of Work are ReadOnly objects. This is ok for Getter UoW but Creator UoW can't use DataPortal.Create. So the same pattern is used all around.
Copyright (c) Marimer LLC