日期:2014-05-20  浏览次数:20999 次

Entity Framework codefirst模式 怎么给字段建立索引
例如有如下model
    public class Emp
    {
        public int Id { get; set; }

        [MaxLength(10)]
        public string EmpNo { get; set; }

        [MaxLength(10)]
        public string Alias { get; set; }

        public int Level { get; set; }  // 怎么给这个字段建索引?
    }

------解决方案--------------------
新建的项目也是用add-migration,然后update-database