Example #1
0
        public static void RegisterService(RouteCollection routes)
        {
            routes.MapDashboardRoute("dashboardControl", "DefaultDashboard");
            // Configure a dashboard storage:
            DashboardFileStorage dashboardFileStorage = new DashboardFileStorage("~/App_Data/Dashboards");

            DashboardConfigurator.Default.SetDashboardStorage(dashboardFileStorage);

            // Configure a data source storage:
            DataSourceInMemoryStorage dataSourceStorage = new DataSourceInMemoryStorage();

            SqlDataSourceConfigurator.ConfigureDataSource(dataSourceStorage);
            ExcelDataSourceConfigurator.ConfigureDataSource(DashboardConfigurator.Default, dataSourceStorage);
            ObjectDataSourceConfigurator.ConfigureDataSource(DashboardConfigurator.Default, dataSourceStorage);
            EFDataSourceConfigurator.ConfigureDataSource(dataSourceStorage);
            JsonDataSourceConfigurator.ConfigureDataSource(DashboardConfigurator.Default, dataSourceStorage);
            ExtractDataSourceConfigurator.ConfigureDataSource(DashboardConfigurator.Default, dataSourceStorage);
            OlapDataSourceConfigurator.ConfigureDataSource(DashboardConfigurator.Default, dataSourceStorage);
            XpoDataSourceConfigurator.ConfigureDataSource(dataSourceStorage);

            DashboardConfigurator.Default.SetDataSourceStorage(dataSourceStorage);

            // Uncomment the next line to allow users to create new data sources based on predefined connection strings.
            // DashboardConfigurator.Default.SetConnectionStringsProvider(new DevExpress.DataAccess.Web.ConfigFileConnectionStringsProvider());
        }
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc();
            services.AddScoped <DashboardConfigurator>((IServiceProvider serviceProvider) => {
                DashboardConfigurator configurator = new DashboardConfigurator();

                // Create and configure a dashboard storage.
                DashboardFileStorage dashboardFileStorage = new DashboardFileStorage(FileProvider.GetFileInfo("Data/Dashboards").PhysicalPath);
                configurator.SetDashboardStorage(dashboardFileStorage);

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

                SqlDataSourceConfigurator.ConfigureDataSource(dataSourceStorage);
                ExcelDataSourceConfigurator.ConfigureDataSource(configurator, dataSourceStorage, FileProvider);
                ObjectDataSourceConfigurator.ConfigureDataSource(configurator, dataSourceStorage);
                EFDataSourceConfigurator.ConfigureDataSource(dataSourceStorage);
                JsonDataSourceConfigurator.ConfigureDataSource(configurator, dataSourceStorage, FileProvider);
                ExtractDataSourceConfigurator.ConfigureDataSource(configurator, dataSourceStorage, FileProvider);
                OlapDataSourceConfigurator.ConfigureDataSource(configurator, dataSourceStorage);
                XpoDataSourceConfigurator.ConfigureDataSource(dataSourceStorage);

                configurator.SetDataSourceStorage(dataSourceStorage);

                // Uncomment the next line to allow users to create new data sources based on predefined connection strings.
                // configurator.SetConnectionStringsProvider(new DashboardConnectionStringsProvider(Configuration));

                return(configurator);
            });

            services.AddDevExpressControls();
        }