Esempio n. 1
0
        /// <summary>
        /// Create a connection parameters object
        /// </summary>
        private ConnectParams CreateConnectParams(InstanceInfo connectionProfile, string key, string databaseName)
        {
            ConnectParams connectParams = new ConnectParams();

            connectParams.Connection                    = new ConnectionDetails();
            connectParams.Connection.ServerName         = connectionProfile.ServerName;
            connectParams.Connection.DatabaseName       = connectionProfile.Database;
            connectParams.Connection.UserName           = connectionProfile.User;
            connectParams.Connection.Password           = connectionProfile.Password;
            connectParams.Connection.AuthenticationType = connectionProfile.AuthenticationType.ToString();
            if (!string.IsNullOrEmpty(databaseName))
            {
                connectParams.Connection.DatabaseName = databaseName;
            }
            if (key == DefaultSqlAzureInstanceKey || key == DefaultSqlAzureV12InstanceKey)
            {
                connectParams.Connection.ConnectTimeout         = 30;
                connectParams.Connection.Encrypt                = true;
                connectParams.Connection.TrustServerCertificate = false;
            }
            return(connectParams);
        }
 private string FormatCredentialIdForTest(InstanceInfo connectionProfile, string itemType = "Profile")
 {
     return(FormatCredentialId(connectionProfile, itemType, TEST_CRED_PREFIX));
 }
        /// <summary>
        /// Stored the credential to credential store using the test prefix
        /// </summary>
        public bool SaveCredential(InstanceInfo connectionProfile)
        {
            Credential credential = new Credential(FormatCredentialIdForTest(connectionProfile), connectionProfile.Password);

            return(credentialService.SaveCredential(credential));
        }