开发者

Using Ninject in a Custom Authorize Attributes

I'm using Ninject to Inject m开发者_开发百科y dependency in my Custom Authorize Attribute:

public class ValidatePermissionAttribute : AuthorizeAttribute, IAuthorizationFilter
{
    [Inject]
    public IUsuarioRepository UsuarioRepository { get; set; }
}

My module:

this.BindFilter<ValidatePermissionAttribute>(FilterScope.Global, null);

I'm trying to search some documentation about my question, but I don't find.

My Question is about the second parameter in BindFilter method: int? order. What does this mean?

All example I see have a 0 with parameter (Like this question Dependency Injection with Ninject and Filter attribute for asp.net mvc). But in my case the injection of property only works with null.


It defines the order in which the filters are executed. Filters with smaller values are executed first.

See http://bradwilson.typepad.com/blog/2010/07/service-location-pt4-filters.html about detailed information.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