internal SFSession(String connectionString, SecureString password, IRestRequest restRequest) { this.restRequest = restRequest; properties = SFSessionProperties.parseConnectionString(connectionString, password); ParameterMap = new Dictionary <SFSessionParameter, string>(); }
/// <summary> /// Constructor /// </summary> /// <param name="connectionString">A string in the form of "key1=value1;key2=value2"</param> internal SFSession(String connectionString, SecureString password) { restRequest = RestRequestImpl.Instance; properties = SFSessionProperties.parseConnectionString(connectionString, password); parameterMap = new Dictionary <string, string>(); }
/// <summary> /// Constructor /// </summary> /// <param name="connectionString">A string in the form of "key1=value1;key2=value2"</param> internal SFSession(String connectionString, SecureString password) { restRequest = RestRequestImpl.Instance; properties = SFSessionProperties.parseConnectionString(connectionString); if (password != null) { properties[SFSessionProperty.PASSWORD] = new NetworkCredential(string.Empty, password).Password; } parameterMap = new Dictionary <string, string>(); }
internal SFSession(String connectionString, SecureString password, IRestRequester restRequester) { this.restRequester = restRequester; properties = SFSessionProperties.parseConnectionString(connectionString, password); ParameterMap = new Dictionary <SFSessionParameter, string>(); int timeoutInSec = int.Parse(properties[SFSessionProperty.CONNECTION_TIMEOUT]); connectionTimeout = timeoutInSec > 0 ? TimeSpan.FromSeconds(timeoutInSec) : Timeout.InfiniteTimeSpan; }
internal SFSession(String connectionString, SecureString password, IRestRequester restRequester) { this.restRequester = restRequester; properties = SFSessionProperties.parseConnectionString(connectionString, password); ParameterMap = new Dictionary <SFSessionParameter, object>(); ParameterMap[SFSessionParameter.CLIENT_VALIDATE_DEFAULT_PARAMETERS] = Boolean.Parse(properties[SFSessionProperty.VALIDATE_DEFAULT_PARAMETERS]); int timeoutInSec = int.Parse(properties[SFSessionProperty.CONNECTION_TIMEOUT]); connectionTimeout = timeoutInSec > 0 ? TimeSpan.FromSeconds(timeoutInSec) : Timeout.InfiniteTimeSpan; }
internal SFSession(String connectionString, SecureString password, IRestRequester restRequester) { this.restRequester = restRequester; properties = SFSessionProperties.parseConnectionString(connectionString, password); ParameterMap = new Dictionary <SFSessionParameter, object>(); int recommendedMinTimeoutSec = BaseRestRequest.DEFAULT_REST_RETRY_SECONDS_TIMEOUT; int timeoutInSec = recommendedMinTimeoutSec; try { ParameterMap[SFSessionParameter.CLIENT_VALIDATE_DEFAULT_PARAMETERS] = Boolean.Parse(properties[SFSessionProperty.VALIDATE_DEFAULT_PARAMETERS]); timeoutInSec = int.Parse(properties[SFSessionProperty.CONNECTION_TIMEOUT]); InsecureMode = Boolean.Parse(properties[SFSessionProperty.INSECUREMODE]); } catch (Exception e) { logger.Error(e.Message); throw new SnowflakeDbException(e.InnerException, SFError.INVALID_CONNECTION_STRING, "Unable to connect"); } if (timeoutInSec < recommendedMinTimeoutSec) { logger.Warn($"Connection timeout provided is less than recommended minimum value of" + $" {recommendedMinTimeoutSec}"); } if (timeoutInSec < 0) { logger.Warn($"Connection timeout provided is negative. Timeout will be infinite."); } connectionTimeout = timeoutInSec > 0 ? TimeSpan.FromSeconds(timeoutInSec) : Timeout.InfiniteTimeSpan; }