efcore / EFCore.CheckConstraints

An Entity Framework Core plugin to automatically add check constraints in various situations
Apache License 2.0
316 stars 14 forks source link

Use new regex support on Azure SQL #156

Open ErikEJ opened 6 months ago

ErikEJ commented 6 months ago

https://techcommunity.microsoft.com/t5/azure-sql-blog/introducing-regular-expression-regex-support-in-azure-sql-db/ba-p/4072741

roji commented 6 months ago

Nice! This seems to be in private beta, let's look at this when it releases... I hope on-premise SQL Server gets it too.

ErikEJ commented 6 months ago

I have signed up for the preview.

Thoughts on how to enable this feature?

  1. Detect that we are on Azure SQL DB based on the server name suffix.

  2. Add an option to the UseCheckconstraints method to opt in?

  3. Something else?

roji commented 6 months ago

Yeah, EF generally avoids trying to auto-detect database version/types... We're not sure that server suffix-based detection is reliable, and in some situations we may not even have a connection string when we need to do stuff.

Here's one thought... Version 8.0 introduced UseAzureSqlDefaults() on the SqlServer options, so the plugin should be able to get the options and check whether that opt-in has been set... Otherwise of course we can have config in the plugin itself as you suggest...

ErikEJ commented 4 months ago

Finally got in to the preview, so I will start experimenting soon