Sea*_*ron 6 entity-framework-4
EF 4.2 Code First是否支持枚举类型?如果是这样,你如何使用它?使用Nuget EntityFramework包时,以下内容不会为枚举属性创建字段.
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();
Run Code Online (Sandbox Code Playgroud)