Skip to main content
.NET 8.0+

Enable the Administrative UI to manage End-User Settings in the Database

  • 2 minutes to read

This topic describes how to enable UI elements you can use to manage Model Differences stored in the database.

The Administrative UI allows application administrators to manage user settings in user accounts - create, copy, export and reset Model Differences. Follow the steps below to enable this UI in your WinForms, ASP.NET WebForms, or ASP.NET Core Blazor application:

  1. Open the Module.cs file and add the following code to the Module constructor:

    using DevExpress.Persistent.BaseImpl;
    // ...
    namespace MainDemo.Module {
      public sealed partial class MainDemoModule : ModuleBase {
         public MainDemoModule() {
            // ...
            AdditionalExportedTypes.Add(typeof(ModelDifference));
            AdditionalExportedTypes.Add(typeof(ModelDifferenceAspect));
         }
         // ...
      }
    }
    

    If you use the Entity Framework Core, ensure that your DbContext contains the following lines:

    using DevExpress.Persistent.BaseImpl.EF;
    // ...
    public class MyDbContext : DbContext {
       // ...
       public DbSet<ModelDifference> ModelDifferences { get; set; }
       public DbSet<ModelDifferenceAspect> ModelDifferenceAspects { get; set; }
    }
    
  2. Run the Model Editor and create a new Navigation Item for the ModelDifference_ListView List View.

    Add the new Navigation Item

Run the application and click this Navigation Item to open the Model Difference List View. Ensure that the Model Differences management Actions are available in the Tools category.

WinForms

Model Difference List View in a WinForms application

ASP.NET WebForms

Model Difference List View in an ASP.NET WebForms application

ASP.NET Core Blazor

Model Difference List View in an ASP.NET Core Blazor application

Users who used the application at least once have initialized Model Differences. The List View lists these Model Differences. This View also contains the Shared Model Difference record that stores global settings. Click Create Model Differences to create Model Differences for unlisted users. Click Import Shared Model Difference to load shared Model Differences created in Visual Studio (the Model.xafml file). You can also copy, export, and reset a selected record.

Note

  • The Export Model Differences Action saves model differences to the application’s ExportedModelDifferences subfolder. Use the ModelDifferenceViewController.ExportedModelDifferencesPath property to change the folder.
  • Restart an ASP.NET Web Forms application on the web server to apply changes if you changed its global settings (for example, using the Import Shared Model Difference Action).