Premise
Refer to the following file
Microsoft.Practices.ObjectBuilder2.dll
Microsoft.Practices.Unity.dll
Microsoft.Practices.Unity.Configuration.dll
Microsoft.Practices.Unity.Interception.dll
Microsoft.Practices.Unity.Interception.Configuration.dll
Microsoft.Practices.Unity.StaticFactory.dll
can download from website http://unity.codeplex.com/
The implementation class in this article inherits from the Ioutput interface
1: public interface IOutput {
2: void Output(int x);
3: }
Implementation effect
I have two methods to output strings, call Ioutput implementation classes to output, such as:
1: class OutputImplement2 : IOutput {
2: public void Output(int x) {
3: Console.WriteLine("output:{0}", x);
4: }
5: }
Call it in the main function
1: var op2=new OutputImplement2();
2: op2.Output(22);
, and the role of AOP is to op2 through other code. The final result of an output method being injected into another execution before or after execution may be:
Here in addition to the arrow refers to a sentence outside the other is injected into this method.