/src/LinFu.AOP/Interfaces/IAroundMethodWeaver.cs

http://github.com/philiplaureano/LinFu · C# · 33 lines · 11 code · 3 blank · 19 comment · 0 complexity · 3b8eb70037e243481e172e55d389f7a6 MD5 · raw file

  1. using Mono.Cecil;
  2. using Mono.Cecil.Cil;
  3. namespace LinFu.AOP.Cecil.Interfaces
  4. {
  5. /// <summary>
  6. /// Represents a class that adds a method
  7. /// epilog and prolog to an existing method instance.
  8. /// </summary>
  9. public interface IAroundMethodWeaver : IHostWeaver<TypeDefinition>
  10. {
  11. /// <summary>
  12. /// Determines whether or not the current item should be modified.
  13. /// </summary>
  14. /// <param name="method">The target item.</param>
  15. /// <returns>Returns <c>true</c> if the current item can be modified; otherwise, it should return <c>false.</c></returns>
  16. bool ShouldWeave(MethodDefinition method);
  17. /// <summary>
  18. /// Adds an prolog to the target method.
  19. /// </summary>
  20. /// <param name="firstInstruction">The instruction that marks the start of the <paramref name="methodBody" /></param>
  21. /// <param name="methodBody">The method body of the target method.</param>
  22. void AddProlog(Instruction firstInstruction, MethodBody methodBody);
  23. /// <summary>
  24. /// Adds an epilog to the target method.
  25. /// </summary>
  26. /// <param name="lastInstruction">The instruction that marks the end of the <paramref name="methodBody" /></param>
  27. /// <param name="methodBody">The method body of the target method.</param>
  28. void AddEpilog(Instruction lastInstruction, MethodBody methodBody);
  29. }
  30. }