All docs
V20.2
20.2
20.1
19.2
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

XPO Data Source

  • 2 minutes to read

An XPO data source gets data from eXpress Persistent Objects.

Design Time

The XPO Data Source requires additional configuration to allow users to create the data source in a Data Source Wizard:

  • Create a data layer to access a data store.
    In this example, a data layer (represented by the SimpleDataLayer class object) is created and assigned to the XpoDefault.DataLayer property using the XpoDefault.GetDataLayer method.

    using DevExpress.Data.DB;
    using DevExpress.Xpo;
    
    string forcedConnectionString = ...;
    XpoDefault.DataLayer = XpoDefault.GetDataLayer(forcedConnectionString, 
    AutoCreateOption.DatabaseAndSchema);
    
  • Create XPO classes:

  • Add the XPO value to the DashboardDesignerDataSourceWizardSettings.AvailableDataSourceTypes property to enable users to create the XPO data source. The XPO data source is added to the list of available data sources in the Data Source Wizard.

To connect to the pre-configured XPO data source, follow the steps below:

  1. Click the New Data Source button in the Data Source ribbon tab.

    DataBinding_NewDataSource

  2. On the first page of the invoked Data Source Wizard dialog, select eXpress Persistent Objects (XPO) and click Next. Then, specify the entity type.

Runtime

  1. Create a DashboardXpoDataSource object and use the ConnectionStringName property to specify the name of the connection string defined in the application's configuration file.

  2. Pass the persistent object type to the SetEntityType method.

View Example: How to Bind a Dashboard to the XPO Data Source at Runtime

The code sample below illustrates how to connect to the XPO data source.

using DevExpress.DashboardCommon;
// ...
public static DashboardXpoDataSource CreateXpoDataSource()
{
    DashboardXpoDataSource dataSource = new DashboardXpoDataSource()
    {
        ConnectionStringName = "northwind"
    };
    dataSource.SetEntityType(typeof(nwind.Customers));
    return dataSource;
}
See Also