DBContext.OnModelCreating
I use fluent API approach (not attributes) and I have index on some fields. Now I would like to apply a function on the column when creating index (to make NULLs indistinctive: Sqlite NULL and unique?).
I would prefer to avoid using raw SQL to achieve this, so there is a way to express this (i.e. apply function on column name) in EF Core when defining index?
modelBuilder.Entity<CategoryDb>(entity =>
{
entity.HasIndex(e => new {e.Name, e.LanguageId}, "name_idx").IsUnique();
How to express the notion of:
modelBuilder.Entity<CategoryDb>(entity =>
{
entity.HasIndex(e => new {e.Name, IFNULL(e.LanguageId,0)},
"name_idx").IsUnique();