Teddy's Aspect Weaver Version 0.2 with Additional Custom Attribute Way Configuration
来源:互联网 发布:数据统计怎么做 编辑:程序博客网 时间:2024/05/22 03:11
1. Introduction
In Build a More Powerful AOP Framework Based on AspectDNG's ILML Library - Teddy's Aspect Weaver, I built the Teddy's Aspect Weaver Version 0.1 with the xml based meta way configuration support. And this time, in version 0.2, I provide the addtional custom attribute way configuration support. You can use both meta way and custom attribute way configuration in even one weaving project.
Below is the usage sample:
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>
</Configuration>
<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>
</Configuration>
TestAspectClass.cs
using System;
using AspectWeaver.Attributes;
namespace TestAspectLib
{
public class TestAspectClass
{
[Introduce("//Type[@name='TestClass']")]
private string fieldToBeIntroducedByCustomAttribute = "fieldToBeIntroducedByCustomAttribute";
[Introduce("//Type[@name='TestClass']")]
public void MethodToBeIntrodcuedByCustomAttribute()
{
}
}
[Introduce()]
public class ClassToBeIntroducedByCustomAttribute
{
}
}
using AspectWeaver.Attributes;
namespace TestAspectLib
{
public class TestAspectClass
{
[Introduce("//Type[@name='TestClass']")]
private string fieldToBeIntroducedByCustomAttribute = "fieldToBeIntroducedByCustomAttribute";
[Introduce("//Type[@name='TestClass']")]
public void MethodToBeIntrodcuedByCustomAttribute()
{
}
}
[Introduce()]
public class ClassToBeIntroducedByCustomAttribute
{
}
}
This sample is part of sample with both meta way and custom attribute way configuration within AspectWeaver0.2 source code. Be careful, don't define the same advice both in meta xml and custom attribute, or that may cause error. And only the advices with a code element can be configurated with the new custom attribute way. Advices can be configurated by the new way are: Introduce, BeforeConstructor/AfterConstructor, BeforeMethodCall/AfterMethodCall, InlineAtStart, InlineBeforeReturn and AroundBody.
2. Download Source Code
AspectWeaver0.3.zip
- Teddy's Aspect Weaver Version 0.2 with Additional Custom Attribute Way Configuration
- Teddy's Aspect Weaver Version 0.6
- Teddy's Aspect Weaver Version 0.5
- Teddy's Aspect Weaver Version 0.3 with Great Updating and Fixing, Especially the Implementing of Getting Runtime Method Context
- Creating Custom Configuration Sections in Web.config Using .NET 2.0's Configuration API
- Creating Custom Configuration Sections in Web.config Using .NET 2.0's Configuration API
- magento custom api configuration
- Db Attribute(Custom ORM ) Usage
- [收藏]The three kinds of aspect configuration
- [收藏]The three kinds of aspect configuration
- [收藏]The three kinds of aspect configuration
- Aspect Oriented Programming with Spring
- Aspect Oriented Programming with Spring
- What's the nicest way to do observer/observable in objective-c (iphone version)
- additional
- c-version:null]] could not deserialize the servlet-context scoped attribute with name: "MENU_LIST"
- jpivot : javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "test" with value "${query01
- Spring-boot项目additional-spring-configuration-metadata.json源码
- AOP编程实践之AspectWeaverSample1.0
- 高精度计时器---QueryPerformanceFrequency()与QueryPerformanceCounter()的使用
- Teddy's Aspect Weaver Version 0.6
- Teddy's Aspect Weaver Version 0.5
- Teddy's Aspect Weaver Version 0.3 with Great Updating and Fixing, Especially the Implementing of Getting Runtime Method Context
- Teddy's Aspect Weaver Version 0.2 with Additional Custom Attribute Way Configuration
- miscdevice、platform_device区别?
- 微软发布了Internet Explorer Developer Toolbar Beta版 - 实在是太爽了,使用过后我就想亲Bill叔叔
- “Hello World” Example with AspectDNG
- Introduction to AspectDNG in Details.
- How to Choose an AOP Framework?
- The Present AOP Frameworks in .Net
- What Is AOP?
- Why AOP?