All docs
V20.1
20.1
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

Asynchronous Data Loading (CTP)

  • 3 minutes to read

This article describes how to load View data asynchronously in WinForms applications. This capability allows you to keep the UI responsive while the application fetches required data. End-users can navigate to another View while the operation is in progress. They can also close the tab before the View loads all data, which would then cancel the data loading operation.

Prerequisites

This feature works only in WinForms applications that use ThreadSafeDataLayer. To use this data layer in your application, follow the steps below.

  1. Open the WinApplication.cs (WinApplication.vb) file and locate the CreateDefaultObjectSpaceProvider method.
  2. Pass true as the threadSafe parameter of the XPObjectSpaceProvider/SecuredObjectSpaceProvider constructor.
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Win;
using DevExpress.ExpressApp.Xpo;
// ...
public partial class MySolutionWindowsFormsApplication : WinApplication {
    // ...
    protected override void CreateDefaultObjectSpaceProvider(CreateCustomObjectSpaceProviderEventArgs args) {
        args.ObjectSpaceProviders.Add(new XPObjectSpaceProvider(
            XPObjectSpaceProvider.GetDataStoreProvider(args.ConnectionString, args.Connection, true), true));
        // ...
    }
}

You can enable this feature for Views that fit all the conditions below.

     List View

     Detail View

Enable Asynchronous Loading

Set the UseAsyncLoading property to true. The following Model Editor nodes allow you to specify this property for supported Views.

  • Navigate to the Options node to enable this feature for all Views in your application. The value you specified in this node is the default for UseAsyncLoading in the View-specific nodes.

  • Navigate to the Views | <ListView> node to enable this feature for a particular List View.

  • Navigate to the Views | <DetailView> node to enable this feature for a Detail View.

Important Notes (Detail Views)

Detail Views always load associated collections in the main thread. These operations lock the UI. If you enable the UseAsyncLoading option, the View loads only its current object asynchronously. In other words, this option only helps you resolve high load times for the current object (for example, when this object has properties with complex logic or you use a remote database).

If DetailView.UseAsyncLoading is set to true, note the following:

See Also