I am currently working on a system that performs quite a lot of reporting-style functions, which consumes many different data points and converts them into larger, sometimes flattened outputs. Most of my application is based on the repository template. Because of this, I have a set of mock repositories that I use to test scripts. The problem I am facing is that the interaction between these data points is so complex that it quickly becomes a service nightmare in order to maintain a “data layout”. Here is an example:
public class SomeReportingEntity
{
private IProductRepo ProductRepo;
private IManagerRepo ManagerRepo;
private ILocationRepo LocationRepo;
private IOrdersService OrdersService;
private IEmployeeRepo EmployeeRepo;
public ReportingEntity(IProductRepo ipr, IManagerRepo imr, ILocationRepo ilr, IOrdersService ios,
IEmployeeRepo ier){
}
public SomeReportingEntity GetManagerSalesByRegionReport()
{
var MangerSalesByRegionItems = From x in ProductRepo.CurrentProducts()
Join y in OrdersService.FutureOrders() On ...
Join z in EmployeeRepo.ActiveEmployees() On ...
Join a in LocationRepo.GetAllRegions() On ...
Join b In ManagerRepo.GetActiveManagers On ...
Select new SomeReportingEntity() With { ... }
return MangerSalesByRegionItems.ToList();
}
}
, , , , , , , , . - , , , - , . , mocks (, , ), , .
, :
- "" , ? , .
- ? , , . Linq , , .