简体   繁体   English

实体框架、枚举支持:在 Linq 扩展方法中修改表达式

[英]Entity Framework, Enum Support: Modify Expression in Linq Extension Method

I'm attempting to implement Entity Framework and I need enum support, so I'm trying to piggy-back off of what is outlined in this blog:http://rogeralsing.com/2010/11/10/entity-framework-4-enum-support-in-linq/ .我正在尝试实现实体框架并且我需要枚举支持,所以我试图背负这个博客中概述的内容:http://rogeralsing.com/2010/11/10/entity-framework- 4-enum-support-in-linq/ I need to take this a step further because my enum value is stored as a string (changing the database is not an option, unfortunately).我需要更进一步,因为我的枚举值存储为字符串(不幸的是,更改数据库不是一种选择)。 In referenced link, what the author is basically doing is replacing the unmapped enum property with a mapped integer property within the linq expression.在引用的链接中,作者所做的基本上是用 linq 表达式中的映射 integer 属性替换未映射的枚举属性。 What I'm attempting to do is also replace the value thats being referenced with an equivalent 'enum-based' string value.我正在尝试做的是将被引用的值替换为等效的“基于枚举”的字符串值。 Any thoughts?有什么想法吗? Thanks谢谢

If you have the ability, you may just try using the June CTP of Entity Framework, which allows enum support built-in.如果你有能力,你可以尝试使用实体框架的 June CTP,它允许内置 enum 支持。 It's been working great for me, and no work-arounds.它对我来说一直很好,没有变通办法。

Info: http://blogs.msdn.com/b/adonet/archive/2011/06/30/announcing-the-microsoft-entity-framework-june-2011-ctp.aspx信息: http://blogs.msdn.com/b/adonet/archive/2011/06/30/announcing-the-microsoft-entity-framework-june-2011-ctp.aspx

Download: http://go.microsoft.com/fwlink/?LinkId=221760下载: http://go.microsoft.com/fwlink/?LinkId=221760

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM