The requested page is not available for the requested platform. You are viewing the content for Default platform.

DashboardObjectDataSource Class

An object data source that provides data for the dashboard.

Namespace: DevExpress.DashboardCommon

Assembly: DevExpress.Dashboard.v19.1.Core.dll

Declaration

[DataAccessMetadata("All", SupportedProcessingModes = "Simple", EnableBindingToObjectDataSource = true)]
public class DashboardObjectDataSource :
    ObjectDataSource,
    IDashboardDataSource,
    IDashboardComponent,
    IComponent,
    IDisposable,
    ISupportInitialize,
    ISupportPrefix,
    IDashboardDataSourceInternal,
    IExternalSchemaConsumer,
    IFederationDataProvider,
    IFederationDataSchemaProvider
<DataAccessMetadata("All", SupportedProcessingModes:="Simple", EnableBindingToObjectDataSource:=True)>
Public Class DashboardObjectDataSource
    Inherits ObjectDataSource
    Implements IDashboardDataSource,
               IDashboardComponent,
               IComponent,
               IDisposable,
               ISupportInitialize,
               ISupportPrefix,
               IDashboardDataSourceInternal,
               IExternalSchemaConsumer,
               IFederationDataProvider,
               IFederationDataSchemaProvider

Remarks

To provide data for the DashboardObjectDataSource, assign the type of the required class to the ObjectDataSource.DataSource property and set the ObjectDataSource.DataMember property specifying the data member used to obtain the required data. Use the ObjectDataSource.Fill method to retrieve the data from the object data source.

Raise the DataLoading events to supply the dashboard with actual data at runtime:

Note that an object providing the required data should implement the IEnumerable or IListSource interface.

To learn more, see ObjectDataSource.

You can use the custom fill service (IObjectDataSourceCustomFillService to get access to the DashboardObjectDataSource data (data fields used in a dashboard, the filter expression, parameters and their actual values) and use it in the current data query.

Note that the IObjectDataSourceCustomFillService is executed if you use typeof() to specify the ObjectDataSource.DataSource property:

DashboardObjectDataSource objDataSource = new DashboardObjectDataSource("Object Data Source", typeof(SalesPersonData));

Examples

The following example demonstrates how to bind a dashboard to a List object.

In this example, information about the sold units quantity is provided at runtime. The dashboard data source is added to the Dashboard.DataSources collection on the first load.

To update the displayed data, the DashboardViewer.ReloadData method is called. This raises the DashboardViewer.DataLoading event and allows supplying the dashboard with updated data.

using System;
using System.Collections.Generic;
using System.Threading;

namespace Dashboard_BindingToList {
    public class Data {
        public string SalesPerson { get; set; }
        public int Quantity { get; set; }

        public static List<Data> CreateData() {
            List<Data> data = new List<Data>();
            string[] salesPersons = { "Andrew Fuller", "Michael Suyama", "Robert King", "Nancy Davolio",
                "Margaret Peacock", "Laura Callahan", "Steven Buchanan", "Janet Leverling" };

            for (int i = 0; i < 100; i++) {
                Data record = new Data();
                int seed = (int)DateTime.Now.Ticks & 0x0000FFFF;
                record.SalesPerson = salesPersons[new Random(seed).Next(0, salesPersons.Length)];
                record.Quantity = new Random(seed).Next(0, 100);
                data.Add(record);
                Thread.Sleep(3);
            }
            return data;
        }
    }
}

Inheritance

Object
MarshalByRefObject
Component
DevExpress.DataAccess.DataComponentBase
ObjectDataSource
DashboardObjectDataSource
See Also