Пример #1
0
        /// <summary>
        /// Creates an instance of external child resource in-memory.
        /// </summary>
        /// <param name="name">The name of this external child resource.</param>
        /// <param name="innerObject">Reference to the inner object representing this external child resource.</param>
        /// <param name="sqlServerManager">Reference to the SQL server manager that accesses firewall rule operations.</param>
        ///GENMHASH:F958650D21263F491EB84C4B1B980363:F9DB363750091A34604F0E5CF4D066EE
        internal SqlDatabaseImpl(string name, DatabaseInner innerObject, ISqlManager sqlServerManager)
            : base(innerObject, null)
        {
            this.name             = name;
            this.sqlServerManager = sqlServerManager ?? throw new ArgumentNullException("sqlServerManager");

            this.isPatchUpdate      = false;
            this.importRequestInner = null;
        }
        ///GENMHASH:1C25D7B8D9084176A24655682A78634D:ABBCB4CE203E2AC2B27991A84095239D
        public ISqlDatabase GetDatabase(string databaseName)
        {
            DatabaseInner database = Extensions.Synchronize(() => Manager.Inner.ElasticPools.GetDatabaseAsync(
                                                                ResourceGroupName,
                                                                SqlServerName(),
                                                                Name,
                                                                databaseName));

            return(new SqlDatabaseImpl(database.Name, database, Manager));
        }
Пример #3
0
        /// <summary>
        /// Creates an instance of external child resource in-memory.
        /// </summary>
        /// <param name="name">The name of this external child resource.</param>
        /// <param name="parent">Reference to the parent of this external child resource.</param>
        /// <param name="innerObject">Reference to the inner object representing this external child resource.</param>
        /// <param name="sqlServerManager">Reference to the SQL server manager that accesses firewall rule operations.</param>
        ///GENMHASH:A35E7EC57FEC5C249FB11AEB50216560:C7DB22944BBAB9F9EBF4DC3ECB3D4098
        internal SqlDatabaseImpl(string name, SqlServerImpl parent, DatabaseInner innerObject, ISqlManager sqlServerManager)
            : base(innerObject, parent)
        {
            if (parent == null)
            {
                throw new ArgumentNullException("parent");
            }
            this.name              = name;
            this.sqlServerManager  = sqlServerManager ?? throw new ArgumentNullException("sqlServerManager");
            this.resourceGroupName = parent.ResourceGroupName;
            this.sqlServerName     = parent.Name;
            this.sqlServerLocation = parent.RegionName;

            this.isPatchUpdate      = false;
            this.importRequestInner = null;
        }
Пример #4
0
        public async Task <bool> CreateDatabaseAsync(string dbName, string elasticPool, string location,
                                                     CreateMode createMode, DatabaseEdition databaseEdition,
                                                     string collation = "SQL_Latin1_General_CP1_CI_AS")
        {
            var dbInner = new DatabaseInner
            {
                ElasticPoolName = elasticPool,
                Location        = location,
                Collation       = collation,
                CreateMode      = createMode,
                Edition         = databaseEdition,
            };

            var resultDbInner = await client.Databases.CreateOrUpdateAsync(azureResourceGroup, azureSQLServer, dbName, dbInner);

            return(string.IsNullOrEmpty(resultDbInner.Name) ? false : true);
        }
        public async Task <bool> CreateDatabaseAsync(string databaseName)
        {
            var dbInner = new DatabaseInner
            {
                ElasticPoolName = _azureOptions.Value.ElasticPoolName,
                Location        = Region.EuropeNorth.ToString(),
                Collation       = CatalogCollationType.SQLLatin1GeneralCP1CIAS.ToString(),
                Edition         = DatabaseEdition.GeneralPurpose,
                RequestedServiceObjectiveName = ServiceObjectiveName.ElasticPool,
            };

            var resultDbInner = await _client.Databases.CreateOrUpdateAsync(_azureOptions.Value.ResourceGroupName,
                                                                            _azureOptions.Value.ServerName,
                                                                            databaseName,
                                                                            dbInner);

            return(!string.IsNullOrEmpty(resultDbInner.Name));
        }
Пример #6
0
 ///GENMHASH:5E107B23DE34DEBD4ED372100F2024F8:0AF0D08DA20B3ABFC0CC6C3AE431D719
 public SqlWarehouseImpl(string resourceGroupName, string sqlServerName, string sqlServerLocation, string name, DatabaseInner innerObject, ISqlManager sqlServerManager)
     : base(resourceGroupName, sqlServerName, sqlServerLocation, name, innerObject, sqlServerManager)
 {
 }
Пример #7
0
 ///GENMHASH:01F4015FD664AFA09FE455D9F817F348:C99C685A9D673A92118B74962283411C
 public SqlWarehouseImpl(string name, SqlServerImpl parent, DatabaseInner innerObject, ISqlManager sqlServerManager)
     : base(name, parent, innerObject, sqlServerManager)
 {
 }
 /// <summary>
 /// Creates a new Azure SQL database or updates an existing Azure SQL database.
 /// Location is a required property in the request body, and it must be the
 /// same as the location of the SQL server.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group that contains the resource. You can obtain
 /// this value from the Azure Resource Manager API or the portal.
 /// </param>
 /// <param name='serverName'>
 /// The name of the Azure SQL server.
 /// </param>
 /// <param name='databaseName'>
 /// The name of the Azure SQL database to be operated on (updated or created).
 /// </param>
 /// <param name='parameters'>
 /// The required parameters for creating or updating a database.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <DatabaseInner> BeginCreateOrUpdateAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, DatabaseInner parameters, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Пример #9
0
 /// <summary>
 /// Creates a new database or updates an existing database.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group that contains the resource. You can obtain
 /// this value from the Azure Resource Manager API or the portal.
 /// </param>
 /// <param name='serverName'>
 /// The name of the server.
 /// </param>
 /// <param name='databaseName'>
 /// The name of the database to be operated on (updated or created).
 /// </param>
 /// <param name='parameters'>
 /// The required parameters for creating or updating a database.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <DatabaseInner> CreateOrUpdateAsync(this IDatabasesOperations operations, string resourceGroupName, string serverName, string databaseName, DatabaseInner parameters, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serverName, databaseName, parameters, SqlManagementClient.SetJsonAcceptHeader(), cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Пример #10
0
 ///GENMHASH:478F77EE25B1DAD41512D7810F424A78:E1ECD7008D29BB72B20EB2538850BB93
 internal SqlWarehouseImpl(string name, DatabaseInner innerObject, ISqlManager manager)
     : base(name, innerObject, manager)
 {
 }