This is a migrated thread and some comments may be shown as answers.

Design-time vs Production Datasource Assignment

1 Answer 100 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 2
Kevin asked on 01 May 2009, 07:24 PM
I've made the necessary changes to devenv.exe.config to get our design time ability to preview reports working.  Yeah!  This makes it much faster to get reports designed rather than change/compile/run.  We use Subsonic so I had to add sections to the dev config that told it where to find the subsonic "stuff".

However I have a question (looking for ideas) on setting the datasource at design time versus production.

To get design-time preview working, I added code after the InitializeComponent() method to hit a business object and return a dataset which I assign to the report datasource.  This call just hits the business object method with some dummy data - enough to give the preview something to work with.

But in production this call won't do.  For production I comment out this assignment, and do it in the real code (web page presenter logic) that is instantiating the report viewer, prompting for real values, and showing the report.  So for production (or stage - basically whenever NOT previewing at design-time) I comment out the assignment in the report .cs file after the InitializeComponent(), because the datasource assignment happens elsewhere.

Is there a better way to do this?  I don't want to have to remember to comment out the datasource assignment and if I do, I assume the datasource assignment is happening twice which I don't want either.

I can't just put the production datasource assignment logic directly into the report .cs file because it's part of another business module (using MS MVP pattern) with lots of other stuff going on that I don't want to have in my report library module.

Any ideas?

Thx

1 Answer, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 04 May 2009, 10:27 AM
Hi Kevin,

In order to use your business objects at design time you have to mock your objects just for the sake of the design time as you're doing it right now. Currently there is no more feasible approach to proceed with.

Greetings,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
General Discussions
Asked by
Kevin
Top achievements
Rank 2
Answers by
Steve
Telerik team
Share this question
or