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
4
votes
1 answer

Ninject w/ ASMX web service in a MVC3/Ninject 3 environment

I'm looking for the best way to incorporate a classic asmx web service into my MVC3 environment. I'd like the kernel/container to be shared between the two. In the past with ASP.NET web forms I was able to use the…
Nate Rickard
  • 652
  • 8
  • 14
3
votes
1 answer

When using Ninject in my MVC3 I get a Ninject.ActivationException: Error activating IRepository{Ranking} installed via Nuget

I installed Ninject via nuget, and I registered my binds in NinjectMVC3's RegisterServices method (created by nuget). Follow my code: private static void RegisterServices(IKernel kernel) { kernel.Bind().To(); …
Thiago Burgo
  • 91
  • 2
  • 12
3
votes
2 answers

MVC 3 ninject bind lazy evaluated parameter

I want o bind my controller with a parameter that is lazy evaluated. protected override IController GetControllerInstance(RequestContext requestContext, Type controllerType) { try { return controllerType == null …
Radu D
  • 3,505
  • 9
  • 42
  • 69
3
votes
1 answer

Ninject - dynamically specifying a connection string based on a sub domain

I'm trying to specify a connection string dynamically based of the url using ninject. I'm using the ninject.mvc nuget package that uses the webActivator. My code is as follows: my injection: kernel.Bind().To() …
lancscoder
  • 8,658
  • 8
  • 48
  • 68
3
votes
3 answers

Problem with Ninject and MVC3 Dependency injection action filter on Controller and Action

Recently I decided to remove a heap of action level filters in a controller and replace them with a single controller level filter. Now I'm getting this error message. Error activating LogActionFilter More than one matching bindings are…
Plebsori
  • 1,075
  • 9
  • 23
3
votes
1 answer

Getting ninject / ninject.commons / ninject.web.mvc working with Mono 2.10.x and ASP.NET MVC3

Currently working on a project that is being developed in VS2010. I'm running Windows in a VM, where I've done most .NET dev, but I'm now working on a new project that is ASP.NET MVC3 based so I thought I could use Mono/MonoDevelop to save some…
Justin
  • 4,434
  • 4
  • 28
  • 37
3
votes
1 answer

How to configure Ninject so that it creates a single instance per Controller

I'm trying to use Ninject for an MVC5 application and I want to know if there's any way I can configure it so that instantiate a single object per Controller (I'm not sure if it the same as per request), use that instance in any Action of the…
eddy
  • 4,373
  • 16
  • 60
  • 94
3
votes
1 answer

How transfer to AddBindings() in NinjectDependencyResolver concrete type argument from MVC controller class?

I have controller class ProductController.cs namespace AmazonProductAdvertisingAPI.WebUI.Controllers { public class ProductController : Controller { private string _title = "Bible"; private IProductCollection…
Stanislav Machel
  • 349
  • 2
  • 20
3
votes
1 answer

Custom AuthorizeAttribute Ninject Property Injection doesn't work (injected property have sub dependant services which need to be injected)

I think the specifics of my question are very much different than the other similar questions which I have red. I know that when I have custom AuthorizeAttribute I can't inject dependencies with the constructor. This is because the constructor will…
3
votes
2 answers

Dependency Injection without Repository Pattern using with Entity Framework

So far I've been implementing in my projects repository pattern and dependency injection. I use Entity Framework for ORM and also have a service layer that manages my repositories. I kind of feel like doing something not so essential for problems…
3
votes
1 answer

Error loading module 'Ninject.Web.Mvc.MvcModule' of type MvcModule

I am building an ASP.NET MVC5 web application, using Ninject.MVC5 for DI. I'm trying to move the NinjectWebCommon class into a separate class-library project. I was able to do this successfully by using the following code: private static IKernel…
Brett Wolfington
  • 6,587
  • 4
  • 32
  • 51
3
votes
1 answer

Where to do DBContext.SaveChanges() if I'm using InRequestScope()

I'm developing an ASP.NET MVC 5 Web API application with C#, .NET Framework 4.5.1, Entity Framework 6.1.1 and the latest version of Ninject (I have also installed Ninject.MVC5). I'm learning how to implement dependency injection, and I think I have…
VansFannel
  • 45,055
  • 107
  • 359
  • 626
3
votes
1 answer

FileLoadException after installing Ninject.MVC5

I am trying to learn ASP.NET MVC with Adam Freeman's "Pro ASP.NET MVC 5" book. Unfortunately all projects using Ninject throw the same error An exception of type 'System.IO.FileLoadException' occurred in Ninject.dll but was not >handled in user…
3
votes
2 answers

Issues after installing ninject mvc 3 in mvc 5 project

I have created new asp mvc 5 project. Project target .NET 4.5. I installed ninject mvc 3 nuget package. But when I run project I get this error in NinjectWebCommon.cs in CreateKernel() method: An exception of type 'System.IO.FileLoadException'…
1110
  • 7,829
  • 55
  • 176
  • 334
3
votes
1 answer

Cannot Inject Dependencies using Ninject into ASP.NET Web API Controller called from Angular Service

I am using Ninject together with ASP.NET MVC 4. I am using repositories and want to do constructor injection to pass in the repository to one of the controllers. Here is my context object (EntityFramework) that implements my StatTracker…
MTL323
  • 177
  • 3
  • 14
1 2
3
19 20