Skip to main content

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 runtime (by application users and administrators)

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

The elements and capabilities in both instances are primarily the same.

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

Invoke the Model Editor in 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 following elements: nodes tree, property grid, and search pane (optional). To switch focus between UI elements, press the TAB key. A description and type of a selected node/property is displayed at the bottom.

The 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 the 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. To view the underlying XML code, right-click the XAFML file and choose 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 following topic: Application Model Basics.

Use Actions to Invoke the Model Editor At RunTime

When the Edit Model or Administrative permission is granted to the current user, the Tools category of the WinForms application’s root window shows the EditModel and ViewInModel Actions. These Actions are available if the Security System is not enabled.

The Edit Model Action

Use the EditModel Action (or the CTRL+SHIFT+F1 shortcut) to invoke the Model Editor window.

ToolsEditModel

ModelEditor_Runtime

The View in Model Action

Use the ViewInModel Action (or the CTRL+SHIFT+F2 shortcut) to invoke the Model Editor window with the selected View node item.

View in Model Action

The Model Editor with the selected node

You can also utilize Action items to open the Model Editor with the selected Class or Validation nodes.

View in Model Action items

User Model Difference Storage

At runtime, the Model Editor contains complete information that includes recent changes made in the UI. When a user makes changes in the UI or in the Model Editor, they are saved to the Model.User.xafml file. This file is located in the folder with the application executable file. Set the UserModelDiffsLocation configuration key to CurrentUserApplicationDataFolder to place this file in a user’s ApplicationData folder.

File: MySolution.Win\App.config

<appSettings>
    <add key="UserModelDiffsLocation" value="CurrentUserApplicationDataFolder"/>
</appSettings>

You can also store user settings in the database. See the following topic for details: Model Difference Storages.

Deploy and Run the Standalone Model Editor

The application administrator can run the Model Editor as a standalone utility on Windows. The 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%\DevExpress 24.1\Components\Tools\eXpressAppFramework\Model Editor\DevExpress.ExpressApp.ModelEditor.v24.1.exe executable and %PROGRAMFILES%\DevExpress 24.1\Components\Tools\eXpressAppFramework\Model Editor\DevExpress.ExpressApp.ModelEditor.v24.1.config configuration file from the developer workstation to the newly created folder. Copy the following assemblies to the same folder:

  • DevExpress.Data.v24.1.dll
  • DevExpress.Data.Desktop.v24.1.dll
  • DevExpress.ExpressApp.Win.v24.1.dll
  • DevExpress.ExpressApp.Xpo.v24.1.dll
  • DevExpress.ExpressApp.v24.1.dll
  • DevExpress.Images.v24.1.dll
  • DevExpress.Office.v24.1.Core.dll
  • DevExpress.Persistent.Base.v24.1.dll
  • DevExpress.RichEdit.v24.1.Core.dll
  • DevExpress.Utils.v24.1.dll
  • DevExpress.Xpo.v24.1.dll
  • DevExpress.XtraBars.v24.1.dll
  • DevExpress.XtraEditors.v24.1.dll
  • DevExpress.XtraLayout.v24.1.dll
  • DevExpress.XtraRichEdit.v24.1.dll
  • DevExpress.XtraTreeList.v24.1.dll
  • DevExpress.XtraVerticalGrid.v24.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%\DevExpress 24.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 you invoke the standalone Model Editor, use the Open Model dialog to specify the Application Model to edit. This dialog is initially open. To re-invoke it later, click the Open Model button on the toolbar.

ModelEditor_OpenModel

On .NET 6

To use the standalone Model Editor:

  1. Copy the %PROGRAMFILES%\DevExpress 24.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 you invoke the standalone Model Editor, use the Open Model dialog to specify the Application Model to edit. This dialog is initially open. To re-invoke it later, click the Open Model button on 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 allows you to edit the model of a specific module outside of Visual Studio.

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

DevExpress.ExpressApp.ModelEditor.v24.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.v24.1.exe d:\MySolution\MySolution.Win\bin\Release\MySolution.Win.exe.config

For .NET (WinForms only):

DevExpress.ExpressApp.ModelEditor.v24.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.v24.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 how to use the above parameters.

Note

The Windows Forms application configuration file is:

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

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 click the Open With…* menu item to choose the Model Editor executable.

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