What Changed
ASP.NET Core:
- The
DevExpress.DashboardAspNetCore.DashboardController
class became abstract. - The following overloads of the EndpointRouteBuilderExtension.MapDashboardRoute and RouteBuilderExtension.MapDashboardRoute methods without the
controllerName
parameter became obsolete and will cause the error:EndpointRouteBuilderExtension.RouteCollectionExtension.MapDashboardRoute(this RouteCollection routes)
EndpointRouteBuilderExtension.RouteCollectionExtension.MapDashboardRoute(this RouteCollection routes, string routePrefix)
RouteBuilderExtension.MapDashboardRoute(this IRouteBuilder routes)
RouteBuilderExtension.MapDashboardRoute(this IRouteBuilder routeBuilder, string routePrefix)
- The exception occurs if the ControllerName or DashboardBackendOptionsBuilder.Uri properties are not specified.
- The MvcBuilderExtension.AddDefaultDashboardController method became obsolete.
ASP.NET MVC:
- The
DevExpress.DashboardWeb.Mvc.DashboardController
class became abstract. - The following overloads of the RouteCollectionExtension.MapDashboardRoute method without the
controllerName
parameter became obsolete and will cause the error:DevExpress.DashboardWeb.Mvc.RouteCollectionExtension.MapDashboardRoute(this RouteCollection routes)
DevExpress.DashboardWeb.Mvc.RouteCollectionExtension.MapDashboardRoute(this RouteCollection routes, string routePrefix)
- The exception occurs if the ControllerName or DashboardBackendOptionsBuilder.Uri properties are not specified.
Reasons for Change
We made the class abstract to reduce possible security issues.
Impact on Existing Apps
Your application will crash if you use the default dashboard controller and call the MapDashboardRoute
methods without the controllerName
parameter.
Affected Apps
This breaking change will affect your ASP.NET Core application if:
- You call the
EndpointRouteBuilderExtension.MapDashboardRoute
orRouteBuilderExtension.MapDashboardRoute
methods without thecontrollerName
parameter. - The ASP.NET Core Dashboard control is used without specifying the ControllerName or Uri properties.
This breaking change will affect your ASP.NET MVC application if:
- You call the
RouteCollectionExtension.MapDashboardRoute
method without thecontrollerName
parameter. - The ASP.NET MVC Dashboard extension is used without specifying the ControllerName or Uri properties.
This breaking change will not affect your application if:
- You create and use a custom controller (a
DashboardController
descendant). This custom controller is used in theMapDashboardRoute
methods.
How to Update Existing Apps
Applications that use the ASP.NET Core Dashboard Backend (Angular, React, Vue, JavaScript Applications, Blazor)
-
Add a custom dashboard controller to your backend. Create a new
DashboardController
descendant and implement the required logic.C#using DevExpress.DashboardAspNetCore; using DevExpress.DashboardWeb; using Microsoft.AspNetCore.DataProtection; // ... public class DefaultDashboardController : DashboardController { public DefaultDashboardController(DashboardConfigurator configurator, IDataProtectionProvider dataProtectionProvider = null) : base(configurator, dataProtectionProvider) { } }
-
Pass the created controller's name (
DefaultDashboard
) to theMapDashboardRoute
method..NET Core 3.1 and above:
C#EndpointRouteBuilderExtension.MapDashboardRoute(endpoints, "api/dashboard", "DefaultDashboard");
.NET Core 2.1:
C#routes.MapDashboardRoute("api/dashboard", "DefaultDashboard");
-
Get rid of the
AddDefaultDashboardController
method and use dependency injection instead. Register theDashboardConfigurator
as a service based on your requirements. TheAddSingleton
method registers theDashboardConfigurator
service with the same service lifetime asAddDefaultDashboardController
. However, we recommend that you use theAddScoped
method as it can be used in more cases (for example, security-based scenarios like multi-tenancy dashboards).Old:
C#services .AddControllersWithViews() .AddDefaultDashboardController((IServiceProvider serviceProvider) => { // content });
New:
C#services.AddScoped<DashboardConfigurator>((IServiceProvider serviceProvider) => { DashboardConfigurator configurator = new DashboardConfigurator(); // content return configurator; });
-
If you use the default route (
dashboardDesigner
) generated from theMapDashboardRoute
method overload without parameters, you also need to update theendpoint
option of your DashboardComponent on the client based on the value you pass to theMapDashboardRoute
method.
ASP.NET Core
-
Create a new
DashboardController
descendant and implement the required logic to create a custom dashboard controller.C#using DevExpress.DashboardAspNetCore; using DevExpress.DashboardWeb; using Microsoft.AspNetCore.DataProtection; ... public class DefaultDashboardController : DashboardController { public DefaultDashboardController(DashboardConfigurator configurator, IDataProtectionProvider dataProtectionProvider = null) : base(configurator, dataProtectionProvider) { } }
-
Pass the created controller's name (
DefaultDashboard
) to theMapDashboardRoute
method.NET Core 3.1 and above:
C#EndpointRouteBuilderExtension.MapDashboardRoute(endpoints, "api/dashboard", "DefaultDashboard");
NET Core 2.1:
C#routes.MapDashboardRoute("api/dashboard", "DefaultDashboard");
-
Specify the
ControllerName
property for all Web Dashboard extensions (Html.DevExpress().Dashboard
):Razor@(Html.DevExpress().Dashboard("ASPNETCoreDashboard") .ControllerName("DefaultDashboard") // ... )
-
Get rid of the
AddDefaultDashboardController
method and use dependency injection instead. Register theDashboardConfigurator
as a service based on your requirements. TheAddSingleton
method registers theDashboardConfigurator
service with the same service lifetime asAddDefaultDashboardController
. However, we recommend that you use theAddScoped
method as it can be used in more cases (for example, security-based scenarios like multi-tenancy dashboards).Old:
C#services .AddControllersWithViews() .AddDefaultDashboardController((IServiceProvider serviceProvider) => { // content });
New:
C#services.AddScoped<DashboardConfigurator>((IServiceProvider serviceProvider) => { DashboardConfigurator configurator = new DashboardConfigurator(); // content return configurator; });
ASP.NET MVC Extension
-
Create a new
DashboardController
descendant and implement the required logic to create a custom dashboard controller.C#using DevExpress.DashboardWeb.Mvc; public class DefaultDashboardController : DashboardController { // ... }
Visual BasicImports DevExpress.DashboardWeb.Mvc Public Class DefaultDashboardController Inherits DashboardController ' ... End Class
-
Pass the created controller's name (
DefaultDashboard
) to theMapDashboardRoute
method.C#routes.MapDashboardRoute("dashboardControl", "DefaultDashboard");
Visual Basicroutes.MapDashboardRoute("dashboardControl", "DefaultDashboard")
-
Specify the
ControllerName
property for all Web Dashboard extensions (Html.DevExpress().Dashboard
):C#:
Razor@Html.DevExpress().Dashboard(settings => { settings.Name = "MVCxDashboard"; settings.ControllerName = "DefaultDashboard"; // ... }).GetHtml()
Visual Basic:
Razor@Html.DevExpress().Dashboard(Sub(settings) settings.Name = "Dashboard" settings.ControllerName = "DefaultDashboard" ' ... End Sub).GetHtml()
How to Revert to the Previous Behavior
You cannot revert to the previous behavior.