XafApplication.DatabaseUpdateMode Property
Specifies the database update mode.
Namespace: DevExpress.ExpressApp
Assembly: DevExpress.ExpressApp.v26.1.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.
File: SolutionName.Blazor.Server\BlazorApplication.cs or SolutionName.Win\Startup.cs(.vb)
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;
// ...