/// <summary> /// Open and immediately close a salesforce connection using the credential. If a failure occurs /// an exception is thrown. /// </summary> /// <param name="credential">The credential to test with.</param> /// <param name="configuration">Configuration for the connections.</param> public static void TestLogin(SalesForceCredential credential, Configuration configuration) { if (credential == null) { throw new ArgumentNullException("credential"); } if (configuration == null) { configuration = GetDefaultConfiguration(); } SalesForceAPI.Partner.Soap client = null; SalesForceSession session = new SalesForceSession(credential, configuration); try { client = session.CreatePartnerClient(); client.logout(new SalesForceAPI.Partner.logoutRequest( new SalesForceAPI.Partner.SessionHeader() { sessionId = session.Id }, null)); session.DisposeClient(client); } finally { if (client != null) { session.DisposeClient(client); } } }
/// <summary> /// Cleanup any open connections. /// </summary> public void Dispose() { _session.DisposeClient(_partnerClient); _session.DisposeClient(_metadataClient); _session.DisposeClient(_apexClient); _session.DisposeClient(_toolingClient); if (_isSessionOwned) { _session.Dispose(); } }