/src/LinFu.AOP.Interfaces/IMethodReplacementProvider.cs

http://github.com/philiplaureano/LinFu · C# · 24 lines · 8 code · 1 blank · 15 comment · 0 complexity · 5220772848c3cf1b109c670d8df06997 MD5 · raw file

  1. namespace LinFu.AOP.Interfaces
  2. {
  3. /// <summary>
  4. /// Represents a type that can swap method body implementations at runtime.
  5. /// </summary>
  6. public interface IMethodReplacementProvider
  7. {
  8. /// <summary>
  9. /// Determines whether or not the current method implementation can be replaced.
  10. /// </summary>
  11. /// <param name="host">The target instance of the method call.</param>
  12. /// <param name="info">The <see cref="IInvocationInfo" /> that describes the context of the method call.</param>
  13. /// <returns><c>true</c> if the method can be intercepted; otherwise, it will return <c>false</c>.</returns>
  14. bool CanReplace(object host, IInvocationInfo info);
  15. /// <summary>
  16. /// Obtains the <see cref="IInterceptor" /> instance that will be used to replace the current method call.
  17. /// </summary>
  18. /// <param name="host">The target instance of the method call.</param>
  19. /// <param name="info">The <see cref="IInvocationInfo" /> that describes the context of the method call.</param>
  20. /// <returns>The interceptor that will intercept the method call itself.</returns>
  21. IInterceptor GetMethodReplacement(object host, IInvocationInfo info);
  22. }
  23. }