EF 4.1 CodeFirst 和枚举
我有一个这样的类:
public class Customer
{
public string Name {get; set; }
public enumGender Gender {get; set; }
}
public enum enumGender
{
Male,
Female
}
我正在尝试使用它作为实体,并且我想将性别作为 int 映射到数据库,现在性别当然根本没有被映射。
知道如何做到这一点,
提前致谢。
I have a class like that:
public class Customer
{
public string Name {get; set; }
public enumGender Gender {get; set; }
}
public enum enumGender
{
Male,
Female
}
I`m trying to use this as entity and i want to map gender to the database as int, right now gender of course doesn't get mapped at all.
any idea how to do that
thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这就是我克服它的方法......
this is how i got over it....
另一种选择是升级到 Entity Framework 的 6 月 CTP,它现在支持枚举。 http://www.microsoft.com/download/en /details.aspx?displaylang=en&id=26660
这对我来说效果非常好。
Another option, would be upgrading to the June CTP of Entity Framework, which now supports enums. http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=26660
This has been working wonderfully for me.