I receive the following from Visual Studio Code on my Mac, both in IDE and console window after executing \"dotnet run\":
The type or namespace name \'IndexAttribute\' c
This seems to have changed since you asked the question. jsakamoto has implemented NuGet package that allows you to keep your [Index] attribute. The only difference is order of variables; you can no longer have Order=0
as your last variable but rather do:
[Index("IX_TreeFiddy", 0, IsUnique = false)]
public string LochNessMonster { get; set; }
[Index("IX_TreeFiddy", 1, IsUnique = false)]
public int CentsGiven { get; set; }
Override OnModelCreating()
// Override "OnModelCreating"
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
// .. and invoke "BuildIndexesFromAnnotations"!
modelBuilder.BuildIndexesFromAnnotations();
}
Here is link to: IndexAttribute for .NET Core NuGet package