. Net camp's AOP Tool

Source: Internet
Author: User

 

. Net camp's AOP Tool

Today Net AOP frameworks Research Report V1.1 The source code of the AOP implementation solution listed in. Net has passed through. Every time I read the self-introduction of a solution, the first thing I see is its function positioning. By introducing itself and providing documents and examples, you can naturally locate their respective functions. A judgment. 1. aspect # In all the solutions, the technical capabilities are not limited, but the quality of their positioning and documentation. , Aspect # gives me the feeling that the positioning is the clearest and the document quality is the highest. First, it is clearly positioned, so it can be included as a sub-project by the castle project. Project. In fact, aspect # Is Castle. dynamicp Roxy extension, while Castle. dynamicproxy is essential Is through reflection, emit, delegate Dynamically generate PR for non-sealed virtual methods at runtime Oxy class. Aspect # defines a set of configu based on this Ration language. Oxy to Minin and intercept. Aspect # The limitation is the natural limitation of dynamicproxy Because only the virtual side of the non-sealed class must inherit the original class. Method "can be intercept, Which is insurmountable. Aop.net's original implementation is probably the same idea. (Also worth mentioning, Castle The official homepage of. dynamicproxy includes the blog source zhengyulu. Introduction to Castle. dynamicpro in the blog XY used Article Links ~~, See: http://www.castleproject.org /Index. php/dynamicproxy) Of course, from a technical point of view, dynamicproxy is not advanced at all. (Compared to IL-level weaving like rail ), He also has its natural advantages: first, his principle is very easy to understand; second, it is easy to use. Third, based on a hypothesis, that is, in Ood, the correct design is often widely used. Interfaces are used to reduce coupling and implement various pattern. Most important services Code Are all virtual methods. Therefore, although dynamicpr Oxy is a highly restrictive mechanism. In fact, it is necessary to provide a wide range of users. Is based on the natural combination of the castle project, the user's aspect # Trust is naturally useless to question. These make aspect # It will succeed! In addition, its document quality and sample code are very simple and easy to understand. His two minute tutorial is actually used when two minute is implemented. This is also worth learning from other AOP solutions. 2. aspectdng Aspectdng and aspect # are actually very similar. That is, he and aspect # are based on another class library rail. What is rail? In short, rail is used for static weaving. Yes, you give me any assembly, as long as there is no confusion , I can use rail to modify the original code at the Il level. The modifications include expansion, merge, and intercept. , Delete, etc. In short, from modifying the original Program From the perspective of Set In theory, it is omnipotent. Aspectdng Based on Rail And defines a set of ilml languages in XML format. The original assembly can be split into ilml format to facilitate user modification. After the modification, the new Assembly will be assembled. The location of aspectdng is very clear, that is, the static assembly And provides a lot of convenient class libraries for static weaving into the old assembly. . But remember, aspectdng only provides static weaving, which is its positioning. . And like Eos, it is similar to him, But EOS provides a very similar Aspectj syntax, but in essence, it is almost static IL-level weaving. However, the aspectdng documentation is a little worse than aspect #. The Code contains French words and comments, which is too unfriendly. Fortunately, its examples are simple and clear, while the documents and examples of the Rail class library itself It is relatively concise and easy to understand. Therefore, it is not too difficult to use.

Comment

The above two are the best implementation of AOP in the current. NET environment. They are two very clear ideas, both of which use the existing third-party class libraries as the basis. . It is worth thinking that none of the other solutions has succeeded in these two solutions, not just because of other The configuration method provided by the solution is not perfect. And because, in other solutions, anyone who wants to achieve their own status is equivalent to cast Le. dynamicproxy or rail class library It is easy to fall into an abyss. This is because it must be very good and functional. , Stable, and trustworthy class libraries are really not an easy task. .

From the perspective of the underlying technology, the mainstream AOP framework generally has the following three ways of weaving:

1. dynamicproxy-based runtime interceptioN; 2. Static weaving Based on the Il level; 3. Dynamic Loading Based on the Il level;From the perspective of the configuratuion method, the mainstream AOP framework generally has the following four configuration methods:1. Independent custom configuration similar to aspect #Format; 2. XML-based configura, similar to aspectdngTion format; 3. custom attribute-based configuration format; 4. Specific language extensions similar to aspectj and corresponding compiler;1. Aspect #

Version: 2.1.1 . 0

Link:Http://aspectsharp.sourceforge.net/

Status: Beta

Dependency: anlr, Castle. dynamicproxy

Description:

