Skip to main content
A newer version of this page is available. .

DashboardEFDataSource Class

An Entity Framework data source that provides data for the dashboard.

Namespace: DevExpress.DashboardCommon

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

NuGet Package: DevExpress.Dashboard.Core

Declaration

public class DashboardEFDataSource :
    EFDataSource,
    IDashboardDataSource,
    IDashboardComponent,
    IComponent,
    IDisposable,
    ISupportInitialize,
    ISupportPrefix,
    IDashboardDataSourceInternal,
    IExternalSchemaConsumer,
    IFederationDataProvider

Remarks

Depending on whether the Entity Framework model is added to the current project or is contained in an external assembly, you can create the DashboardEFDataSource data source in two ways.

Use the EFDataSource.Fill method to retrieve data from the data source.

Note

DashboardEFDataSource supports the following Entity Framework versions:

  • Entity Framework 5.0 and higher.
  • Entity Framework Core 1.0 and higher.

Note that the Entity Framework context class passed to an EFConnectionParameters.Source should be public.

Note

To connect to different database types using DashboardEFDataSource, you need to install a corresponding data provider. For instance, install the System.Data.SQLite.EF6 data provider to connect to an SQLite database using Entity Framework 6.

Example

The following example demonstrates how to bind a dashboard to the SQLite database using Entity Framework 6.

In this example, the DashboardEFDataSource class is used to connect the dashboard to the Entity Framework data source.

View Example

namespace Dashboard_EntityFramework {
    using System;
    using System.Data.Entity;

    public partial class OrdersContext : DbContext {
        public OrdersContext()
            : base("name=OrdersContext") {
        }
        public virtual DbSet<Order> Orders { get; set; }
    }

    public partial class Order {
        public long OrderID { get; set; }
        public string CustomerID { get; set; }
        public long? EmployeeID { get; set; }
        public DateTime? OrderDate { get; set; }
        public DateTime? RequiredDate { get; set; }
        public DateTime? ShippedDate { get; set; }
        public long? ShipVia { get; set; }
        public decimal? Freight { get; set; }
        public string ShipName { get; set; }
        public string ShipAddress { get; set; }
        public string ShipCity { get; set; }
        public string ShipRegion { get; set; }
        public string ShipPostalCode { get; set; }
        public string ShipCountry { get; set; }
    }
}
See Also