コード例 #1
0
        /// <summary>
        /// Retrieve a specific database from the current context
        /// </summary>
        /// <param name="databaseName">The name of the database to retrieve</param>
        /// <returns>A database object</returns>
        public Database GetDatabase(string databaseName)
        {
            this.clientRequestId = SqlDatabaseManagementHelper.GenerateClientTracingId();

            //create a channel to the server for communication
            ISqlDatabaseManagement channel = GetManagementChannel();

            //query the server for the database
            SqlDatabaseResponse database =
                channel.EndGetDatabase(
                    channel.BeginGetDatabase(this.subscriptionId, this.ServerName, databaseName, null, null));

            //Create the database from the response
            Database result = CreateDatabaseFromResponse(database);

            //return the database
            return(result);
        }