Skip to main content
.NET 6.0+

XafApplication.DatabaseUpdateMode Property

Specifies the database update mode.

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v24.1.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.

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