.NET 3-tier architecture best practice question...

Associate
Joined
6 Jun 2004
Posts
2,389
Location
London
Ok here's my question:

I have an application I am writing which loads in XML defined report "templates", these report XML files have sections like Inputs, Outputs and QueryBody - the Inputs are displayed to the user, who enters/picks values into each - when run, all the values are merged together to create a query which gets run and then displayed as the template is defined.

I have a 3-tier architecture and I load in the XML files in a data access layer, using a business entity object to return the populated ReportTemplate, which my GUI layer can then use.
The crux of my problem is that the inputs are more like input placeholders which I want to render as controls on a windows form (ie <Input Name="FriendID" DataType="Integer" QueryMapping="f.FriendID"/> - each definition like this is stored in its own ReportInput object, built in the Data Access layer) - in this case because the DataType is "Integer" I want to render a NumericalUpDown control rather than a TextBox. Similarly if the DataType="DateTime" I would want to render a DatePicker control.
I have further complications too, such as mapping an Input to Static Data (already loaded) which displays a ListBox with predefined data in it.

At the moment, to keep the layers separate I have a GUI factory method that takes in the datatype etc and outputs the correct group of controls (setting the DataSource of the ListBox if StaticData is being mapped to etc).
I like this, and it works fairly well, except I find it very inefficient to generate these controls each and everytime I want to view a particular input - ideally I'd want to generate these controls ONCE and store/cache them inside the "ReportInput" business entity object I use already, but this would create a GUI layer-dependency in my business entity objects...Is there any other way to do this? Am I already doing the "best practice"?

Thanks for getting this far!

Happy new year all.
 
Back
Top Bottom