Ehsan Zargar Ershadi
Ehsan Zargar Ershadi

Reputation: 24833

Entity Framework Code First 6.0: is there any annotations to add index to a column(s)

I'm using EF6 for first time. having a table like this:

public class DBBlog
{
     public int Id { get; set; }
     public string Title { get; set; }  //<-- need to be indexed
}

please advice

Upvotes: 1

Views: 1574

Answers (2)

divega
divega

Reputation: 6476

The capability was added for EF 6.1 and is available already in nightly builds. For more information:

https://entityframework.codeplex.com/workitem/57

Upvotes: 3

user2674389
user2674389

Reputation: 1143

Unfortunately there is no DataAnnotion yet in EF to create indices. When you're using migrations, then you can adjust the created migration to add an Index manually.

Upvotes: 1

Related Questions