Enum 支持实体框架数据库优先 [英] Enum Support for Entity Framework Database First

查看:34
本文介绍了Enum 支持实体框架数据库优先的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以找到一堆关于如何首先实现对模型和代码的枚举支持的教程,如下所示:

I can find a bunch of tutorials on how to implement enum support for model first and code first like these:

http://msdn.microsoft.com/en-us/data/jj248772.aspx

http://msdn.microsoft.com/en-us/data/hh859576.aspx

谁能向我解释或向我提供一些有关如何正确实现对数据库优先应用程序的枚举支持的说明.我想我必须从 edmx 设计器开始,然后右键单击表中的一列并转换为枚举?感谢您的任何建议.我使用的是 .NET 4.5 和 Enity Framework 5.0

Can anyone explain to me or provide me with some instructions on how to properly implement enum support for database first applications. I'd imagine I'd have to start in the edmx designer and right click one of my columns in the tables and convert to enum? Thanks for any advice. I'm using .NET 4.5 and Enity Framework 5.0

推荐答案

我最后做的是将数据库中的列类型更改为 int 然后我进入 edmx 并从数据库更新模型,然后我去添加了一个枚举类型,然后将 edmx 设计器中的列类型更改为该枚举的类型.重新更新了 poco,一切正常!

What I wound up doing is changing the column type to int in the database then I went into the edmx and updated model from database, then I went and added a enum type and then changed the column type in the edmx designer to be of type of that enum. Reupdated the poco's and everything Works good!

这篇关于Enum 支持实体框架数据库优先的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