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 |
---|---|---|
Database |
Update |
A Database |
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. |
Update |
Specifies that the database is updated at every application run. Do not choose this mode when the Application Server is in use. |
Update |
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 Database
For details on the database update process, refer to the following topic: Update Application and Database Versions using the ModuleInfo Table.
#Related GitHub Examples
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.