Answers for "how to add index to database code first .net core"

C#
0

how to add index to database code first .net core

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
    modelBuilder.Entity<Blog>()
        .HasIndex(b => b.Url)
        .HasName("Index_Url");
}
Posted by: Guest on September-22-2020
0

how to add index to database code first .net core

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
    modelBuilder.Entity<Blog>()
        .HasIndex(b => b.Url)
        .IsUnique();
}
Posted by: Guest on September-22-2020

Code answers related to "how to add index to database code first .net core"

C# Answers by Framework

Browse Popular Code Answers by Language