public async Task <Database> CreateDatabase(string databaseName, ServiceTier serviceTier = ServiceTier.Basic, string collationName = "SQL_LATIN1_GENERAL_CP1_CI_AS", long maximumBytes = 2147483648) { Contract.Requires(Subscription != null); Contract.Requires(!String.IsNullOrEmpty(databaseName)); var tier = new Tier(serviceTier); var ns = XmlNamespaces.WindowsAzure; var content = new XElement(ns + "ServiceResource", new XElement(ns + "Name", databaseName), new XElement(ns + "Edition", tier.Edition.ToString()), new XElement(ns + "CollationName", collationName), new XElement(ns + "MaxSizeBytes", maximumBytes)); if (tier.PerformanceLevel != Guid.Empty) { content.Add(new XElement(ns + "ServiceObjectiveId", tier.PerformanceLevel)); } var response = await GetRestClient("/" + Name + "/databases").PostAsync(content); await Subscription.WaitForOperationCompletionAsync(response); return(new Database(XElement.Parse(await response.Content.ReadAsStringAsync()), this)); }
public Tier(ServiceTier serviceTier) { var attribute = serviceTier.GetAttributeOfType <ServiceTierMetadataAttribute>(); Edition = attribute.Edition; PerformanceLevel = attribute.PerformanceLevel; }