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

推荐订阅源

爱范儿
爱范儿
博客园_首页
W
WeLiveSecurity
S
Secure Thoughts
S
Security @ Cisco Blogs
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Hugging Face - Blog
Hugging Face - Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
H
Hacker News: Front Page
Project Zero
Project Zero
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
U
Unit 42
N
News and Events Feed by Topic
N
News and Events Feed by Topic
Hacker News - Newest:
Hacker News - Newest: "LLM"
Forbes - Security
Forbes - Security
T
Tor Project blog
I
Intezer
B
Blog
F
Full Disclosure
Security Archives - TechRepublic
Security Archives - TechRepublic
F
Fortinet All Blogs
Schneier on Security
Schneier on Security
T
Threat Research - Cisco Blogs
AI
AI
Google DeepMind News
Google DeepMind News
L
LINUX DO - 最新话题
Cloudbric
Cloudbric
L
Lohrmann on Cybersecurity
WordPress大学
WordPress大学
博客园 - 聂微东
雷峰网
雷峰网
P
Privacy International News Feed
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
PCI Perspectives
PCI Perspectives
Y
Y Combinator Blog
Spread Privacy
Spread Privacy
Simon Willison's Weblog
Simon Willison's Weblog
罗磊的独立博客
Vercel News
Vercel News
A
Arctic Wolf
The Register - Security
The Register - Security
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Microsoft Azure Blog
Microsoft Azure Blog
H
Heimdal Security Blog
Know Your Adversary
Know Your Adversary
P
Proofpoint News Feed
C
Cybersecurity and Infrastructure Security Agency CISA
P
Proofpoint News Feed

博客园 - bobmazelin

Microsoft Robotics Developer Studio基础(一):前言 Microsoft Robotics Developer Studio beta4的大bug Microsoft Robotics Developer Studio4 Beta随想 最近动态记录 走入Microsoft Robotics Developer Studio世界 【工作流】工作流结构模式整理 【工作流】PE中的资源模式的实现方式 【讨论】【工作流】由资源模式中的“权限分配”想到资源结构 【PE】流程图对象以及事件驱动机制的介绍 【讨论】WF中的异常(错误)处理 【讨论】基于WF的流程结构 建立基于WF工作流模式库的设想 2008:再战Business Process Management System(BPMs) bobmazelin的流程管理系统介绍和概念性设计(三) bobmazelin的流程管理系统介绍和概念性设计(二) bobmazelin的流程管理系统介绍和概念性设计(一) AspectNet功能介绍(二) 在(开发)流程系统之前 在Sequence模式中思考流程资源(数据)问题
AspectNet功能介绍(一)
bobmazelin · 2007-06-29 · via 博客园 - bobmazelin

AspectNet是一个基于.Net Framework的方面编制器,它同时能实现静态编织和动态编织,是bobmazelin个人的研究性项目,现仍然处于开发阶段,有关AOP概念的介绍请参考:www.aspectJ.org以及IBM的专题.

这是AspectNet功能介绍的第一篇,我主要介绍AspectNet在静态编织方面的基本结构.

AspectNet在很大程度上参考了aspectJ,它通过MSIL代码来实现静态编织,由此AspectNet不需要源代码,同时它也可以混合编织C#和VB.Net(理论上VC++.Net也可以)产生的动态链接库.

AspectNet由Aspect组成,每个Aspect都可以声明若干个pointcut,storage以及advice.

1. pointcut的概念和aspectJ基本一致,它捕获需要被织入的代码点;

2. storage是ApsectNet特有的概念,它和pointcut类似,捕获需要织入到pointcut的代码;

3. advice的概念和aspectJ基本一致,但它不需要写任何C#或其他代码,它连接了pointcut和storage,使他们形成了多对多的关系映射.

下面给一个简单的例子来说明这3个概念:

namespace Bob.Mazelin
{
    aspect Demo
    {
        pointcut AddDemo1():call(public void Mazelin.AspectNet.TestProject.TestClass.Demo1());

        before():AddDemo1():PrintBefore();

        after():AddDemo1():PrintAfter();


        storage PrintBefore():call(public void Mazelin.AspectNet.TestProject.PrintClass.PrintBefore());
        storage PrintAfter():call(public void Mazelin.AspectNet.TestProject.PrintClass.PrintAfter());   
    }
}

其中AddDemo1是pointcut的名字,它捕获了Demo1方法,该方法没有返回值,也没有参数,其被全称为Mazelin.AspectNet.TestProject.TestClass类声明.call关键字表明了捕获点为调用该方法的程序点;

PrintBefore和PrintAfter是两个storage类型,它们分别捕获了PrintBefore和PrintAfter方法,其解释意义和pointcut类似;

before和after是advice,它连接了AddDemo1和PrintBefore,PrintAfter,使PrintBefore和PrintAfter分别在AddDemo1调用前和后被调用.

当需要织入的DLL和aspect文件一起运行后,会产生新的织入代码后的DLL.这样的织入方式基本不影响代码的性能,和手工编写代码类似,和动态编织的方式相比性能好,但缺乏灵活性.

今天就先到这里,下次我会介绍AspectNet中call和execution pointcut的使用,还请对AOP由兴趣的朋友多提宝贵意见.

附:很对不起大家,现阶段ApsectNet还不提供下载.