Lately, I have been doing some additional testing with the report tool and found out two things:
- Business objects do not show automatically anymore in the Data Sources pane
- You can add Data Sources to the Data Sources pane based on your business objects
- You can only add Data Sources from your business objects if it is defined in the same assembly
- The Data Sources pane is buggy when no Data Sources are defined within you assembly of Web application: f.e. with the pane empty you can bring up the “Remove object” from the popup menu, under these circumstances also the line “There are no data sources to show for the selectd project.” is not visible!
I have found a workaround which is not as clean as I would like but is workable until a fix is released:
- Define the reports in the assembly where the business objects are defined, using the Add Data Source function from the Data Sources pane. I don’t like this part, because it mixes in some of the presentation into the business layer, but I guess I can live with it for now…
- Reports by default are embedded in their assembly as resources, this makes it possible to load the resource from the calling Web application:
LocalReport report = new LocalReport();
if (WebConfigurationManager.AppSettings(“LocalReportPath”) == null)
{
Stream rs = typeof(OrdersClass).Assembly.GetManifestResourceStream(“Dnote.MyApp.Model.Reports.TestReport1.rdlc”);
report.LoadReportDefinition(rs);
}
else
report.ReportPath = Server.MapPath(WebConfigurationManager.AppSettings(“LocalReportPath”).ToString());
You can of course decide to always load the reports from the rdlc file, but personally I don’t like to move around files before a release, because I’m sure I would forget to do that one day. Also, it would not be compatible with the Publish Web Site function of VS.NET 2005.
Geen opmerkingen:
Een reactie posten