Exemple #1
0
        public void Init()
        {
            ServerApp = new MFilesServerApplication();

            Vault v;
            MFVaultConnectionAttribute vaultConnInfo = ServerApp.Connect(GetType(), out v);

            this.V        = v;
            this.Tools    = new AliasTools(this.V);
            this.Settings = new AliasTools.Settings();
        }
Exemple #2
0
        /// <summary>
        /// <see cref="MFilesServerApplication"/>.Connect() extension method that accepts a class type that is decorated with a <see cref="MFVaultConnectionAttribute"/>.
        /// </summary>
        /// <param name="sa"><see cref="MFilesServerApplication"/> instance</param>
        /// <param name="decoratedType"><see cref="Type"/> of the class with the connection info decorations</param>
        /// <param name="vault">Out <see cref="Vault"/></param>
        /// <returns><see cref="MFVaultConnectionAttribute"/></returns>
        public static MFVaultConnectionAttribute Connect(this MFilesServerApplication sa, Type decoratedType, out Vault vault)
        {
            // Extract the MFVaultConnectionAttribute info attribute.
            MFVaultConnectionAttribute vaultConn = (MFVaultConnectionAttribute)Attribute.GetCustomAttribute(decoratedType, typeof(MFVaultConnectionAttribute));

            // Connect to the server.
            sa.Connect(vaultConn);

            // Login to the vault using the GUID provided.
            // Set the out vault value.
            vault = sa.LogInToVault(vaultConn.VaultGuid);

            // Return the Vault Connection info.
            return(vaultConn);
        }