Creating Unique Index with Entity Framework 6.1 fluent API
NOTE: Relevant to EF 6 You can use IndexAttribute as mentioned but with Fluent API instead of DataAnnotations which will do the trick: modelBuilder .Entity<Person>() .Property(t => t.Name) .HasColumnAnnotation( “Index”, new IndexAnnotation(new IndexAttribute(“IX_Name”) { IsUnique = true })); Unfortunately there is no other way to create unique indexes using Fluent API. There is an open … Read more