Skip to main content
A newer version of this page is available. .

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 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 20.2\Components\%PROGRAMFILES(x86)%\DevExpress 20.2\.NET Core Desktop Libraries\Tools\eXpressAppFramework\Model Editor\DevExpress.ExpressApp.ModelEditor.v20.2.exe executable and %PROGRAMFILES(x86)%\DevExpress 20.2\Components\%PROGRAMFILES(x86)%\DevExpress 20.2\.NET Core Desktop Libraries\Tools\eXpressAppFramework\Model Editor\DevExpress.ExpressApp.ModelEditor.v20.2.config configuration file from the developer workstation to the newly created folder. Copy the following assemblies to the same folder.

  • DevExpress.Data.v20.2.dll
  • DevExpress.Data.Desktop.v20.2.dll
  • DevExpress.ExpressApp.Win.v20.2.dll
  • DevExpress.ExpressApp.Xpo.v20.2.dll
  • DevExpress.ExpressApp.v20.2.dll
  • DevExpress.Images.v20.2.dll
  • DevExpress.Office.v20.2.Core.dll
  • DevExpress.Persistent.Base.v20.2.dll
  • DevExpress.RichEdit.v20.2.Core.dll
  • DevExpress.Utils.v20.2.dll
  • DevExpress.Xpo.v20.2.dll
  • DevExpress.XtraBars.v20.2.dll
  • DevExpress.XtraEditors.v20.2.dll
  • DevExpress.XtraLayout.v20.2.dll
  • DevExpress.XtraRichEdit.v20.2.dll
  • DevExpress.XtraTreeList.v20.2.dll
  • DevExpress.XtraVerticalGrid.v20.2.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 application).

These assemblies are available in the %PROGRAMFILES(x86)%\DevExpress 20.2\Components\%PROGRAMFILES(x86)%\DevExpress 20.2\.NET Core Desktop Libraries\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 20.2\Components\%PROGRAMFILES(x86)%\DevExpress 20.2\.NET Core Desktop Libraries\Tools\eXpressAppFramework\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 WinForms 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.

Note

You cannot open and edit the Application Model of a Blazor application.

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

Example:

For the .NET Framework:

DevExpress.ExpressApp.ModelEditor.v20.2.exe d:\MySolution\MySolution.Win\bin\Release\MySolution.Win.exe.config

For .NET Core:

DevExpress.ExpressApp.ModelEditor.v20.2.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.v20.2.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.

So, to edit the Application Model of the deployed application, type the Model Editor executable full path in the command prompt and pass the application configuration file full path as the parameter. 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.

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 application configuration file is Web.config.

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