Answers for "ef core index attribute"

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
0

ef core index attribute

[Index(nameof(Isbn))]public class Book{    public int BookId { get; set; }    public string Title { get; set; }    public string Isbn { get; set; }}
Posted by: Guest on October-05-2021

C# Answers by Framework

Browse Popular Code Answers by Language