EF 4.2代码首先支持枚举类型吗?如果是这样,你如何使用它?在使用Nuget EntityFramework软件包时,以下内容不会为enum属性创建一个字段。实体框架4.2枚举支持
public class FooContext : DbContext
{
public IDbSet<Foo> Foos { get; set; }
}
public class Foo
{
public int Id { get; set; }
public string Name { get; set; }
public Category Category { get; set; }
}
public enum Category {One, Two, Three }
var db = new FooContext();
db.Foos.ToList();