.NET Core 3.0+
.NET Framework 4.5.2+
.NET Standard 2.0+
.NET Core 3.0+

Ways to Invoke the Model Editor

  • 6 minutes to read

The Model Editor can be used:

  • at design time (in Visual Studio by a developer)

    The Model Editor invoked at design time is a window pane in Visual Studio.

  • at run time (by application users and administrators)

    The Model Editor invoked by end-users and administrators is a form.

The elements and capabilities in both these Model Editor representations are primarily the same.

This topic describes how to invoke the Model Editor in different scenarios.

Invoke the Model Editor in the Visual Studio at Design Time

In Solution Explorer, double-click the Model.xafml or Model.DesignedDiffs.xafml file contained in the XAF solution’s project (module or application project).

Tutorial_BMD_Lesson4_1

You can right-click the project and choose Open Model Editor in the context menu.

ModelEditor_Invoke

The Model Editor will be invoked in a window pane.

ModelEditorDesign

The model editor pane contains the nodes tree, property grid and the search pane (optionally). You can switch focus through these UI elements by pressing the TAB key. A description, type, and a declaring interface of a selected node/property is displayed at the bottom.

Model Editor displays different information for different projects. This information is collected from the modules that are added to the project for which you invoked the Model Editor. If this project is a module itself, the information on it is loaded as well. For the .NET Framework projects, you can see the list of loaded modules in Module Designer or Application Designer.

Everything you change in the Model Editor is saved to the Model.xafml or Model.DesignedDiffs.xafml file, depending on whether the changes were made in an application project or in a module. Changes are displayed in bold in the Model Editor. You can view the underlying XML code by right-clicking the XAFML file and choosing View code. These changes are superimposed on previous values loaded to the Application Model. Values specified in the Model Editor for the application project are the Application Model’s final values. They are used when starting the application. For details, refer to the Application Model Basics topic.

Invoke the Model Editor via the Edit Model Action At Run Time

When the Edit Model or Administrative permission is granted to the current user, the EditModel Action is available in the Tools category of the WinForms application’s root window. This Action is always available if the Security System is not enabled. Use the EditModel Action (or its CTRL+SHIFT+F1 shortcut) to invoke the Model Editor window.

ToolsEditModel

ModelEditor_Runtime

At run time the Model Editor contains complete information, including recent changes made in a UI (layout, skin, etc.).

Changes made by an end-user in a UI manually or in the Model Editor are saved to the Model.User.xafml file by default. This file is located in the folder with the application executable file by default. You can place this file in a user’s ApplicationData folder. Set the UserModelDiffsLocation configuration file key to CurrentUserApplicationDataFolder for this purpose. Another possible option is to store user settings in the database. For details, see Model Difference Storages.

Deploy and Run the Standalone Model Editor

Application administrator can run the Model Editor as a standalone utility on Windows. Application administrator can edit a model of the deployed ASP.NET Web Forms application or deployed Windows Forms application with the EditModel Action disabled.

On the .NET Framework

To use the standalone Model Editor, create a folder at a workstation or a server where the XAF application is deployed. Copy the %PROGRAMFILES(x86)%\DevExpress 21.1\Components\Tools\eXpressAppFramework\Model Editor\DevExpress.ExpressApp.ModelEditor.v21.1.exe executable and %PROGRAMFILES(x86)%\DevExpress 21.1\Components\Tools\eXpressAppFramework\Model Editor\DevExpress.ExpressApp.ModelEditor.v21.1.config configuration file from the developer workstation to the newly created folder. Copy the following assemblies to the same folder.

  • DevExpress.Data.v21.1.dll
  • DevExpress.Data.Desktop.v21.1.dll
  • DevExpress.ExpressApp.Win.v21.1.dll
  • DevExpress.ExpressApp.Xpo.v21.1.dll
  • DevExpress.ExpressApp.v21.1.dll
  • DevExpress.Images.v21.1.dll
  • DevExpress.Office.v21.1.Core.dll
  • DevExpress.Persistent.Base.v21.1.dll
  • DevExpress.RichEdit.v21.1.Core.dll
  • DevExpress.Utils.v21.1.dll
  • DevExpress.Xpo.v21.1.dll
  • DevExpress.XtraBars.v21.1.dll
  • DevExpress.XtraEditors.v21.1.dll
  • DevExpress.XtraLayout.v21.1.dll
  • DevExpress.XtraRichEdit.v21.1.dll
  • DevExpress.XtraTreeList.v21.1.dll
  • DevExpress.XtraVerticalGrid.v21.1.dll
  • All assemblies that are required by your XAF application (deployed together with the WinForms executable, or located in the Bin subfolder of the ASP.NET Web Forms application).

