Skip to main content
.NET Standard 2.0+

How to: Enable the Administrative UI for managing Users' Model Differences

  • 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, register the ModelDifference and ModelDifferenceAspect entity types within your DbContext:

    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. Refer to the Model Difference Storages article’s Administrative UI section for more information about these Actions.

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).