gpt4 book ai didi

entity-framework-4 - Entity Framework 4.2枚举支持

转载 作者:行者123 更新时间:2023-12-04 07:54:11 25 4
gpt4 key购买 nike

EF 4.2 Code First是否支持枚举类型?如果是这样,您将如何使用它?使用Nuget EntityFramework包时,以下内容不会为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();

最佳答案

EF小组has changed versioning,因此EFv4.2并非2011年6月CTP的最终版本。 2011年6月CTP should be released as part of .NET Framework 4.5的功能。

关于entity-framework-4 - Entity Framework 4.2枚举支持,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7977337/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com