siriusch / Sirius.MFiles

Internal tools for working on M-Files Vault Application Framework projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sirius.MFiles

Internal tools for working on M-Files Vault Application Framework projects


Description

VafUtil

Tool for generating files used in the VAF development process. When developing vault applications, aliases of structure items (object types, value lists, classes, property definitions, workflows including states and transitions, named ACLs etc.) need to be used in various .NET attributes, and the configuration class should also mirror the same aliases as MFIdentifier instances to be used throughout the VAF code.

In order to prevent inconsistencies and typos, we have adopted the following approach:

  • We create a static Alias class which holds all aliases of the relevant part of the vault configuration as static strings. The static strings can be used in all places where a MFIdentifier cannot be used, especially in the event handler attributes.

  • We make the Configuration class partial, and add an additional file Configuration.Identifiers.cs. This file contains correctly attributed MFIdentifier readonly fields for all aliases in the Alias class. In addition to the aliases, it also generates identifiers for owner properties, along with the code required to initialize these.

// Initialize owner property definitions in configuration by using VaultApplication class
public partial class VaultApplication: ConfigurableVaultApplicationBase<Configuration> {
  protected override void InitializeImpl(Vault vaultSrc) {
    base.InitializeImpl(vaultSrc);
    Configuration.InitializeOwnerPropertyDefs(vaultSrc);
  }
}

The tool uses the Structure.xml file from a Content Package as generated by M-Files Admin. It's therefore required to always export the configuration to a Content Package before invoking the tool.

The tool generates one file per invocation. Call the tool like this to generate both files:

VafUtil generate aliasfile VaultContentPackage MyVAF\Alias.cs -n MyVAF
VafUtil generate configurationfile VaultContentPackage MyVAF\Configuration.Identifiers.cs -n MyVAF

Notes:

  • The VaultContentPackage is the folder which contains the Index.xml and Metadata folder.
  • The -n (--namespace) option will configure the namespace to be used. If omitted, the namespace from the existing file is detected and used.
  • If you want to also generate aliases and identifiers for views, add the option -v (--views).

Source

https://github.com/siriusch/Sirius.MFiles


License

About

Internal tools for working on M-Files Vault Application Framework projects

License:MIT License


Languages

Language:XSLT 56.4%Language:C# 43.6%