Aspect # Is an AOP (Aspect Oriented Programming) Framework for the CLI (. net and mono ). it relies on dynamicproxy and offers a built-in language to declare and configure aspects, and is compliant to aopalliance. it became part of the castle project in June 2005.

Main Features:

-Custom mini configuration language, not XML.

-Mix/intercept classes and methods through dicnamic proxy approach.

Restrictions:

- Classes to be created dynamic proxy for shouldn't be sealed and only virtual methods can be intercepted.

- Using intercepted classes is not completely transaparent to users that users shocould explain it create the dynamically proxied class through the aspectengine.

- No static weaving support.

2.Aspectdng

Version: 0.7

Status: Beta

Link:Http://www.dotnetguru.org/downloads/AspectDNG ???

Dependency: Mono. petoolkit, rail

Description:

Aspectdng is. net aspect Weaver, that's to say a tool that can "transplant" code into an existing assembly. this transplant is made after the standard. net compilation, which means that both aspect and the so called "base" Code (the one the transplant will be operated on) can be developped in any programming language that is compatible. net cls. another way to say that: aspectdng works on assemblies (exe or DLL) that may have been created out of C #, VB. net, Eiffel. net, mananged C ++...

Main Features:

- XML, XPath based configuration file format.

- Il level static weaving.

- Custom XML basedDisassembledLanguageIlml which can be used to convert assemblies to and be modified/combined and then converted to assemblies.

Restrictions:

- Static weaving only.

- Not very stable.

3. EOS

Version: 0.3.3

Link:Http://www.cs.virginia.edu /~ EOS

Status: Beta

Dependency: None

Description:

EOS is an aspect-oriented extension for C # on Microsoft. net Framework. EOS aims to improve upon the current Aspect-Oriented Language Model in three dimensions. first, it generalizes aspect instantiation & advice weaving model to eliminate the need for the work-arounds that are unavoidable today when aspects are used to express certain crosscutting concerns. second it generalizes the join point model. third it aims to eliminate the distinction between class and aspect constructs in favor of a single conceptual building block that combines the expressive capabilities of current classes and aspects, significantly improving conceptual integrity and uniformity in language design.The language is very similar to aspectj before t for constructs which are not implemented in Eos and constructs which aspectj does not provides.

Main Features:

- Aspectj like extended C # langauage and custom compiler.

Restrictions:

-Static weaving only.

-Not very stable.

4.Encase

Version: 0.7

Link:Http://theagiledeveloper.com/category/15.aspx

Status: Beta

Dependency: None

Description:

Encase is an aspect oriented programming framework for. NET platform written in C #. encase is unique in that it provides aspects to be applied during runtime in managed code rather then being configuration file based that other AOP frameworks rely. the advantage of applying aspects in this way is that it promotes productivity to developers new and/or unfamiliar with AOP.

Restrictions:

-Encase cannot Mixin multiple classes that implement a shared interface? For instance, if Class A implements ialphabet, and Class B implements ialphabet, classes A and B can not both be mixed in as an aspect.

-Encase can only provide interception and aspect weaving to virtual (overriable) methods and properties.

-Encase is unable to apply aspects to sealed (notinheritable) classes.

-Like aspect #, but more unstable.

5.Post #

Version: 1.0.0 . 0

Link:Http://gael.fraiteur.net/postsharp.aspx

Status: Alpha

Dependency: None

Description:

Postsharp isFree and open-source post-compiler for the. NET Framework. Postsharp is an extensible platform that makes it easy to develop and execute static program analysis and program transformation plug-ins.

Main Features:

-Developped under. NET Framework 2.0 Beta

-There is a very good third pary collection library-"xipho. Collections" for. NET 2.0 in the source code

Restrictions:

- Not say to be a really AOP framework yet.

6. Loom. net

Version: 1.5 beta2

Link: http://www.dcl.hpi.uni-Potsdam. De/research/loom/

Status: Beta

Dependency: None

Description:

The loom. net project aims to investigate and promote the usage of AOP in the context of the Microsoft. net Framework. we have been developing two AOP tools (so called weavers) that all implement different approaches to weaving: a runtime Weaver crating weaved objects on the fly and a static Weaver.

Main

- Support under. NET Framework 2.0 Beta

-Include both dynamic proxy Based Dynamic interception and IL level rail like static weaving support.

Restrictions:

- Not very stable.

7. Others

Aspectc # (aspectj like C # extended compiler)Http://www.dsg.cs.tcd.ie/index . Php? Category_id = 169 Weave. Net (provide a load-Time il level weaving implementing)Http://www.dsg.cs.tcd.ie/index . Php? Category_id = 194

Features:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.