expressappframework-117720-analytics-dashboards-dashboard-performance-with-large-data-sources.md
This topic lists recommendations you can use to improve performance and reduce memory consumption. You may need to use these techniques when a dashboard is bound to a large collection of objects and has performance issues.
Note
ASP.NET Core Blazor applications do not support this technique.
If you do not need to load the entire data set to the Dashboard Designer, you can use the DashboardDataProvider.TopReturnedRecordsInDesigner property to limit the number of loaded objects. To access the DashboardDataProvider object, use the static DashboardsModule.DataProvider property. The following example demonstrates how to set the TopReturnedRecordsInDesigner property in the platform-agnostic module‘s constructor:
File : MySolution.Module\Module.cs.
using DevExpress.ExpressApp.Dashboards;
// ...
public sealed partial class MySolutionModule : ModuleBase {
// ...
public MySolutionModule() {
// ...
DashboardsModule.DataProvider.TopReturnedRecordsInDesigner = 100;
}
// ...
}
When you perform a data-aware operation in the WinForms Dashboard Designer, the dashboard sends a query to a data source and updates itself automatically according to the returned data. It can take a significant amount of time to update the dashboard according to each change. In this case, you can disable automatic updates and update the dashboard manually when needed. For more information, refer to the following help topic: Automatic and Manual Updates.
When you filter the dashboard data source, the criteria is applied server side. This allows you to reduce the amount of loaded data. Refer to the following help topics for instructions on how to apply filters:
Windows Forms
ASP.NET Core Blazor
Note
Entity Framework Core does not support DataView mode.
Follow the steps below to retrieve a lightweight read-only list of data records instead of loading the collection of persistent objects.
Inherit from the DashboardDataProvider class and override its CreateViewService method:
Use the static DashboardsModule.DataProvider property to register the custom dashboard data provider in the platform-agnostic module‘s constructor:
Note
You cannot use DataView mode in the following situations:
In ASP.NET Core Blazor applications, you cannot enable DataView mode for a specific dashboard, but you can do it globally for all dashboards. See the following code snippet for an example:
File : MySolution.Blazor.Server\Startup.cs.
using DevExpress.ExpressApp.Dashboards.Blazor.Services;
// ...
public class Startup {
// ...
public void ConfigureServices(IServiceCollection services) {
// ...
services.AddXaf(Configuration, builder => {
// ...
builder.Modules
.AddDashboards(options => {
// ...
options.SetupDashboardConfigurator = (dashboardConfigurator, serviceProvider) => {
dashboardConfigurator.SetObjectDataSourceCustomFillService(new BlazorDashboardViewDataSourceFillService(serviceProvider));
};
})
// ...
}
// ...
}
// ...
}
You can use SQL Data Source instead of XAF Object Data Source when you create a dashboard. This data source allows you to access data directly and bypass Object Space and the ORM data layer. In most cases, this improves performance. The following help topic demonstrates how to use this data source in ASP.NET Core Blazor applications: Use SQL Data Sources (ASP.NET Core Blazor).
Note the following limitations when you use this technique: