单塞西尔与PostSharp核心与微软的CCI实现AOP框架微软、框架、核心、塞西尔

2023-09-03 09:15:27 作者:梦九

这是在能力方面的比较好,易于使用,文档,示例,社区/支持,VS集成,已知的实施,长期生存能力,并建立快速实现自定义的AOP框架?

Which is the better in terms of capabilities, easy of use, documentation, samples, community/support, VS integration, known implementations, long-term viability, and build speed to implement a custom AOP framework?

我会用我所知道的开始(我只是尝试PostSharp至今):

I'll start with what I know (I have only tried PostSharp to so far):

Microsoft通用编译器 Instrastruture(CCI):我读过, 用于FxCop的,ILMerge,规格#和 code合同。这似乎是非常低的水平,因为它甚至不照顾纠正偏移分支codeS是博肯当IL被修改,它的。 PostSharp 5岁,有很多 能力AOP(例如摘要 有些事情,你就需要有 与IL客场),源做手工 code可用,开发/支持 只有一个人,但他正计划 使这个企业,有 文档,但可以更好, 构建需要大约两倍的时间,很 关于如何注入IL小样本 和2.0版即将发布 这将大大改善。 单塞西尔:写的一个人,部分 在Mono套件的,并有一个 插件用于反射称为Reflexil 使用单塞西尔。 Microsoft Common Compiler Instrastruture (CCI): I've read that is used for FxCop, ILMerge, Spec# and Code Contracts. It seems to be very low level as it does not even take care of correcting offsets for branch codes that are borken when IL is modified with it. PostSharp is 5 years old, has many capabilities for AOP (e.g. abstracts some things you would need to have to do manually with IL away), source code available, developed/supported by only one guy but he is planning on making this a business, has documentation but could be better, builds take about twice as long, very little samples on how to inject IL and version 2.0 will be released soon which promises to be much improved. Mono Cecil: Written by one guy, part of the Mono suite and there is a plug-in for Reflector called Reflexil that uses Mono Cecil.

推荐答案

无论Microsoft.CCI和Mono.Cecil能做到是​​低层次的,并且不验证生产的组件。这需要大量的时间去寻找问题的原因,如果在产生code或组装结构中的任何错误。 我建议你​​使用PostSharp,如果它的功能足以让你的任务。 否则... Mono.Cecil能有更好的,更易于理解,易于使用的对象模型。不过,我有一个丑陋的错误,当我在程序中使用它(引用了错误的方法保存在装配;我想有一个与元数据标记处理了一些bug) Microsoft.CCI在同时缺少很多简单的功能一个丑陋的,完全过度设计的对象模型;然而,它比Mono.Cecil能做到更加成熟。最后,我放弃了Mono.Cecil能做到和使用Microsoft.CCI我的计划。

Both Microsoft.CCI and Mono.Cecil are low-level, and don't validate produced assemblies. It takes lots of time to find the reason of problem, if there is any error in generated code or assembly structure. I'd recommend using PostSharp if it's features are enough for you tasks. Otherwise... Mono.Cecil has better, more understandable and easy in use object model. However, I had an ugly bug when used it in my program (reference to the wrong method was saved in the assembly; I think there was some bug with metadata tokens handling) Microsoft.CCI has an ugly, utterly over-designed object model in the same time lacking many simple features; however, it's more mature than Mono.Cecil. Finally, I abandoned Mono.Cecil and used Microsoft.CCI for my program.