asp.net-mvcmvcgrid.net

MVCGrid.Net How can I inject a service in the MVCGridConfig class using Ninject?


I use Ninject as a dependency injector for my ASP.Net MVC application.

However, MVCGridConfig is a static class.

How can I inject my ICoursesService in the MVCGridConfig class in order to retrieve the necessary data for the table?

Thank you very much!


Solution

  • I doubt you'll be able to inject into a static class, but you could pull it using

    var svc = DependencyResolver.Current.GetService<ICoursesService>();