Connecting to a Vault

The VDF connection is one of the key access points to the services provided by the VDF.

A VDF connection is represented by an instance of the VDF.Vault.Currency.Connection.Connection class. In order to obtain a VDF Connection object, client applications will have to log in to a Vault server. The VDF provides a both GUI log-in and non-GUI programmatic log-in methods that return either a result object containing the newly created VDF connection or the connection object directly.

To perform a GUI log-in, client apps should call the VDF.Vault.Forms.Library.Login() method. This methods takes a VDF.Vault.Forms.Settings.LoginSettings object that allows clients to adjust the behavior of the VDF's log-in. The GUI log-in will display a dialog prompting users for log-in information, display log-in progress, and manage persistence of log-in data, etc. Examples of its use can be found in the sample applications packaged with the Vault SDK (for example, the VaultFileBrowser sample).

The non-GUI log-in allows client apps to provide the log-in credentials directly to the VDF without having to prompt for user input. The non-GUI log-in is done using the VDF.Vault.Library.ConnectionManager.Login() method. More information about both log-in methods and their settings/parameters can be found in the SDK documentation. Once you have a VDF connection, client applications can begin using it to interact with the Vault server via services such as the File Manager service or by providing the connection object to Library methods that require a connection.

Moving from Vault 2013 SDK's WebServiceManager to the VDF's Connection

The VDF Connection class provides access to a WebServiceManager instance that shares the same Vault server connection, so any existing code written using the 2013 SDK's WebServiceManager should convert easily to using the VDF connection class. Simply replace references to a WebServiceManager instance with calls to the WebServiceManager property of an active VDF Connection instance. The only other changes client applications will need is how they obtain a connection. As mentioned in the section above, client applications will have to use one of the log-in methods to obtain a VDF Connection. For client applications that would prefer to have minimal change, the VDF's non-GUI log-in maps pretty close to the WebServiceManager's constructor, and so, client applications can simply swap out the creation of a WebServiceManager with a VDF log-in. For example, these two code snippets will result in essentially the same Vault connection:

Using web service manager (C#):

Using VDF log-in (C#):

The other thing client applications will need to adjust is how they sign-out/dispose of the Vault connection. While the WebServiceManager was an IDisposable, the VDF Connection is not and it is recommended to release the Vault connection by passing the VDF connection you wish to log out of to the ConnectionManager's Logout() method.