惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

aimingoo的专栏
aimingoo的专栏
月光博客
月光博客
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
阮一峰的网络日志
阮一峰的网络日志
博客园_首页
Last Week in AI
Last Week in AI
The Cloudflare Blog
IT之家
IT之家
Hugging Face - Blog
Hugging Face - Blog
美团技术团队
S
SegmentFault 最新的问题
量子位
大猫的无限游戏
大猫的无限游戏
Recent Announcements
Recent Announcements
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Microsoft Security Blog
Microsoft Security Blog
云风的 BLOG
云风的 BLOG
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
I
InfoQ
人人都是产品经理
人人都是产品经理
G
Google Developers Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Engineering at Meta
Engineering at Meta

博客园 - Gordon Golden Shining

who am I inside of me STGenerator Released ObjectDataSource的Add-In Asp.net page lifecycle explain in msdn 我做的代码生成的工具的思路 (支持.NET2.0) Programming Haskell in Visual Studio.net 2003 C#/VB.Net converter A good book to read A possible way for testing threading/server application a break in .net 2.0 remoting WinXP sp2 and win 2003 does break com+/System.Transaction 2.0 You have to read this All about codes generation New tools box for year 2005 Recommend: IOC container must read article dynamic proxy how to My Wishlist for .net development some common used tips in web development No refresh dropdownlist using xmlhttp callback
How to implement AOP in .net
Gordon Golden Shining · 2005-08-02 · via 博客园 - Gordon Golden Shining

How to implement AOP in .net

I did some research on the AOP, just want to share the info. There are three types
of realization. Let's look up currently how the AOP project implement them.

1. Use reflection emit, we can dynamicly create the proxy object and emit an inherit
class with the interceptor class called. Mostly of current so called AOP for .net
using this type of implementation.
Examples: Castle

2. Use CodeDom to generate the code to complete the static weave process.
However, microsoft doesn't provide an CodeDom parse implementation. There are some
parser for C#, but not mature or quite hard to use. And they have to be in the source code
level. Also CodeDom is a good concept but with many limitation.
Exmples: EOS (no source released but only the research thesis)

3. I reckon this is the best solution at this time. RAIL is a microsoft funded project
to allow you directly modify IL codes, which means you don't need a parser, and not in
the source code level, you can directly load the assembly and modify it.
you definitely should download and check it yourself...
Examples: AspectDNG

It is actually quite disappointing. There are some aop .net implementations, but really
there is no one ready to use and mature like AspectJ... what a shame...

I also implemented a micro dynamic proxy example for demonstration,  if you interested, I may write another
document about how to make dynamic proxy with Reflection.Emit

here are the web sites you should take a look:
http://www.castleproject.org -- castle
http://www.dsg.cs.tcd.ie/index.php?category_id=169 -- aspectC#
http://www.antlr.org -- parser
http://www.codeproject.com/csharp/CodeDOMparser.asp -- CSharp parser for CodeDom
http://rail.dei.uc.pt/ -- RAIL (Runtime Assembly Instrumenation Library)
http://www.cs.virginia.edu/~eos/ -- EOS project
http://www.dotnetguru.org/modules.php?op=modload&name=IncludePage&file=AspectDNG -- AspectDNG