Skip to main content
.NET Standard 2.0+

XPObjectSource Class

Enables binding reports to XPO persistent class’ data.

Namespace: DevExpress.Xpo

Assembly: DevExpress.DataAccess.v22.1.dll

Declaration

public class XPObjectSource :
    DataComponentBase,
    IBindingList,
    IList,
    ICollection,
    IEnumerable,
    ITypedList,
    ISupportInitialize,
    IListAdapter,
    IXPDictionaryProvider
public class XPObjectSource :
    DataComponentBase,
    IBindingList,
    ICollection,
    IEnumerable,
    IList,
    ITypedList,
    ISupportInitialize,
    IListAdapter,
    IXPDictionaryProvider

Remarks

XPObjectSource can be used at design time via the Report Wizard:

XPObjectSource

You can also initialize and enable XPObjectSource in code. Create an XPObjectSource instance. Initialize the XPObjectSource.ConnectionStringName property and pass the persistent object type to the XPObjectSource.SetEntityType method. Then, pass the XPObjectSource instance to the XtraReportBase.DataSource property of your XtraReport.

using DevExpress.Xpo;
using DevExpress.Xpo.Metadata;
using DevExpress.XtraReports;
// ... 
XPObjectSource dataSource = new XPObjectSource();
dataSource.ConnectionStringName = "ConnectionString";
dataSource.SetEntityType(typeof(Product));
using(XtraReport2 report = new XtraReport2()) {
    report.DataSource = dataSource;
    // ... 
    // Preview the report or do something else. 
    // .. 
}

Tip

The complete step-by-step examples are provided in the Reporting documentation:

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the XPObjectSource class.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also