Business Object
- 2 minutes to read
You can bind reports to a business object that serves as an object data source.
Tip
Use an object data source to prepare stored data to display in a report. For instance, in a multi-tier application where the data layer is separated from the presentation layer, you can bind a report to a .NET object that fetches data from a database.
An object can supply data in one of the following ways:
Include a public member (method or property) to return an object that implements the IEnumerable<T> interface.
This member can be a static or instance property (method). It serves as the data source’s data member. If a method has parameters, use data source parameters to pass parameter values to the method.
Use the object’s fields to supply data.
Use one of the following approaches to bind your report to an object data source:
If your object implements the IList, ITypedList, IBindingList, or IListSource interface, assign it to a report’s XtraReportBase.DataSource. Note that these objects are non-serializable. In an End-User Report Designer, they are lost when users save a report. See Bind a Report to a List Object for more information.
For other object types, use the ObjectDataSource class to bind a report to your object. See Bind a Report to an Object Data Source for more information.
The following demos use object data sources (the DevExpress Demo Center should be installed):
- Balance Sheet
- Profit and Loss Report
- Hierarchical Report
- Multi-Column Report
- Restaurant Menu
- Large Dataset
- Swiss QR Bill