Teddy's Aspect Weaver Version 0.2 with Additional Custom Attribute Way Configuration

Source: Internet
Author: User
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>

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
{
}
}

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 initialized with the new custom attribute way. advices can be protected by the new way are: Introduce, BeforeConstructor/AfterConstructor, BeforeMethodCall/AfterMethodCall, InlineAtStart, InlineBeforeReturn and AroundBody.

2. Download Source Code

AspectWeaver0.3.zip

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.