我正在 Compact Framework 上使用 Linq 表达式树(来自 db4o/Mainsoft/Mono 端口)。由于 System.Reflection.Emit 不存在,我无法将 LambdaExpressions 编译为委托,出于性能原因我想这样做。
我想也许我可以将我的表达式树转换为 IL,并基本上以这种方式提供缺少的 Emit 功能,但后来我意识到我必须在其上运行基于 WinCE 的 ILASM 或编写我自己的 PE 标头和汇编元数据。
我更愿意使用 ILASM。 是吗?
I'm working with Linq expression trees (from the db4o/Mainsoft/Mono port) on the Compact Framework. Since System.Reflection.Emit doesn't exist, I can't compile my LambdaExpressions into delegates, which I want to do for performance reasons.
I thought maybe I could transform my expression tree into IL and basically provide the missing Emit functionality that way, but then I realized that I'd have to either run a WinCE-based ILASM on it or write my own PE headers and assmebly metadata.
I'd much rather have ILASM available. Is it?
发布评论
评论(2)
显然,我可以编译 Mono.Cecil 以便在 Compact Framework 下使用,这将允许我发出并加载程序集。
Apparently, I can compile Mono.Cecil for use under the Compact Framework, which will allow me to emit and load assemblies.
如果您想在 CF 上使用 Lambda 表达式,则不需要 ILASM 或 System.Reflection.Emit。 CF 的 C# 编译器支持 Lamba-Expressions,但 CF 基础库没有 Expressions 类。如果您使用表达式的正确命名(和正确实现)类添加对程序集的引用,则可以启用 Lambda 表达式。
感谢上帝,这个程序集已经实现了( http://evain.net/blog/articles/2008/09/22/linq-expression-trees-on-the-compact-framework ) - 我将它与 Db4O 数据访问一起使用对于 SqlCE,使用 LINQ IQueryableToolkit,效果很好。
If you want use a Lambda-Expressions on CF you don't need ILASM or System.Reflection.Emit. The C# compiler for CF supports Lamba-Expressions but the CF base libraries does not have the Expressions classes. If you add reference to assembly with correct named (and correct implemented) classes for expressions, you enable Lambda-Expressions.
Thanks for god, there are this assembly already implemented ( http://evain.net/blog/articles/2008/09/22/linq-expression-trees-on-the-compact-framework ) - I use it with Db4O data access and for SqlCE wit LINQ IQueryableToolkit, and it works well.