The requested page is not available for the requested platform. You are viewing the content for Default platform.

MvcBuilderExtension Class

An MVC builder that adds the dashboard controller and provides access to the DashboardConfigurator settings.

Namespace: DevExpress.DashboardAspNetCore

Assembly: DevExpress.Dashboard.v19.1.AspNetCore.dll

Declaration

public static class MvcBuilderExtension
Public Module MvcBuilderExtension

Remarks

The following code snippet demonstrate how to configure the DashboardConfigurator settings:

 public void ConfigureServices(IServiceCollection services) {
    services
        .AddMvc()
        .AddDefaultDashboardController((configurator, serviceProvider)  => {
            configurator.SetConnectionStringsProvider(new DashboardConnectionStringsProvider(Configuration));

            DashboardFileStorage dashboardFileStorage = new DashboardFileStorage(FileProvider.GetFileInfo("Data/Dashboards").PhysicalPath);
            configurator.SetDashboardStorage(dashboardFileStorage);

            DataSourceInMemoryStorage dataSourceStorage = new DataSourceInMemoryStorage();

            // Registers an Object data source.
            DashboardObjectDataSource objDataSource = new DashboardObjectDataSource("Object Data Source");
            dataSourceStorage.RegisterDataSource("objDataSource", objDataSource.SaveToXml());            

            configurator.SetDataSourceStorage(dataSourceStorage);

            configurator.DataLoading += (s, e) => {
                if(e.DataSourceName == "Object Data Source") {
                    e.Data = Invoices.CreateData();
                }
            };
        });

    services.AddDevExpressControls(options => options.Resources = ResourcesType.ThirdParty | ResourcesType.DevExtreme);
}

Inheritance

Object
MvcBuilderExtension
See Also