Sunday, 1 September 2013

The best pattern to access objects through subrelation

The best pattern to access objects through subrelation

Which one is better? and why?
CurrentCustomer.Company.Employees.Select(x=>x.Name);
Or :
CurrentCustomer.GetCompanyEmployeeNames();



Other example:
CurrentCustomer.Company.Employees.where(x=>x.Post==EmpPosts.Manager).Select(x=>x.Name);
Or :
CurrentCustomer.GetCompanyManagerNames();
//And ComanyIncludes :
//GetManagerEmployeeNames();
//And Employee includes
GetManagerNames(); And GetEmployeeNames();
...

No comments:

Post a Comment