Questions tagged [ninject.web.mvc]

extension for ninject providing integration with ASP.NET MVC

Use this tag on questions that describe issues with this specific extension of the framework.

Main features that your question is about:

  • The integration between the Ninject core and ASP.NET MVC
  • Your extended HttpApplication (in Global.asax.cs) with NinjectHttpApplication
  • The activation of your controllers
  • Exposed dependencies and injections of types in
    • constructors
    • properties
    • methods

Github ninject.web.mvc extension

298 questions
2
votes
1 answer

Ninject base class and inheriting class bind to the same instance

I have a generic repository that takes DbContext as a constructor parameter. To inject it my binding looks as such: Bind().To().InRequestScope(); I also have custom repositories, which take MyApplicationContext…
e36M3
  • 5,952
  • 6
  • 36
  • 47
2
votes
3 answers

Web API controller has no default constructor. Ninject dependency resolver issue

I'm working on my first API using MVC. I've gotten it working previously by creating an API and declaring/creating its data within the controller, like so: public class ValuesController : ApiController { private northwndEntities db = new…
2
votes
1 answer

Ninject deadlock issue

We have asp.net MVC 4 application and once in 2 weeks IIS requests are hanging because of a deadlock issue in nInject. Any suggestion on how to debug this issue further? We are using Ninject 3.0.1.10. Planning to update to recent release. I got…
Kris
  • 251
  • 1
  • 8
2
votes
1 answer

How to inject ModelState as parameter with Ninject?

Im very new to Ninject. I want to find a way to pass Modelstate of a controller further to service layer. what i have right now: private readonly IAccountService service; public AccountController(ILanguageService ls, ISessionHelper…
2
votes
1 answer

I am having issues with Ninject and MVC 5 Web api 2.2

I tried the solution in MVC5, Web API 2 and and Ninject but the package breaks my build(System.Web). I have also tried the "Ninject.MVC3" Package. When i fix it with "Update-Package -reinstall Microsoft.AspNet.WebApi.WebHost", I get the error: An…
2
votes
0 answers

Ninject.Web.MVC4 disposes my DbContext exactly once

There are a half dozen identical questions, I know. I've followed the advice of their answers, and I'm still stuck. I've used NuGet to install Ninject.Web.MVC4 and added my bindings to NinjectWebCommon.RegisterServices. I've manually added the…
epalm
  • 4,283
  • 4
  • 43
  • 65
2
votes
2 answers

How to inject User Manager to Account Controller with default Identity Model in Identity 2 using Ninject

I use Ninject on a MVC 5 project with Identity 2. For rest of data context and controllers using that I have no problems with dependency injection. For Account controller that uses Identity 2 model I'm getting null UserManager when I try to…
2
votes
1 answer

Ninject.MVC WebViewPage _Layout.cshtml Injections are Null

I am Using Ninject.MVC4 in my ASP.NET MVC4 Project and I am setting Up my Bindings in the created "NinjectWebCommon.cs" file. I've overwritten the Default View, to Inject an Permissionmanager for my Views public abstract class…
squadwuschel
  • 3,328
  • 3
  • 34
  • 45
2
votes
1 answer

ASP.Net MVC 5 + SignalR + Ninject

What is the best practice way for to wire up Ninject with both MVC5 and SignalR? Ninject recommends having Global.asax inherit NinjectHttpApplication and implementing a CreateKernal method: //Global.asax ([Ninject MVC Website…
James
  • 7,877
  • 7
  • 42
  • 57
2
votes
1 answer

Ninject Inject Common DbContext Into Numerous Repositories

There’s something which I am doing that is working, but I think it can probably be done a lot better (and therefore, with more maintainability). I am using Ninject to inject various things into a controller. The problem which I needed to solve is…
onefootswill
  • 3,707
  • 6
  • 47
  • 101
2
votes
1 answer

RoleProvider injection with Ninject

First off I want to say there is a ton of answers on SO and google searches surrounding this, however I'm running into an issue that prevents those solutions from working. The answer here seems to be the way to go.…
The Muffin Man
  • 19,585
  • 30
  • 119
  • 191
2
votes
2 answers

How to bind using Ninject Conventions Extension?

I like to bind bellow code with Ninject auto binding. Is it possible to use both mannual & auto binding within a single project? Let;s take bellow manual binding, I want to achieve with auto binding. Please tell me how to achieve…
2
votes
1 answer

ASP.NET Web API and Ninject not working

I started a new ASP.NET MVC project and I'm using Ninject as my IOC controller. As far as regular MVC Controllers goes - everything work fine and binding is done to the controller constructor as expected. I've added a WEB API to my project and did…
developer82
  • 13,237
  • 21
  • 88
  • 153
2
votes
2 answers

ASP.NET MVC Error loading Ninject component ICache

I've been getting the following error: System.InvalidOperationException: Error loading Ninject component ICache No such component has been registered in the kernel's component container. Using the following NuGet packages: Ninject…
Daniel Little
  • 16,975
  • 12
  • 69
  • 93
2
votes
2 answers

Ninject and lazy Dependency Injection mvc 4.5

I have started working with Ninject for a website and setting up DI within a project. I have noticed you register the binding dependencies within the app_start called ninjectWebCommon. When the project loads, do all dependencies get registered? For…