예제 #1
0
        /// <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);
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="credential">The credential to use for the client.</param>
        public SalesForceClient(SalesForceCredential credential)
        {
            if (credential == null)
            {
                throw new ArgumentNullException("credential");
            }

            _session        = new SalesForceSession(credential, GetDefaultConfiguration());
            _isSessionOwned = true;

            Data       = new DataSystem(this);
            Meta       = new MetaSystem(this);
            Checkout   = new CheckoutSystem(this);
            Test       = new TestSystem(this);
            Diagnostic = new DiagnosticSystem(this);
        }
예제 #3
0
        /// <summary>
        /// Compare two SalesForceCredential objects.
        /// </summary>
        /// <param name="a">The first object in the comparison.</param>
        /// <param name="b">The second object in the comparison.</param>
        /// <returns>
        /// A 32-bit signed integer that indicates the lexical relationship between the
        /// two comparands.
        /// Less than zero a is less than b.
        /// Zero a equals b.
        /// Greater than zero a is greater than b.
        /// </returns>
        public static int Compare(SalesForceCredential a, SalesForceCredential b)
        {
            if (a == null && b == null)
            {
                return(0);
            }
            if (a == null)
            {
                return(-1);
            }
            if (b == null)
            {
                return(1);
            }

            return(String.Compare(a.Username, b.Username, true));
        }
예제 #4
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="credential">The credential to login with.</param>
        /// <param name="configuration">Used to configure connections.</param>
        public SalesForceSession(SalesForceCredential credential, Configuration configuration)
        {
            if (credential == null)
            {
                throw new ArgumentNullException("credential");
            }
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            _credential    = credential;
            _configuration = configuration;
            _session       = null;
            _lastUsed      = DateTime.Now;

            _partnerClientFactory  = null;
            _metadataClientFactory = null;
            _apexClientFactory     = null;
            _toolingClientFactory  = null;

            User = null;
        }
예제 #5
0
 /// <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>
 public static void TestLogin(SalesForceCredential credential)
 {
     TestLogin(credential, null);
 }