gpt4 book ai didi

entity-framework-4.1 - 用EF代码优先枚举-将DB播种然后使用的标准方法?

转载 作者:行者123 更新时间:2023-12-03 08:12:15 25 4
gpt4 key购买 nike

是否有在EF代码优先中使用枚举的标准方法?似乎有一些使用枚举包装类的示例。

但是,我希望能够定义枚举并使用数据库初始化程序将枚举值也植入到数据库中。如果我必须手动从枚举中播种数据库表,那么定义枚举和创建包装似乎没有多大意义。

最佳答案

现在支持:http://blogs.msdn.com/b/adonet/archive/2011/06/30/announcing-the-microsoft-entity-framework-june-2011-ctp.aspx

The Microsoft Entity Framework June 2011 CTP introduces both new runtime and design-time features. Here are some of the new runtime features:

  • The Enum data-type is now available in the Entity Framework. You can use either the Entity Designer within Visual Studio to model entities that have Enum properties, or use the Code First workflow to define entities that have Enum objects as properties. You can use your Enum property just like any other scalar property, such as in LINQ queries and updates...

There are several new features for the Entity Framework Designer within Visual Studio:

  • The Entity Designer now supports creation of Enums, spatial data-types and table-value functions from the designer surface...

关于entity-framework-4.1 - 用EF代码优先枚举-将DB播种然后使用的标准方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6344032/

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