I went through the same issue's. I am pretty sure Dev express only supports design time preview when you use a data adapter etc. I would think there would be an event that you could hook into to populate an objects datasource at design time but I never found it. I looked around on the forums there and could not find out how to get design time preview to work with an object.
I think that using a business object for a report is a good idea in principle but it gets screwy when you have complex reports with multi tables as business object's really represent a single table. That being said I created my own set of "QueryObjects" that represent the fields returned from a query. Kind of like a read only chopped down version of a business object.
I bind this object to the report to get design time binding of the fields (like I said I am unable to get design time preview to work). I also have additional properties on the query object that store the select statement and parameters as well as additional report meta data. I also have methods to retrieve the data using strataframes data access layer. like below
LoSqlCmd.CommandText = oMetaDataBiz.SQL
LoSqlCmd.Parameters.AddWithValue(p.ParameterName, p.ParameterValue)
However the more direct approach is to just create a report using the dev express data adapter etc. This gives you preview at design time. Then at runtime just swap the datasource with a table from a biz obj.
Paul
1. How would you ever be able to preview the report this way? The BO has no data connection at design time, so it doesn't know where to get the data. Is there some way this feature can be added...something like a design-time data source we can point it to?
2. The XtraReport does not support dropping the BO onto the designer. I used some code and mangled the report enough to force it to allow me to drop one onto the designer. However, it still won't let me set the BusinessObject property of the BindingSource at design time. I get the error: "Unable to cast object of type 'WindowsApplication1.XtraReportBase' to type 'System.Windows.Forms.Control'."
Am I going about this the wrong way? Would it be better not to use a BO/BindingSource for the data source on an XtraReport?
The only way I can currently get anything to work is setting everything at run-time and that just isn't going to work for the really complicated reports. I need to be able to set things at design-time and preview the output.