asp.net-web-api-filters

How to do dependency injection to Action Filter on ASP.NET Web API

扶醉桌前 提交于 2020-01-12 04:06:30
问题 I really get stuck on the approach to do dependency injection into action filter of web api. I have an action filter like this: public class AuthorizationAttribute : ActionFilterAttribute { public IApiKeyRepository Repository { get; set; } private Guid GetApiKey(string customerKey) { return Repository.GetApiKey(customerKey); } public override void OnActionExecuting(HttpActionContext actionContext) { } } I would like to do property injection on the property Repository by using Windsor (but it

How to do dependency injection to Action Filter on ASP.NET Web API

為{幸葍}努か 提交于 2020-01-12 04:06:29
问题 I really get stuck on the approach to do dependency injection into action filter of web api. I have an action filter like this: public class AuthorizationAttribute : ActionFilterAttribute { public IApiKeyRepository Repository { get; set; } private Guid GetApiKey(string customerKey) { return Repository.GetApiKey(customerKey); } public override void OnActionExecuting(HttpActionContext actionContext) { } } I would like to do property injection on the property Repository by using Windsor (but it

How to do dependency injection to Action Filter on ASP.NET Web API

南笙酒味 提交于 2019-12-03 05:41:47
I really get stuck on the approach to do dependency injection into action filter of web api. I have an action filter like this: public class AuthorizationAttribute : ActionFilterAttribute { public IApiKeyRepository Repository { get; set; } private Guid GetApiKey(string customerKey) { return Repository.GetApiKey(customerKey); } public override void OnActionExecuting(HttpActionContext actionContext) { } } I would like to do property injection on the property Repository by using Windsor (but it does not matter which IoC container is used) I did come up to customize FilterProvider but it did not