I've setup Unity in my WebAPI project and I am getting the objects injected properly when using the DependencyAttribute in one of my ApiControllers. I'm now trying to use the exact same approach in an ActionFilterAttribute, but it is not resolving (resolves to null).
This resolves to null:
public class ValidateEntryAttribute : ActionFilterAttribute
{
[Dependency]
internal ApplicationUserManager UserManager { get; set; }
// ...
}
where this resolves to an instance of the object:
public class LayoutController : BaseApiController
{
[Dependency]
internal ApplicationUserManager UserManager { get; set; }
}
and my UnityConfig looks like this:
container.RegisterType<IUserStore<ApplicationUser, int>, ApplicationUserStore>();
container.RegisterType<ApplicationUserManager>();
What am I missing?