目录
1 IFilterFactory
1.1 /// Copied from MVC Core
2 IInvocation
2.1 /// Copy from Castle.Core.Invocation
using System;
namespace Flatwhite.Core
{
///
///
public interface IFilterFactory
{
///
/// Creates an instance of the
///
/// serviceProvider">The request
///
MethodFilterAttribute CreateInstance(IServiceProvider serviceProvider);
}
}
using System;
using System.Reflection;
namespace Flatwhite.Core
{
///
///
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);
}
}
}