These assemblies are available in the %PROGRAMFILES(x86)%\DevExpress 21.1\Components\Bin\Framework folder at the developer workstation.

NOTE

These assemblies and executables are redistributable. You can register the required assemblies in the Global Assembly Cache (GAC), instead of copying them to the Model Editor folder.

After invoking the standalone Model Editor, you should specify an Application Model to edit via the Open Model dialog. This dialog is opened initially. You can re-invoke it later via the Open Model button at the toolbar.

ModelEditor_OpenModel

On .NET Core 3+ and .NET 5

To use the standalone Model Editor:

  1. Copy the %PROGRAMFILES(x86)%\DevExpress 21.1\Components\Tools\eXpressAppFrameworkNetCore\Model Editor folder from the developer workstation to a workstation or a server where the XAF application is deployed.
  2. Copy all assemblies required by your XAF application (deployed together with the executable).

After invoking the standalone Model Editor, you should specify an Application Model to edit via the Open Model dialog. This dialog is opened initially. You can re-invoke it later via the Open Model button at the toolbar.

ModelEditor_OpenModel

Open and Edit Application Model

To edit the Application Model of the deployed application, you should specify the configuration file name only. An option to choose an assembly file and model differences path provides you with ability to edit model of a certain module outside the Visual Studio.

You can also specify an Application Model to open via command-line parameters. The standalone Model Editor has the following command-line syntax:

DevExpress.ExpressApp.ModelEditor.v21.1.exe appConfigFile | moduleAssemblyFile diffsPath | /?

Parameter

Description

appConfigFile

Specifies an XAF application configuration file. Pass this parameter to edit the Application Model of a deployed XAF application (Windows Forms or ASP.NET Web Forms).

Example:

For the .NET Framework:

DevExpress.ExpressApp.ModelEditor.v21.1.exe d:\MySolution\MySolution.Win\bin\Release\MySolution.Win.exe.config

For .NET Core (WinForms only):

DevExpress.ExpressApp.ModelEditor.v21.1.exe d:\MySolution\MySolution.Win\bin\Release\MySolution.Win.dll.config

moduleAssemblyFile

Specifies an XAF module’s assembly file (DLL). Pass this parameter followed by the diffsPath parameter to edit the Application Model of an XAF module.

Example:

DevExpress.ExpressApp.ModelEditor.v21.1.exe

d:\Projects\MySolution\MySolution.Module\Bin\Debug\MySolution.Module.dll

d:\Projects\MySolution\MySolution.Module

diffsPath

This parameter specifies a model differences folder, and is required when the first parameter specifies an assembly. Typically, you should pass a module project’s folder that contains a Model.DesignedDiffs.xafml file to modify.

/?

Displays a help message on using parameters above.

NOTE

The Windows Forms application configuration file is:

  • <Application_Name>.Win.exe.config - for the .NET Framework
  • <Application_Name>.Win.dll.config - for .NET Core

The ASP.NET Web Forms application configuration file is Web.config.

The ASP.NET Core Blazor application does not include a configuration file. Specify the moduleAssemblyFile and diffsPath parameters instead of appConfigFile.

The Model Editor represented as a form will be invoked.

ModelEditor_CMD

Alternatively, you can right-click the configuration file in Windows Explorer and choose the Model Editor executable via the Open With… menu item.

To edit the Application Model of an XAF module, type the Model Editor executable full path in the command prompt and pass the assembly file and the differences folder as parameters (see the table above).