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

Connect the ASP.NET Core Dashboard to an Extract Data Source

The example below shows how to create an extract data source in code to make it available for end users.

  1. In your application, create the Data folder and add the SalesOverview.dat file to it from the following folder:

    C:\Users\Public\Documents\DevExpress Demos 19.1\Components\Data

  2. In the Startup.cs file, create a public method that returns a configured in-memory dashboard data source storage (DataSourceInMemoryStorage) and define the extract data source.

    using DevExpress.DashboardCommon;
    public DataSourceInMemoryStorage CreateDataSourceStorage() {
        DataSourceInMemoryStorage dataSourceStorage = new DataSourceInMemoryStorage();
        DashboardExtractDataSource extractDataSource = new DashboardExtractDataSource("Extract Data Source");
              extractDataSource.Name = "Extract Data Source";
              extractDataSource.FileName = Path.Combine(HostingEnvironment.ContentRootPath, @"Data\SalesOverview.dat");
              dataSourceStorage.RegisterDataSource("extractDataSource ", extractDataSource.SaveToXml());
        return dataSourceStorage;

    Use the IHostingEnvironment.ContentRootPath property to set the absolute path to the directory that contains the Extract data source.

  3. Use the DashboardConfigurator.SetDataSourceStorage method to set the data source storage and pass the created CreateDataSourceStorage method to use the return value as a parameter.

    using DevExpress.AspNetCore;
    using DevExpress.DashboardAspNetCore;
    using DevExpress.DashboardWeb;
    public void ConfigureServices(IServiceCollection services) {            
            .AddDefaultDashboardController(configurator => {
                // ...
  4. As a result, the Extract Data Source is displayed as a Web Dashboard's predefined data source.


    End users can now bind the dashboard items to data in the Web Dashboard's UI. To learn more, see Binding Dashboard Items to Data in the Web Dashboard's UI.