ModelBuilder's Entity's HasCheckConstraint() is not reflected in the SQL database.
Steps to reproduce
// example
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
// ...
modelBuilder.Entity<MyEntity>(entity =>
{
// ...
entity.HasCheckConstraint("CK_ONLY_ONE_NULL", "[Column1] IS NULL AND [Column2] IS NOT NULL OR [Column1] IS NOT NULL AND [Column2] IS NULL");
// ...
}
}
Result
The CK_ONLY_ONE_NULL constraint isn't in the local db database
Expectation
The CK_ONLY_ONE_NULL constraint is reflected in the database tables
The HasCheckConstraint extension (undocumented anywhere so far) is in .nuget\packages\microsoft.entityframeworkcore.relational\3.0.0-preview7.19362.6\lib\netstandard2.1\Microsoft.EntityFrameworkCore.Relational.dll namespace Microsoft.EntityFrameworkCore extension class RelationalEntityTypeBuilderExtensions
Further technical details
EF Core version: 3.0.0-preview7.19362.6
Database Provider: Microsoft.EntityFrameworkCore.SqlServer
Operating system: Windows 10 x64 v1904
IDE: Visual Studio 2019 16.2.1
ModelBuilder's Entity's HasCheckConstraint() is not reflected in the SQL database.
Steps to reproduce
Result
The
CK_ONLY_ONE_NULLconstraint isn't in the local db databaseExpectation
The
CK_ONLY_ONE_NULLconstraint is reflected in the database tablesThe
HasCheckConstraintextension (undocumented anywhere so far) is in.nuget\packages\microsoft.entityframeworkcore.relational\3.0.0-preview7.19362.6\lib\netstandard2.1\Microsoft.EntityFrameworkCore.Relational.dllnamespaceMicrosoft.EntityFrameworkCoreextension classRelationalEntityTypeBuilderExtensionsFurther technical details
EF Core version:
3.0.0-preview7.19362.6Database Provider:
Microsoft.EntityFrameworkCore.SqlServerOperating system: Windows 10 x64 v1904
IDE: Visual Studio 2019 16.2.1