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

标签 entity-framework-4.1 ef-code-first

是否有在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/

相关文章:

entity-framework - InvalidOperationException(集合已设置为 EntityCollection)在模板修改后所有属性都是虚拟的

entity-framework - Entity Framework 4.1 Code First - 如何在两个表之间创建两种不同的关系

c# - Entity Framework 推断关系

entity-framework-4 - 您可以在不使用向导的情况下使用 Entity Framework 4 调用 UDF 吗?

entity-framework - 如何告诉 EF/DbSet 附加到 SQL View 而不尝试创建同名表?

entity-framework - 在代码优先 Entity Framework 中手动编辑数据库

c# - 在 appdata 文件夹中创建 sql server 压缩文件

c# - 使用 Entity Framework Code First 在 PostgreSQL 中存储图像

.net - MVC4 格式日期未使用 DisplayFormat 值进行验证

entity-framework - 部署到 Azure 后,EF 代码首次迁移未运行