dotnet / efcore

EF Core is a modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrations.
https://docs.microsoft.com/ef/
MIT License
13.68k stars 3.17k forks source link

SQL Server: allow users to specify they're using SQL Azure #30651

Open roji opened 1 year ago

roji commented 1 year ago

30163 is about allowing users to specify their SQL Server compatibility level, allowing them to say they're using an old database which doesn't support some feature (e.g. OPENJSON). We could also allow users to inform us that they're targeting SQL Azure. This could have the following effects:

Think specifically about the impact on people testing against non-Azure SQL, which may need to configure differently for testing vs. production etc.

ErikEJ commented 1 year ago

For the first item you could also execute:

 SELECT ServerProperty('EngineEdition')

and check for 5, 8 or 11

https://learn.microsoft.com/en-us/sql/t-sql/functions/serverproperty-transact-sql?view=sql-server-ver16

roji commented 1 year ago

@ErikEJ we generally don't do runtime checking of database capabilities like this - otherwise we could have also attempted to check the database's compatibility level (#30163) rather than requiring users to explicitly configure it. One reason for that is that we don't always have a database to connect to (e.g. when generating SQL scripts for migrations).