简体   繁体   中英

Index Attribute resolving issue in Microsoft.EntityFrameworkCore

I have got.Net Standart 2.0 dll to keep separated entities of MS SQL Server.

The Index Attribute cannot be resolving.

I've did search and experimented with adding some namespaces of Entity Framework but nothing works even by MSDN .

Please, help. Thank you!

在此处输入图像描述

在此处输入图像描述

IndexAttribute Class

Specifies an index to be generated in the database.

Entity Framework Core

  • 5.0

You are not using EF core 5. You will need to use the model Builder instead


Read more here

Indexes

Configuring indexes via Data Annotations has been introduced in EF Core 5.0.

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
    modelBuilder.Entity<Blog>()
        .HasIndex(b => b.Url);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM