Connecting Tech Pros Worldwide Forums | Help | Site Map

Help with design (pattern) of reporting application

fsx fsx is offline
Newbie
 
Join Date: Nov 2007
Posts: 9
#1: Nov 6 '08
I'm building an asp.net report application. Ideally all reports would be generated by a single page by specifying the report name in the querystring (e.g. reportName=MonthEnd). This page would use a factory to return an instance of the specified report:
Expand|Select|Wrap|Line Numbers
  1. ReportFactory.Create(ByVal reportName as String) as IReport
I'm thinking of having a set of interfaces (e.g. IDateRange, IFooter) which report classes could implement as required. However, I can see that my client code (ASP.NET webform) will need to perform checks to see if a particular interface is supported by the IReport object (returned from the factory). For example, if IDateRange is supported then display the date range controls on the form.

Surely there must be a more elegant OO solution?

Lives Here
 
Join Date: Sep 2006
Posts: 12,070
#2: Nov 6 '08

re: Help with design (pattern) of reporting application


There is no way around that. If the reports are being selected by the user then we need to know what else is required by the report by inspecting the report selected itself. You'd need an AJAX call after the report is selected which tells the front end what other extra parameters are required by that report.
fsx fsx is offline
Newbie
 
Join Date: Nov 2007
Posts: 9
#3: Nov 6 '08

re: Help with design (pattern) of reporting application


I wondered if there was a way to move the code into the actual report classes? Maybe through delegation? However, to do so would require passing in a reference to the web form, and creating (and wiring) controls in the report class.
Lives Here
 
Join Date: Sep 2006
Posts: 12,070
#4: Nov 6 '08

re: Help with design (pattern) of reporting application


Quote:

Originally Posted by fsx

I wondered if there was a way to move the code into the actual report classes? Maybe through delegation? However, to do so would require passing in a reference to the web form, and creating (and wiring) controls in the report class.

... and that would be a big no no because the model must never assume a particular view structure (let alone create it).
Reply


Similar .NET Framework bytes