XafApplication.DatabaseUpdateMode Property
Specifies the database update mode.
Namespace: DevExpress.ExpressApp
Assembly: DevExpress.ExpressApp.v25.2.dll
NuGet Package: DevExpress.ExpressApp
Declaration
[Browsable(false)]
[DefaultValue(DatabaseUpdateMode.UpdateOldDatabase)]
public DatabaseUpdateMode DatabaseUpdateMode { get; set; }
Property Value
| Type | Default | Description |
|---|---|---|
| DatabaseUpdateMode | UpdateOldDatabase | Update mode. |
Remarks
Use this property to specify when the application database should be updated: at every application run, when its version is older than the application version, or never (manually).
The DevExpress Template Kit sets the DatabaseUpdateMode property for new applications to the UpdateDatabaseAlways value in Debug mode.
protected override void OnSetupStarted() {
base.OnSetupStarted();
if(System.Diagnostics.Debugger.IsAttached && CheckCompatibilityType == CheckCompatibilityType.DatabaseSchema) {
DatabaseUpdateMode = DatabaseUpdateMode.UpdateDatabaseAlways;
}
// ...
If your application includes Middle Tier Application Server, the server application must update the database. Updating from client applications must be disabled.
For new applications with a Middle Tier Server, the Template Kit disables the autoupdate in client applications and enables it in the Middle Tier server application.
- SolutionName.MiddleTier\Startup.cs
- SolutionName.Blazor.Server\BlazorApplication.cs
- SolutionName.Win\Startup.cs
builder.AddBuildStep(application => {
if (application.CheckCompatibilityType == CheckCompatibilityType.DatabaseSchema) {
application.DatabaseUpdateMode = DatabaseUpdateMode.UpdateDatabaseAlways;
// ...
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.