CR feedback
This commit is contained in:
parent
7ddf8a7bdb
commit
28e0792db6
|
|
@ -4,7 +4,7 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Microsoft.AspNet.Mvc.Filters
|
namespace Microsoft.AspNet.Mvc.Filters
|
||||||
{
|
{
|
||||||
// This one lives in the FilterDescriptors namespace, and only intended to be consumed by folks that rewrite the action invoker.
|
// This one lives in the Filters namespace, and only intended to be consumed by folks that rewrite the action invoker.
|
||||||
public class ReflectedActionFilterEndPoint : IActionFilter
|
public class ReflectedActionFilterEndPoint : IActionFilter
|
||||||
{
|
{
|
||||||
private readonly Func<object[], Task<object>> _coreMethodInvoker;
|
private readonly Func<object[], Task<object>> _coreMethodInvoker;
|
||||||
|
|
|
||||||
|
|
@ -55,8 +55,7 @@ namespace Microsoft.AspNet.Mvc.Filters
|
||||||
if (typeFilterSignature != null)
|
if (typeFilterSignature != null)
|
||||||
{
|
{
|
||||||
// TODO: How do we pass extra parameters
|
// TODO: How do we pass extra parameters
|
||||||
var typeFilter =
|
var typeFilter = ActivatorUtilities.CreateInstance(ServiceProvider, typeFilterSignature.ImplementationType);
|
||||||
ServiceProvider.GetService<TypeActivator>().CreateInstance(typeFilterSignature.ImplementationType);
|
|
||||||
|
|
||||||
AddFilters(context, typeFilter, true);
|
AddFilters(context, typeFilter, true);
|
||||||
failIfNotFilter = false;
|
failIfNotFilter = false;
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ namespace Microsoft.AspNet.Mvc
|
||||||
{
|
{
|
||||||
public class FilterDescriptorComparer : IComparer<FilterDescriptor>
|
public class FilterDescriptorComparer : IComparer<FilterDescriptor>
|
||||||
{
|
{
|
||||||
private static FilterDescriptorComparer _comparer = new FilterDescriptorComparer();
|
private static readonly FilterDescriptorComparer _comparer = new FilterDescriptorComparer();
|
||||||
|
|
||||||
public static FilterDescriptorComparer Comparer { get { return _comparer; } }
|
public static FilterDescriptorComparer Comparer { get { return _comparer; } }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
public static class FilterOrigin
|
public static class FilterOrigin
|
||||||
{
|
{
|
||||||
public static readonly int Action = 100;
|
public static readonly int Action = 100;
|
||||||
public static readonly int Controlller = 200;
|
public static readonly int Controller = 200;
|
||||||
public static readonly int Global = 300;
|
public static readonly int Global = 300;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ namespace Microsoft.AspNet.Mvc
|
||||||
var controllerAttributes = cd.ControllerTypeInfo.GetCustomAttributes(inherit: true).ToArray();
|
var controllerAttributes = cd.ControllerTypeInfo.GetCustomAttributes(inherit: true).ToArray();
|
||||||
var globalAndControllerFilters =
|
var globalAndControllerFilters =
|
||||||
controllerAttributes.OfType<IFilter>()
|
controllerAttributes.OfType<IFilter>()
|
||||||
.Select(filter => new FilterDescriptor(filter, FilterOrigin.Controlller))
|
.Select(filter => new FilterDescriptor(filter, FilterOrigin.Controller))
|
||||||
.Concat(_globalFilters)
|
.Concat(_globalFilters)
|
||||||
.OrderBy(d => d, FilterDescriptorComparer.Comparer)
|
.OrderBy(d => d, FilterDescriptorComparer.Comparer)
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue