The base class for all Microsoft Azure Sql Database Management Cmdlets
Наследование: Microsoft.WindowsAzure.Commands.Utilities.Common.AzureSMCmdlet
Пример #1
0
        /// <summary>
        /// Retrieve the SQL Management client for the currently selected subscription.
        /// </summary>
        /// <returns>The SQL Management client for the currently selected subscription.</returns>
        public static SqlManagementClient GetCurrentSqlClient()
        {
            // Get the SQL management client for the current subscription
            WindowsAzureSubscription subscription = WindowsAzureProfile.Instance.CurrentSubscription;

            SqlDatabaseCmdletBase.ValidateSubscription(subscription);
            return(subscription.CreateClient <SqlManagementClient>());
        }
        /// <summary>
        /// Retrieve the SQL Management client for the currently selected subscription, adding the session and request
        /// id tracing headers for the current cmdlet invocation.
        /// </summary>
        /// <returns>The SQL Management client for the currently selected subscription.</returns>
        protected SqlManagementClient GetCurrentSqlClient()
        {
            // Get the SQL management client for the current subscription
            WindowsAzureSubscription subscription = WindowsAzureProfile.Instance.CurrentSubscription;

            SqlDatabaseCmdletBase.ValidateSubscription(subscription);
            SqlManagementClient client = subscription.CreateClient <SqlManagementClient>();

            client.HttpClient.DefaultRequestHeaders.Add(Constants.ClientSessionIdHeaderName, clientSessionId);
            client.HttpClient.DefaultRequestHeaders.Add(Constants.ClientRequestIdHeaderName, clientRequestId);
            return(client);
        }
        /// <summary>
        /// Retrieve the SQL Management client for the currently selected subscription, adding the session and request
        /// id tracing headers for the current cmdlet invocation.
        /// </summary>
        /// <returns>The SQL Management client for the currently selected subscription.</returns>
        protected SqlManagementClient GetCurrentSqlClient()
        {
            // Get the SQL management client for the current subscription
            IAzureSubscription subscription = Profile.Context.Subscription;

            SqlDatabaseCmdletBase.ValidateSubscription(subscription);
            SqlManagementClient client = AzureSession.Instance.ClientFactory.CreateClient <SqlManagementClient>(Profile, subscription, AzureEnvironment.Endpoint.ServiceManagement);

            client.HttpClient.DefaultRequestHeaders.Add(Constants.ClientSessionIdHeaderName, clientSessionId);
            client.HttpClient.DefaultRequestHeaders.Add(Constants.ClientRequestIdHeaderName, clientRequestId);
            return(client);
        }
 internal SqlDatabaseCmdletBase()
 {
     this.clientRequestId = SqlDatabaseCmdletBase.GenerateClientTracingId();
 }
 static SqlDatabaseCmdletBase()
 {
     clientSessionId = SqlDatabaseCmdletBase.GenerateClientTracingId();
 }