0
votes

I am using Visual Studio 2015 with Entity Framework 6 and .NET 4.5.2 for a WinForms application. I am currently working on adding reports to my project. I thought about adding the classes which return DTO collections intended for reports to my DataServices section. I decided not to because all classes in my DataServices section currently use my DAL to provide CRUD operations through repositories. My classes for reports will only return read only DTO collections. Since my report DTO classes will not use the typical repository methods (i.e. Add, Update, Delete...) I decided to create a new folder in my project called ReportServices. I have therefore placed my report class named RequestReports (this is for my Request model entity and will return a RequestDetailDto collection) in that folder. Below is a picture of how I have things setup now:

enter image description here

I am not sure if the way I have it setup is the right thing to do. One other way might be to just scrap the idea of a reporting section and mix the reporting classes in with the other data services which use repositories. If I do this, then I would simply not implement the repository methods of add, update, delete for the report classes. I would only implement the get operations for the reporting classes of FindByID and FindAll. Is this really the way to go?

So my question is, "Where should the classes which retrieve information for reporting purposes be placed in a Visual Studio project of a layered design?"

Thanks in advance.

1

1 Answers

1
votes

I recommend creating a separate project altogether for reporting. Keep the reporting model and data access separated from your main domain, don't use the same Repositories. Different purposes means different efficient ways of fetching data. It will also pave the way for the option of storing reporting data in a distinct database.

You might want to check out the CQRS approach, it brings a lot to the table on these issues.