Back to Devexpress

XPObjectSource Class

xpo-devexpress-dot-xpo-18a96a94.md

latest4.2 KB
Original Source

XPObjectSource Class

Enables binding reports to XPO persistent class’ data.

Namespace : DevExpress.Xpo

Assembly : DevExpress.DataAccess.v25.2.dll

NuGet Package : DevExpress.DataAccess

Declaration

csharp
public class XPObjectSource :
    DataComponentBase,
    IBindingList,
    ICollection,
    IEnumerable,
    IList,
    ITypedList,
    ISupportInitialize,
    IListAdapter,
    IXPDictionaryProvider
vb
Public Class XPObjectSource
    Inherits DataComponentBase
    Implements IBindingList,
               ICollection,
               IEnumerable,
               IList,
               ITypedList,
               ISupportInitialize,
               IListAdapter,
               IXPDictionaryProvider
csharp
public class XPObjectSource :
    DataComponentBase,
    IBindingList,
    IList,
    ICollection,
    IEnumerable,
    ITypedList,
    ISupportInitialize,
    IListAdapter,
    IXPDictionaryProvider
vb
Public Class XPObjectSource
    Inherits DataComponentBase
    Implements IBindingList,
               IList,
               ICollection,
               IEnumerable,
               ITypedList,
               ISupportInitialize,
               IListAdapter,
               IXPDictionaryProvider

Remarks

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

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.

csharp
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. 
    // .. 
}
vb
Imports DevExpress.Xpo
Imports DevExpress.Xpo.Metadata
Imports DevExpress.XtraReports
' ... 
Private dataSource As New XPObjectSource()
dataSource.ConnectionStringName = "ConnectionString"
dataSource.SetEntityType(GetType(Product))
Using report As New XtraReport2()
    report.DataSource = dataSource
    ' ... 
    ' Preview the report or do something else. 
    ' .. 
End Using

Tip

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

Inheritance

Object MarshalByRefObject Component DataComponentBase XPObjectSource

See Also

XPObjectSource Members

DevExpress.Xpo Namespace