目录
2.1 /// Copy from Castle.Core.Invocation
using System;
namespace Flatwhite.Core
{
/// <summary>
/// </summary>
public interface IFilterFactory
{
/// <summary>
/// Creates an instance of the <see cref="MethodFilterAttribute"/> filter.
/// </summary>
/// <param name="serviceProvider">The request <see cref="IServiceProvider"/>.</param>
/// <returns>An instance of the executable filter.</returns>
MethodFilterAttribute CreateInstance(IServiceProvider serviceProvider);
}
}
using System;
using System.Reflection;
namespace Flatwhite.Core
{
/// <summary>
/// </summary>
public interface IInvocation
{
object[] Arguments { get; }
Type[] GenericArguments { get; }
object InvocationTarget { get; }
MethodInfo Method { get; }
MethodInfo MethodInvocationTarget { get; }
object Proxy { get; }
object ReturnValue { get; set; }
Type TargetType { get; }
void Proceed();
}
internal class Invocation : IInvocation
{
public object[] Arguments { get; set;}
public Type[] GenericArguments { get; set;}
public object InvocationTarget { get; set;}
public MethodInfo Method { get; set;}
public MethodInfo MethodInvocationTarget { get; set;}
public object Proxy { get; set;}
public object ReturnValue { get; set; }
public Type TargetType { get; set;}
public void Proceed()
{
ReturnValue = Method.Invoke(InvocationTarget, Arguments);
}
}
}