EF 4.2 Code Đầu tiên có hỗ trợ cho các loại enum không? Nếu vậy, làm thế nào để bạn sử dụng nó? Sau đây không tạo trường cho thuộc tính enum khi sử dụng gói Nuget EntityFramework.Entity Framework 4.2 hỗ trợ enum
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();