How to set Azure Sql Service Tier when creating DB via EF Core EnsureCreated?

azure-sql-database entity-framework entity-framework-core

Question

When I use the Entity Framework Core EnsureCreated to automatically generate my Azure Sql Database it sets the service tier of the database to be an expensive tier by default.

How do I force the database to be created using the Basic service tier?

I found an example for but it doesn't apply to EF for .NET Core.

1
0
11/16/2019 1:52:29 PM

Popular Answer

You can use code like this with EF Core 3.1 to configure your Azure SQL database:

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
            modelBuilder.HasDatabaseMaxSize("2 GB");

            modelBuilder.HasServiceTier("BusinessCritical");

            modelBuilder.HasPerformanceLevel("BC_Gen4_1");
}

(Some changes were made from 3.0: https://github.com/aspnet/EntityFrameworkCore/pull/18544/files#diff-3eb328f3c708536a3be15d81c1d023e2L128 )

0
11/17/2019 1:33:55 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow