Skip to content

CloneModelView

Apostolis Bekiaris edited this page Jul 26, 2019 · 28 revisions

GitHub issues GitHub close issues

About

The CloneModelView package can be used to generate XAF model views in the generator layer, resulting in a clean model which is really important for monitoring and supporting purposes.

Installation

  1. First you need the nuget package so issue this command to the VS Nuget package console

    Install-Package Xpand.XAF.Modules.CloneModelView.

    The above only references the dependencies and nexts steps are mandatory.

  2. Ways to Register a Module or simply add the next call to your module constructor

    RequiredModuleTypes.Add(typeof(Xpand.XAF.Modules.CloneModelViewModule));

Versioning

The module is not bound to DevExpress versioning, which means you can use the latest version with your old DevExpress projects Read more.

The module follows the Nuget Version Basics.

Dependencies

.NetFramework:

DevExpress.ExpressApp Any
System.ValueTuple 4.5.0
Xpand.VersionConverter 1.0.34

Issues-Debugging-Troubleshooting

To Step in the source code you need to enable Source Server support in your Visual Studio/Tools/Options/Debugging/Enable Source Server Support. See also How to boost your DevExpress Debugging Experience.

If the package is installed in a way that you do not have access to uninstall it, then you can unload it with the next call when XafApplication.SetupComplete.

((Xpand.XAF.Modules.CloneModelViewModule) Application.Modules.FindModule(typeof(Xpand.XAF.Modules.CloneModelViewModule))).Unload();

Details

Using the CloneModelViewAttribute in your Bussiness Objects you can:

  1. Create one or many DetailViews or ListViews or LookupListViews.
  2. Additionaly for the cloned view you can configure if it will be the default view for the Bussiness Object.
  3. If you cloned a ListView it is possible the configure related DetailView

Tests

The module is tested on Azure for each build with these tests

Examples

The module is integrated with the following eXpandFramework modules: Dashboard, ExcelImporter, ModelDifference, System,

Next snippet is taken from the ModelDifference module.

 [RuleCombinationOfPropertiesIsUnique("MDO_Unique_Name_Application", DefaultContexts.Save, nameof(Name)+"," +nameof(PersistentApplication)+","+nameof(DeviceCategory))]
    [CreatableItem(false), NavigationItem("Default"), HideFromNewMenu]
    [ModelDefault("Caption", Caption), ModelDefault("IsClonable", "True"), VisibleInReports(false)]
    [CloneView(CloneViewType.DetailView, "MDO_DetailView",true)]
    [CloneView(CloneViewType.ListView, "MDO_ListView_Tablet",true)]
    [CloneView(CloneViewType.ListView, "MDO_ListView_Desktop",true)]
    [CloneView(CloneViewType.ListView, "MDO_ListView_Mobile",true)]
    [CloneView(CloneViewType.ListView, "MDO_ListView_All",true)]
    [CloneView(CloneViewType.ListView, "MDO_ListView", true)]
    [Appearance("Disable DeviceCategory for win models", AppearanceItemType.ViewItem,
        "EndsWith([" + nameof(PersistentApplication) + "." + nameof(BaseObjects.PersistentApplication.ExecutableName) +"], '.exe')", 
        Enabled = false, TargetItems = nameof(DeviceCategory))]
    [RuleCombinationOfPropertiesIsUnique(nameof(PersistentApplication)+","+nameof(DifferenceType)+","+nameof(CombineOrder))]
    public class ModelDifferenceObject : XpandCustomObject, IXpoModelDifference {
You can’t perform that action at this time.