I have an ASP.NET MVC application, i use Ninject for DI and i use output cache system. But i need to take some informations from my business layer(services). But i don't know how can i inject my services to GetVaryByCustomString method. What's your solution?
public override string GetVaryByCustomString(HttpContext context, string arg)
{
//I need some services here, for example product service.
//I need like this
//var prodManager = Ninject.Get<IProductService>();
//prodManager.ToSomeMethod();
}
I've found my solution.
public override string GetVaryByCustomString(HttpContext context, string arg)
{
var prodManager = DependencyResolver.Current.GetService<IProductService>();
prodManager.ToSomeMethod();
}