Internal tools for working on M-Files Vault Application Framework projects
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 aMFIdentifier
cannot be used, especially in the event handler attributes. -
We make the
Configuration
class partial, and add an additional fileConfiguration.Identifiers.cs
. This file contains correctly attributedMFIdentifier
readonly fields for all aliases in theAlias
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 theIndex.xml
andMetadata
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
).
https://github.com/siriusch/Sirius.MFiles
- MIT license
- Copyright 2023 © Sirius Technologies AG.