Skip to main content
.NET 8.0+

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

XafApplication.DatabaseUpdateMode Property

Specifies the database update mode.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v24.2.dll

NuGet Package: DevExpress.ExpressApp

#Declaration

[Browsable(false)]
[DefaultValue(DatabaseUpdateMode.UpdateOldDatabase)]
public DatabaseUpdateMode DatabaseUpdateMode { get; set; }

#Property Value

Type Default Description
DatabaseUpdateMode UpdateOldDatabase

A DatabaseUpdateMode enumeration value.

Available values:

Name Description
Never

Specifies that the database is never updated. In this instance, update of the database should be performed manually on the database server.

UpdateDatabaseAlways

Specifies that the database is updated at every application run. Do not choose this mode when the Application Server is in use.

UpdateOldDatabase

Specifies that the database is updated when its version is older than the application version.

#Remarks

Use this property to specify the mode for application database update. The DatabaseUpdateMode.UpdateOldDatabase value is set for this property (the default setting). However, the DatabaseUpdateMode.UpdateDatabaseAlways value is set in VB solution templates in debug mode. This is done because it is difficult to increment versions in VB projects.

The following example demonstrates how to specify this property:

Files: MySolution.Win\Program.cs(.vb), MySolution.Web\Global.asax.cs(.vb), or _MySolution.Blazor.Server\BlazorApplication.cs.

using System.Diagnostics;
using DevExpress.ExpressApp;
// ...
static class Program {
    static void Main() {
        // ...
        MySolutionWindowsFormsApplication winApplication = new MySolutionWindowsFormsApplication();
        if(Debugger.IsAttached && winApplication.CheckCompatibilityType == CheckCompatibilityType.DatabaseSchema) {
            winApplication.DatabaseUpdateMode = DatabaseUpdateMode.UpdateDatabaseAlways;
        }
        // ...
    }
}

Note

Do not set the DatabaseUpdateMode property to DatabaseUpdateMode.UpdateDatabaseAlways when the Application Server is in use.

For details on the database update process, refer to the following topic: Update Application and Database Versions using the ModuleInfo Table.

The following code snippets (auto-collected from DevExpress Examples) contain references to the DatabaseUpdateMode property.

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.

See Also