efcore
efcore copied to clipboard
Entity Framework Core multiple filters index unique
modelBuilder.Entity<Registo>().HasIndex(r => r.IsArranqueActivo)
.HasName("IsArranqueActivo_Filtered_Index")
.HasFilter("([ValidatedComponentes]=(1)) AND ([ValidatedGeometrias]=(1)) AND ([ValidatedPokayokes]=(1))")
.IsUnique();
I tried inserting on the column and it still allowed, what am i doing wrong?
I need the IsArranqueActivo to deny inserts if the other 3 columns are false
I might be wrong though on the way i am approaching but i don't know how to make a constraint with EF Core
What i was looking for is a check constraint which can be done using SQL directly on migrations.