Here is my CustomActionFilterAttribute
public class CustomActionFilterAttribute : ActionFilterAttribute
{
private string _param1;
private string _param2;
UserManager<IdentityUser> _userManager;
public QBAuthorizeAttribute(string param1,string param2, UserManager<IdentityUser> userManager)
{
this._param1= param1;
this._param2= param2;
this._userManager = userManager;
}
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
//some code using _userManager
}
}
But how to use this Attribute in controller?
I have tried using with this line
CustomActionFilter("param1", "param2",_userManager)
but getting the following compile time error
An object reference is required for non-static field,method or property
Please suggest if we can do this with dependency injection and also inject some more custom services.