Skip to main content

MvcBuilderExtension.AddDefaultDashboardController(IMvcBuilder, Action<DashboardConfigurator>) Method

OBSOLETE

Use dependency injection to add DashboardConfigurator to services directly.

Adds the dashboard controller and provides access to the DashboardConfigurator settings.

Namespace: DevExpress.DashboardAspNetCore

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

Declaration

[Obsolete("Use dependency injection to add DashboardConfigurator to services directly.")]
public static IMvcBuilder AddDefaultDashboardController(
    this IMvcBuilder mvcBuilder,
    Action<DashboardConfigurator> configure
)

Parameters

Name Type Description
mvcBuilder IMvcBuilder

An interface for configuring MVC services.

configure Action<DashboardConfigurator>

A delegate that provides access to the DashboardConfigurator settings.

Returns

Type Description
IMvcBuilder

An interface for configuring MVC services.

Remarks

From v21.2, this method is obsolete due to security reason. Use dependency injection instead.

Register the DashboardConfigurator as a service based on your requirements. The AddSingleton method registers the DashboardConfigurator service with the same service lifetime as AddDefaultDashboardController. However, we recommend that you use the AddScoped method as it can be used in more cases (for example, security-based scenarios like multi-tenancy dashboards).

services.AddScoped<DashboardConfigurator>((IServiceProvider serviceProvider) => {
    DashboardConfigurator configurator = new DashboardConfigurator();
    // content   
    return configurator;
});

More information: Breaking Change T1018632: Web Dashboard - The DashboardController class became abstract.

See Also