Return to Contents
6. “Hello World” Example with AspectDNG
In this chapter, let’s try to use AspectDNG to do an AOP example together.
Firstly, I define the base and aspect assemblies as below:
TestBaseClass.cs in BaseLib.dll



























































TestAspectClass.cs in AspectLib.dll
















































































The AspectDngConfig and Advice configuration are as below:
AspectDngConfig.xml















HelloAspectDngAdvice.xml





































































After execute the command:
aspectdng.exe –w AspectDngConfig.xml
BaseLib.dll is statically weaved and the source code (decompiled by Salamander) becomes below:





























































Conclusion
The uncommented operations defined in HelloAspectDngAdvice.xml are executed successfully. The commented code was also tested, but either failed or ignored by AspectDNG, seams they haven’t been supported correctly or not supported yet. And we can also check the weaving log file.
BaseLib.weaving.xml































Source Code Download
HelloAspectDNG.zip