-
Notifications
You must be signed in to change notification settings - Fork 1
/
DashboardConfig.cs
25 lines (22 loc) · 1.18 KB
/
DashboardConfig.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using DevExpress.DashboardCommon;
using DevExpress.DashboardWeb;
using DevExpress.DashboardWeb.Mvc;
using DevExpress.DataAccess.Web;
using System.Web.Routing;
namespace MVCDashboard {
public static class DashboardConfig {
public static void RegisterService(RouteCollection routes) {
routes.MapDashboardRoute("api/dashboard", "DefaultDashboard");
DashboardConfigurator.Default.SetConnectionStringsProvider(new ConfigFileConnectionStringsProvider());
DashboardConfigurator.Default.SetDashboardStorage(new DashboardFileStorage(@"~/App_Data/Dashboards"));
DashboardConfigurator.Default.SetDataSourceStorage(CreateDataSourceStorage());
}
public static DataSourceInMemoryStorage CreateDataSourceStorage() {
DataSourceInMemoryStorage dataSourceStorage = new DataSourceInMemoryStorage();
DashboardObjectDataSource objDataSource = new DashboardObjectDataSource("ObjectDataSource", typeof(ProductSales));
objDataSource.DataMember = "GetProductSales";
dataSourceStorage.RegisterDataSource("objectDataSource", objDataSource.SaveToXml());
return dataSourceStorage;
}
}
}