protected override ISqlDatabaseManagement CreateChannel()
        {
            // If ShareChannel is set by a unit test, use the same channel that
            // was passed into out constructor.  This allows the test to submit
            // a mock that we use for all network calls.
            if (ShareChannel)
            {
                return(Channel);
            }

            if (this.ServiceBinding == null)
            {
                this.ServiceBinding = ConfigurationConstants.WebHttpBinding(this.MaxStringContentLength);
            }

            if (string.IsNullOrEmpty(CurrentSubscription.ServiceEndpoint))
            {
                this.ServiceEndpoint = ConfigurationConstants.ServiceManagementEndpoint;
            }
            else
            {
                this.ServiceEndpoint = CurrentSubscription.ServiceEndpoint;
            }

            return(SqlDatabaseManagementHelper.CreateSqlDatabaseManagementChannel(this.ServiceBinding, new Uri(this.ServiceEndpoint), CurrentSubscription.Certificate, this.clientRequestId));
        }
Beispiel #2
0
 /// <summary>
 /// Creates a channel for communication with the server.
 /// </summary>
 /// <returns>a new channel to use for communication</returns>
 private ISqlDatabaseManagement GetManagementChannel()
 {
     if (this.Channel == null)
     {
         //create a channel to the server for communication
         ISqlDatabaseManagement channel = SqlDatabaseManagementHelper.CreateSqlDatabaseManagementChannel(
             ConfigurationConstants.WebHttpBinding(ConfigurationConstants.MaxStringContentLength),
             this.serviceEndpoint,
             this.certificate,
             this.clientRequestId);
         this.Channel = channel;
     }
     return(this.Channel);
 }