dashboard-400562-web-dashboard-integrate-dashboard-component-dashboard-backend-prepare-data-source-storage-for-the-aspnet-core-framework-olap-data-source.md
This topic shows how to add the DashboardOlapDataSource to an in-memory data source storage, and make it available to users.
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 NuGet package.
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;
}
}
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 bind dashboard items to data in the Web Dashboard’s UI.
Users can use the Dashboard Data Source Wizard to create a new OLAP data source based on an existing connection.
See the following topic for details: Specify Data Source Settings (OLAP).
The example shows how to make a set of data sources available for users in the Web Dashboard application.