[More about Teddy's Aspect Weaver]

Teddy's Aspect Weaver Version 0.3 [Updated: 2005/09/27]

Changes:
  - Add the geting context info and getting context arguments ability
  - Fix some internal XPath bugs
  - Fix BeforeConstructorCall/BeforeMethodCall bugs
  - Fix the ILML Library parsing method parameter name bug
  - Add the object instance in aspect local stack ability, which means you can new any object in aspect code only if the type of you object is defined or can be referenced in the base assembly
  - Move assembly AspectWeaver.Attributes code to assembly AspectWeaver.Aspects

Sample of Getting Runtime Method Context Info and Method Arguments

Configuration

Teddy's Aspect Weaver Version 0.3 with Great Updating and Fixing, Especially the Implementing of Getting Runtime Method Context Info and Method Arguments in MSIL Level<?xml version="1.0" encoding="utf-8" ?> 
Teddy's Aspect Weaver Version 0.3 with Great Updating and Fixing, Especially the Implementing of Getting Runtime Method Context Info and Method Arguments in MSIL Level
<Configuration logFile="LogWeaving.xml" cleanTempFiles="false">
Teddy's Aspect Weaver Version 0.3 with Great Updating and Fixing, Especially the Implementing of Getting Runtime Method Context Info and Method Arguments in MSIL Level    
<BaseAssembly>..\TestLib\bin\Debug\TestLib.dll</BaseAssembly>
Teddy's Aspect Weaver Version 0.3 with Great Updating and Fixing, Especially the Implementing of Getting Runtime Method Context Info and Method Arguments in MSIL Level    
<OutputAssembly>..\TestLib\bin\Debug\TestLib_output.dll</OutputAssembly>
Teddy's Aspect Weaver Version 0.3 with Great Updating and Fixing, Especially the Implementing of Getting Runtime Method Context Info and Method Arguments in MSIL Level    
<AspectAssemblies>
Teddy's Aspect Weaver Version 0.3 with Great Updating and Fixing, Especially the Implementing of Getting Runtime Method Context Info and Method Arguments in MSIL Level        
<AspectAssembly uniqueName="TestAspectLib.dll" path="bin\Debug\TestAspectLib.dll" />
Teddy's Aspect Weaver Version 0.3 with Great Updating and Fixing, Especially the Implementing of Getting Runtime Method Context Info and Method Arguments in MSIL Level    
</AspectAssemblies>
Teddy's Aspect Weaver Version 0.3 with Great Updating and Fixing, Especially the Implementing of Getting Runtime Method Context Info and Method Arguments in MSIL Level    
<AdviceFiles>
Teddy's Aspect Weaver Version 0.3 with Great Updating and Fixing, Especially the Implementing of Getting Runtime Method Context Info and Method Arguments in MSIL Level        
<AdviceFile>Advice-Test.xml</AdviceFile>
Teddy's Aspect Weaver Version 0.3 with Great Updating and Fixing, Especially the Implementing of Getting Runtime Method Context Info and Method Arguments in MSIL Level    
</AdviceFiles>
Teddy's Aspect Weaver Version 0.3 with Great Updating and Fixing, Especially the Implementing of Getting Runtime Method Context Info and Method Arguments in MSIL Level
</Configuration>

TestClass.cs

Teddy's Aspect Weaver Version 0.3 with Great Updating and Fixing, Especially the Implementing of Getting Runtime Method Context Info and Method Arguments in MSIL Levelusing System;
Teddy's Aspect Weaver Version 0.3 with Great Updating and Fixing, Especially the Implementing of Getting Runtime Method Context Info and Method Arguments in MSIL Level
Teddy's Aspect Weaver Version 0.3 with Great Updating and Fixing, Especially the Implementing of Getting Runtime Method Context Info and Method Arguments in MSIL Level
namespace TestLib
}

TestAspectClass.cs

Teddy's Aspect Weaver Version 0.3 with Great Updating and Fixing, Especially the Implementing of Getting Runtime Method Context Info and Method Arguments in MSIL Levelusing System;
Teddy's Aspect Weaver Version 0.3 with Great Updating and Fixing, Especially the Implementing of Getting Runtime Method Context Info and Method Arguments in MSIL Level
using System.Reflection;
Teddy's Aspect Weaver Version 0.3 with Great Updating and Fixing, Especially the Implementing of Getting Runtime Method Context Info and Method Arguments in MSIL Level
using AspectWeaver.Aspects;
Teddy's Aspect Weaver Version 0.3 with Great Updating and Fixing, Especially the Implementing of Getting Runtime Method Context Info and Method Arguments in MSIL Level
Teddy's Aspect Weaver Version 0.3 with Great Updating and Fixing, Especially the Implementing of Getting Runtime Method Context Info and Method Arguments in MSIL Level
namespace TestAspectLib
}

After Weaving Code (decompiled)

Teddy's Aspect Weaver Version 0.3 with Great Updating and Fixing, Especially the Implementing of Getting Runtime Method Context Info and Method Arguments in MSIL Level  public class TestClass
  }

Description

In the sample, we can see, if you call the GetContextInfo() and GetArguments() from aspect classes which inherited from AspectWeaver.Aspects.Aspect which defined the two methods, the weaved code be translated to local reflection code, no additional dependence. But it is interesting that in fact, there are not any code in the two methods' body at all. Do you know why? :^)

Download Source Code

AspectWeaver0.5.zip

 

相关文章:

  • 2021-12-15
  • 2022-12-23
  • 2022-12-23
  • 2021-10-05
  • 2022-12-23
  • 2022-12-23
  • 2021-12-08
  • 2022-02-22
猜你喜欢
  • 2021-12-17
  • 2021-08-28
  • 2021-12-10
  • 2021-04-19
  • 2022-12-23
  • 2022-12-23
  • 2021-06-30
相关资源
相似解决方案