Skip to main content

OLAP Data Source in ASP.NET Core

  • 2 minutes to read

This topic shows how to add the DashboardOlapDataSource to an in-memory data source storage, and make it available to users.

Prerequisites

The ASP.NET Core Dashboard control supports the following data providers in OLAP mode:

Use the OlapDataProvider property to specify the data provider.

To use the ADOMD.NET data provider, install the Microsoft.AnalysisServices.AdomdClient.NetCore.retail.amd64 NuGet package.

Create an OLAP Data Source in Code

Create a Data Source

To create an OLAP data source, follow the steps below:

using DevExpress.DashboardCommon;
using DevExpress.DashboardWeb;
using DevExpress.DataAccess.ConnectionParameters;

DashboardOlapDataSource olapDataSource = new DashboardOlapDataSource("OLAP Data Source", "olapConnection");

configurator.ConfigureDataConnection += Configurator_ConfigureDataConnection;

static void Configurator_ConfigureDataConnection(object sender, ConfigureDataConnectionWebEventArgs e) {
    if (e.ConnectionName == "olapConnection") {
        OlapConnectionParameters olapParams = new OlapConnectionParameters();
        olapParams.ConnectionString = "Provider=MSOLAP;Data Source=http://demos.devexpress.com/Services/OLAP/msmdpump.dll;"
            + "Initial catalog=Adventure Works DW Standard Edition;Cube name=Adventure Works;Query Timeout=100;";
        e.ConnectionParameters = olapParams;
    }
}

Register the Data Source in the Storage

Call the DataSourceInMemoryStorage.RegisterDataSource method to register the data source in the data source storage. Call the DashboardConfigurator.SetDataSourceStorage method to specify the data source storage for the Web Dashboard.

// Create a data source storage.
DataSourceInMemoryStorage dataSourceStorage = new DataSourceInMemoryStorage();

// Register the OLAP data source.
dataSourceStorage.RegisterDataSource("olapDataSource", olapDataSource.SaveToXml());

// Register the storage for the Web Dashboard.
configurator.SetDataSourceStorage(dataSourceStorage);

The OLAP Data Source is now available in the Web Dashboard:

Users can now bind dashboard items to data in the Web Dashboard’s UI.

Create an OLAP Data Source in the UI

Users can use the Dashboard Data Source Wizard to create a new OLAP data source based on an existing connection.

web-dashboard-data-source-wizard-OLAP

See the following topic for details: Specify Data Source Settings (OLAP).

Example: How to Register Data Sources for ASP.NET Core Dashboard Control

The example shows how to make a set of data sources available for users in the Web Dashboard application.

View Example