DetailView.UseAsyncLoading Field
Specifies whether the IModelAsync.UseAsyncLoading property is visible in the Model Editor.
Namespace: DevExpress.ExpressApp
Assembly: DevExpress.ExpressApp.v24.2.dll
NuGet Package: DevExpress.ExpressApp
Declaration
Field Value
Type | Description |
---|---|
Boolean | true, if the IModelAsync.UseAsyncLoading property is visible in the Model Editor; otherwise, false. |
Remarks
When asynchronous data loading is enabled, only the current object of a Detail View is loaded asynchronously, its associated collections are loaded in the main thread and this locks the UI. Enable this feature only if current object loading causes performance issues because of complex logic or a remote database.
The following example shows how to specify this static field to show the UseAsyncLoading property in the Model Editor.
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Win;
// ...
public partial class MySolutionWindowsFormsApplication : WinApplication {
// ...
public MySolutionWindowsFormsApplication() {
DetailView.UseAsyncLoading = true;
// ...
}
}
The Solution Wizard enables the UseAsyncLoading
property in new projects. For this purpose, the wizard generates new projects with the FrameworkSettings.DefaultSettingsCompatibilityMode property set to Latest
.
If DetailView.UseAsyncLoading
is set to true, note the following:
- when IModelAsync.UseAsyncLoading is true, the DetailView.CurrentObject property is set to null in the Controller.OnActivate method;
- when you open a Detail View from the Navigation, the DetailViewCreatingEventArgs.Obj argument of the ViewCreating and DetailViewCreating events is set to null;
- when you open a Detail View from a List View (by double-clicking a record or using the OpenObject Action), the DetailViewCreatingEventArgs.Obj argument of the ViewCreating and DetailViewCreating events is set to the object from the List View’s Object Space;
- when IModelAsync.UseAsyncLoading is true and you use DetailView.ObjectSpace before the Detail View’s object is initialized (for example, in Controller.OnActivated), an exception occurs. Move the logic that depends on this property to the CurrentObjectChanged handler.
Refer to the Asynchronous Data Loading topic for more information.
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the UseAsyncLoading field.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.