XAF – Model Merge Tool (coming in v2011 vol1)

XAF Team Blog
20 April 2011

End-users can customize an XAF application user interface at runtime with ease. The Layout Manager, Column Chooser and other capabilities allow end-users to configure a UI in a "What You See Is What You Get" way. But when you, as a developer, customize a UI in the Model Editor, you have to deal with indexes, widths, heights, groups, etc. So, you may want to customize a UI as an end-user, and then merge changes to one of the Application Model layers in your XAF solution.

With the v2011 vol 1 release, we have introduced a new XAF design time functionality - Model Merge Tool.

ModelMergeTool

This instrument is intended to merge Application Model customizations into an underlying model layer. It means that now you can customize a View items layout at run time, and then move down these changes into the module project layer. Of course, the layout is not the only customization that can be merged - you can merge any differences that can be applied to a target model layer. The most evident use cases are merging Detail View and Dashboard layouts, grid customizations (columns order, visibility, grouping, etc), chart and pivot grid settings.

Let us take a closer look on how to use the Model Merge feature with the MainDemo application. Assume that we have customized the Resume List View at run time (for instance, changed columns order):

ModelMerge_HowTo_SwapColumns

The customizations we have made are automatically saved to the Model.User.xafml file located in the project output folder:

<ListView Id="Resume_ListView">
  <Columns>
    <ColumnInfo Id="Contact" Index="0" />
    <ColumnInfo Id="File" Index="1" />
  </Columns>
</ListView>

Now let us merge the end-user customizations into the Application Model of the module project. In the Solution Explorer, right click the MainDemo.Win application project and click Merge User Model. In the invoked Open dialog, choose the Model.User.xafml file. As a result, the Model Merge Tool dialog is invoked. Navigate to the Resume_ListView node in the tree list. This node caption is displayed in bold, as the node contains customizations. Use the checkbox to the left to select this node. In the dropdown below, select MainDemo.Module and click Merge. The Resume_ListView node's differences will be merged into the MainDemo.Module project.

ModelMerge_HowTo_MergeDialog

Finally, click Save to persist changes and close the Model Merge Tool dialog. After that, you can see the Resume_ListView node customizations in the Model Editor invoked for the MainDemo.Module project.

 

ModelMerge_HowTo_ME

As the differences were moved into a platform-agnostic module, they affect the ASP.NET application as well:

 

ModelMerge_HowTo_Web

 

In the Model Merge Tool, you can select several nodes at once, and repeat the merging operation as many times as required, before clicking Save. If a part of the selected differences cannot be applied to the selected target, a warning message will be displayed. In this instance, you can try another target (e.g. MainDemo.Module.Win).

If your application is already deployed, and one of end-users has a carefully crafted layout, you may want to use this layout in a new version of the application. In this instance, just copy the Model.User.xafml file from the end-user workstation, and select this file in the Open dialog when running the Model Merge Tool.

If you want to merge differences from an application or module project into an underlying module, select the Merge Model item instead of Merge User Model in a project’s context menu. The Model Merge Tool will be invoked for the current project in this instance.


The following video illustrates the Model Merge Tool in use:

What do you think about this addition to the framework? Please let us know!

UPDATE: We have posted a new Merge User Differences from a Custom Model Storage blog that describes how to merge a user model stored in a database.

Free DevExpress Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.
No Comments

Please login or register to post comments.