0
I have a class library that is responsible for generating reports. Each report consists of the following:

- Header
- Body
- Footer

Some of the reports have the same header / footer. None of the reports have the same body.

The body component is generated by taking a parameter which stores the data that needs to be displayed. The type for the parameter varies for each report.

e.g.  Report 1 might take `List<TypeOne>` as a parameter
       Report 2 might take `List<TypeTwo>` as a parameter

What is the best way to represent the above using a design pattern. I have considered using a factory but am having difficulties with the body section as each report takes different parameters.

Thanks
4
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by Momerath
0

Is it an option to create a type (class) that contains the available options? Can you provide some more details about the parameters?

0

What kind of reports are you generating? HTML? Crystal? Some formats will be easier to work with than others for something like this...

0

Create an IReportData and an IReportGenerator. Use factory to get proper instance of IReportGenerator, and pass proper instance of IReportData to the IReportGenerator you just got.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.