Ways to Invoke the Model Editor

The Model Editor can be used both at design time (in Visual Studio by a developer) and at run time (by application users and administrators). While the Model Editor invoked at design time is represented by a window pane in Visual Studio, the Model Editor invoked by end-users and administrators is represented by 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 and is comprised of the following sections.

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

Also 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 the currently selected node/property is displayed at the bottom.

For different projects, different information will be displayed. This information is collected from the modules that are added to the project for which you invoked the Model Editor. In addition, if this project is a module, the information the module itself is loaded as well. To see the list of loaded modules, see the corresponding 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

In contrast to design time, at run time the Model Editor contains complete information, including recent changes made in a UI (layout, skin, etc.). By default, changes made by an end-user in a UI manually or in the Model Editor are saved to the Model.User.xafml file. This file is located in the folder with the application executable file by default. Alternatively, this file can be placed 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

The Model Editor can be used as a standalone utility. This approach can be used by the application administrator to edit a model of the deployed ASP.NET application or deployed Windows Forms application with the EditModel Action disabled. Do not use the standalone Model Editor for Mobile applications, because you need to rebuild your application after changing the Mobile Application Model. 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 18.2\Components\Tools\eXpressAppFramework\Model Editor\DevExpress.ExpressApp.ModelEditor.v18.2.exe executable and %PROGRAMFILES(x86)%\DevExpress 18.2\Components\Tools\eXpressAppFramework\Model Editor\DevExpress.ExpressApp.ModelEditor.v18.2.config configuration file from the developer workstation to the newly created folder. Copy the following assemblies to the same folder.

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

To edit the Application Model of the deployed XAF 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.v18.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:

DevExpress.ExpressApp.ModelEditor.v18.2.exe d:\sites\MySolution\Web.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.v18.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. 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).