This document describes the capability to provide a Web Dashboard with a set of default data sources, which will be available for end-users.
To achieve this goal, create the required data sources at runtime. You can use the following data source types.
After you create the required data sources, register them in a storage of data sources using the ASPxDashboard.SetDataSourceStorage or DashboardConfigurator.SetDataSourceStorage method (the selected method depends on the used server-side API).
The following code snippet shows how to create the in-memory storage of data sources for the Web Designer.
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-create-a-web-dashboard-designer-application-t362490.
DashboardSqlDataSource sqlDataSource = new DashboardSqlDataSource("SQL Data Source", "sqlConnection"); SelectQuery countriesQuery = SelectQueryFluentBuilder .AddTable("Countries") .SelectColumns("Country", "Latitude", "Longitude", "Year", "EnergyType", "Production", "Import") .Build("Countries"); sqlDataSource.Queries.Add(countriesQuery); DashboardOlapDataSource olapDataSource = new DashboardOlapDataSource("OLAP Data Source", "olapConnection"); DataSourceInMemoryStorage dataSourceStorage = new DataSourceInMemoryStorage(); dataSourceStorage.RegisterDataSource("sqlDataSource1", sqlDataSource.SaveToXml()); dataSourceStorage.RegisterDataSource("olapDataSource1", olapDataSource.SaveToXml()); ASPxDashboard1.SetDataSourceStorage(dataSourceStorage);
The Web Dashboard saves user credentials used by data sources to the dashboard XML definition. You can set whether or not this information will be passed to the client side (web browser) using the boolean DashboardConfigurator.PassCredentials property. To avoid any security issues, set this property to false and provide connection parameters in one of the following ways.