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
2005-09-27 10:43
706 查看
[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
<?xml version="1.0" encoding="utf-8" ?>
<Configuration logFile="LogWeaving.xml" cleanTempFiles="false">
<BaseAssembly>..\TestLib\bin\Debug\TestLib.dll</BaseAssembly>
<OutputAssembly>..\TestLib\bin\Debug\TestLib_output.dll</OutputAssembly>
<AspectAssemblies>
<AspectAssembly uniqueName="TestAspectLib.dll" path="bin\Debug\TestAspectLib.dll" />
</AspectAssemblies>
<AdviceFiles>
<AdviceFile>Advice-Test.xml</AdviceFile>
</AdviceFiles>
</Configuration>
TestClass.cs
using System;
namespace TestLib
using System;
using System.Reflection;
using AspectWeaver.Aspects;
namespace TestAspectLib
public class TestClass
public void MethodToBeTestedGetContextInfoAndGetArgumments(object p1, string p2, int p3)
MethodBase methodBase = base.GetType().GetMethod("MethodToBeTestedGetContextInfoAndGetArgumments");
Console.Write(String.Concat(methodBase.ReflectedType.FullName, "::", methodBase.Name, "\n\n"));
object[] locals = new object[] Console.Write(String.Format("Arguments: {0}, {1}, {2}\n\n", locals));
}
public void MethodToTestGetContextInfoAndGetArgumments()
MethodToBeTestedGetContextInfoAndGetArgumments("p1", "p2", 3);
}
}
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
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
<?xml version="1.0" encoding="utf-8" ?>
<Configuration logFile="LogWeaving.xml" cleanTempFiles="false">
<BaseAssembly>..\TestLib\bin\Debug\TestLib.dll</BaseAssembly>
<OutputAssembly>..\TestLib\bin\Debug\TestLib_output.dll</OutputAssembly>
<AspectAssemblies>
<AspectAssembly uniqueName="TestAspectLib.dll" path="bin\Debug\TestAspectLib.dll" />
</AspectAssemblies>
<AdviceFiles>
<AdviceFile>Advice-Test.xml</AdviceFile>
</AdviceFiles>
</Configuration>
TestClass.cs
using System;
namespace TestLib
using System;
using System.Reflection;
using AspectWeaver.Aspects;
namespace TestAspectLib
public class TestClass
public void MethodToBeTestedGetContextInfoAndGetArgumments(object p1, string p2, int p3)
MethodBase methodBase = base.GetType().GetMethod("MethodToBeTestedGetContextInfoAndGetArgumments");
Console.Write(String.Concat(methodBase.ReflectedType.FullName, "::", methodBase.Name, "\n\n"));
object[] locals = new object[] Console.Write(String.Format("Arguments: {0}, {1}, {2}\n\n", locals));
}
public void MethodToTestGetContextInfoAndGetArgumments()
MethodToBeTestedGetContextInfoAndGetArgumments("p1", "p2", 3);
}
}
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
相关文章推荐
- Teddy's Aspect Weaver Version 0.3 with Great Updating and Fixing, Especially the Implementing of Getting Runtime Method Context
- Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration info
- Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additio
- “System.IO.FileLoadException: Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 错误
- What is the difference between SVD and matrix factorization in context of recommendation engine?
- Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP
- 海洋工作室——网站建设专家:The version of SQL Server in use does not support datatype datetime2 and the Entity Framework.
- Could not find the required version of the Java(TM)2 Runtime Environment in '(null)' 解决办法
- R and SAS in the curriculum: getting students to "think with data"
- The value of CFBundleShortVersionString in your WatchKit app's Info.plist (1.0) does not match
- Description Resource Path Location Type Java compiler level does not match the version of the in解决方法
- The method setClass(Context, Class<?>) in the type Intent is not applicable for the arguments (GameV
- CFBundleVersion in the Info.plist file must contain a higher version than that of the previously uploaded version.
- Installation failed with message...It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing.
- Implementing the Repository and Unit of Work Patterns in an ASP.NET MVC Application (9 of 10)
- CFBundleVersion in the Info.plist file must contain a higher version than that of the previously upl
- UserWarning: The installed version of numexpr 2.4 is not supported in pandas and will be not be used
- How to craw the Info of BiliBIli with python in Parallel
- 安装J2EE的SDK报错:could not find the required version of the Java(TM)2 Runtime Environment in '(null)'的解决
- Mixed mode assembly is built against version 'v1.1.4322' of the runtime and...问题——C# DirectXSound