Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+

Dashboard Performance With Large Data Sources

  • 4 minutes to read

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.

Limit the Number of Objects Loaded in the Dashboard Designer

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 (Module.vb).

using DevExpress.ExpressApp.Dashboards;
// ...
public sealed partial class MySolutionModule : ModuleBase {
    // ...
    public MySolutionModule() {
        // ...
        DashboardsModule.DataProvider.TopReturnedRecordsInDesigner = 100;
    }
    // ...
}

Disable Automatic Updates in the WinForms Dashboard Designer

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.

Filter Data

When you filter the dashboard data source, the criteria is applied on the server side. This allows you to reduce the amount of loaded data. Refer to the following help topics to learn how to apply filters:

WinForms

ASP.NET Web Forms and ASP.NET Core Blazor

Use DataView Mode

Note

Entity Framework Core does not support DataView mode.

WinForms and ASP.NET Web Forms

Follow the steps below to retrieve a lightweight read-only list of data records instead of loading the collection of persistent objects.

  1. Inherit the DashboardDataProvider class and override its CreateViewService method:

    File: MySolution.Module\CustomDashboardDataProvider.cs (.vb).

    using DevExpress.DashboardCommon;
    using DevExpress.ExpressApp.Dashboards;
    using DevExpress.Persistent.Base;
    // ...
    public class CustomDashboardDataProvider : DashboardDataProvider {
        protected override IObjectDataSourceCustomFillService CreateViewService(IDashboardData dashboardData) {
            if(dashboardData.Title == "Sales Overview") {
                return new DashboardViewDataSourceFillService();
            }
            return base.CreateViewService(dashboardData);
        }
    }
    
  2. Use the static DashboardsModule.DataProvider property to register the custom dashboard data provider in the platform-agnostic module‘s constructor:

    File: MySolution.Module\Module.cs (Module.vb).

    using DevExpress.ExpressApp.Dashboards;
    // ...
    public sealed partial class MySolutionModule : ModuleBase {
        // ...
        public MySolutionModule() {
            // ...
            DashboardsModule.DataProvider = new CustomDashboardDataProvider();
        }
        // ...
    }
    

ASP.NET Core Blazor

In ASP.NET Core Blazor applications, you cannot enable DataView mode for a specific dashboard, but you can do it globally for all dashboards. Follow the steps below to enable DataView mode in your application:

  1. In the AddXafDashboards extension method, access BlazorDashboardConfigurator.
  2. Create an instance of the BlazorDashboardViewDataSourceFillService class and pass it to the BlazorDashboardConfigurator.SetObjectDataSourceCustomFillService method.

File: MySolution.Blazor.Server\Startup.cs.

using DevExpress.ExpressApp.Dashboards.Blazor;
using DevExpress.ExpressApp.Dashboards.Blazor.Utils;
// ...
public class Startup {
    // ...
    public void ConfigureServices(IServiceCollection services) {
        // ...
        services.AddXafDashboards((dashboardConfigurator, services) => {
            IXafApplicationProvider applicationProvider = services.GetRequiredService<IXafApplicationProvider>();
            var fillService = new BlazorDashboardViewDataSourceFillService(applicationProvider) {
                AllowObjectSpaceDisposing = true
            };
            dashboardConfigurator.SetObjectDataSourceCustomFillService(fillService);
        });
    }
    // ...
}

Use the SQL Data Source

You can use the SQL Data Source instead of the XAF Object Data Source when you create a dashboard. This data source allows you to access data directly and bypass the Object Space and the ORM data layer. In most cases, this improves the performance. The following help topic demonstrates how to use the SQL Data Source in ASP.NET Core Blazor applications: Customize the Dashboard Configurator.

Note the following limitations when you use this technique: