StartupExtensions.AddXafDashboards(IServiceCollection, Action<BlazorDashboardConfigurator, IServiceProvider>) Method
Registers the required Dashboards Module services in the application’s IServiceCollection.
Namespace: DevExpress.ExpressApp.Dashboards.Blazor
Assembly: DevExpress.ExpressApp.Dashboards.Blazor.v24.1.dll
NuGet Package: DevExpress.ExpressApp.Dashboards.Blazor
Declaration
public static IServiceCollection AddXafDashboards(
this IServiceCollection services,
Action<BlazorDashboardConfigurator, IServiceProvider> configure = null
)
Parameters
Name | Type | Description |
---|---|---|
services | IServiceCollection | The collection of services registered in your application. |
Optional Parameters
Name | Type | Default | Description |
---|---|---|---|
configure | Action<BlazorDashboardConfigurator, IServiceProvider> | null | A delegate that allows you to customize the BlazorDashboardConfigurator settings. |
Returns
Type | Description |
---|---|
IServiceCollection | The collection of services registered in your application. Allows you to chain further service registrations. |
Remarks
Call this method in the Startup.ConfigureServices method when you add the Dashboards Module to your ASP.NET Core Blazor application. The following example demonstrates how to specify a connection string provider to allow users to create new SQL data sources based on connection strings from the MySolution.Blazor.Server\appsettings.json file:
using DevExpress.ExpressApp.Dashboards.Blazor;
// ...
public class Startup {
// ...
public void ConfigureServices(IServiceCollection services){
//...
services.AddXafDashboards((dashboardConfigurator, services) => {
var configuration = services.GetRequiredService<IConfiguration>();
dashboardConfigurator.SetConnectionStringsProvider(new DashboardConnectionStringsProvider(configuration));
});
// ...
}
// ...
}