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
3
votes
2 answers

Share a Kernel between WebAPI and MVC

I've got a simple MVC4 site which uses ASP.NET webAPI and also MVC pages. I'd like to use Ninject DI for both controller types but I'm wondering how this can be done? I've got Ninject DI working for WebAPI, but now not sure how to share the same…
Andrew Duffy
  • 795
  • 2
  • 17
  • 37
3
votes
2 answers

Ninject.Web.Common and Ninject.Mvc isn't setting the DependencyResolver to use the NinjectDependencyResolver

UPDATE Starting a Bounty, I have added is a Visual Studio 2010 solution replicating the Ninject bug as this seems to be quite a localised issue. Ninject VS 2010 Solution When I do the following: Start Visual Studio 2010 (yes 2010 :-( ) File > New…
SimonGates
  • 5,961
  • 4
  • 40
  • 52
3
votes
1 answer

Ninject with MVC4 conditional binding on HttpContext.Current

I'm not very experienced with Ninject, so I may have a concept completely wrong here, but this is what I want to do. I have a multi-tenant web application and would like to inject a different class object depending on what URL was used to come to…
Crob
  • 599
  • 4
  • 26
3
votes
1 answer

Difference between standard ninject and ninject.web.mvc in an MVC3 project?

I understand some of the functionality of Ninject and have been able to use it for IoC. When I go to add a reference to Ninject to a project in VS2010, using NuGet, I see other Ninject extensions in the list. Specifically Ninject.MVC3. Also on the…
seangwright
  • 17,245
  • 6
  • 42
  • 54
3
votes
1 answer

Lifetime management with Ninject Dependency Creator and Event Broker

I'm using Ninject in a reasonably large project and want to utilize the Dependency Creation and Event Broker extensions. The Dependency Creation readme gives the following example (although I believe InCreatorScope has possibly been renamed to…
Matt B
  • 8,315
  • 2
  • 44
  • 65
3
votes
1 answer

How to get DbContext Instance within UnitOfWork via Ninject?

I Use UnitOfWork Pattern with Entity Framework to expose DbContext using bellow code. So My question is that, is it poosible to get Context instance with Ninject ? IUnitOfWork public interface IUnitOfWork : IDisposable { int Commit(); …
3
votes
1 answer

Ninject for Web Site and Api - Sequence contains no elements

I have a single VS2010 solution with a Web.Api project and an MVC 3 project. Both the Web.APi and the MVC project have their own App_Start with NinjectWebCommon in and their own bindings declared in there. When trying to use the Api I always get the…
matt
  • 247
  • 3
  • 13
3
votes
1 answer

MONO 3.0.2 + Ninject + MVC4: Sequence contains no matching element

I am using VS2012 RC and created a MVC4 app in .NET 4.0 mode. I use Ninject + Ninject.MVC3 as a DI container. It works on my development machine on Windows and on another machine with .NET 4.0 installed, but when I deploy it on a Linux server with…
Stefan
  • 141
  • 1
  • 5
3
votes
0 answers

ninject Inheritance security rules violatedby type: 'Ninject.Web.NinjectHttpModule' in mvc4

I have a mvc4 web application. I decided to use ninject.mvc3. so I installed it from nuget. But it is throwing this exception: Inheritance security rules violated by type: 'Ninject.Web.NinjectHttpModule'. Derived types must either match the security…
Müslüm ÖZTÜRK
  • 961
  • 1
  • 11
  • 30
3
votes
1 answer

Ninject.MVC3 invalid path to NinjectWebCommon.cs

I'm using the Ninject.MVC3 in my application and it has been working great until I desided to rename my solution/projects. Everything has been renamed correctly and all tests passes and so on. The one thing that does not work is the generated…
Pelle
  • 2,755
  • 7
  • 42
  • 49
3
votes
1 answer

How to manually instantiate objects using Ninject for MVC 3

How is it possible to use Ninject inside ASP.NET MVC 3 to instantiate objects manually? Something as "NinjectObject".Resolve(); Thank you & regards
Bill
  • 2,026
  • 9
  • 55
  • 99
3
votes
2 answers

Validation Attribute get triggered two times

In my MVC3 application I have the model ( not important properties deleted ): public class AccountViewModel { [StringLength(65)] public string Property1 { get; set; } [StringLength(65)] public string Property2 { get; set; } } The…
frm
  • 1,720
  • 1
  • 14
  • 18
3
votes
1 answer

Ninject, injecting Membership.Provider in RegisterServices of ninject initialization

Anybody know how to configure Membership.Provider in RegisterServices of ninject initialization code? In my code: /// /// Load your modules or register your services here! /// /// The…
Jose
  • 95
  • 7
3
votes
2 answers

How to instruct Ninject hide a Type from its implicit binding list

Does Ninject have an attribute which I could use to decorate class or constructor to let Ninject to ignore it? I need to get rid of: A cyclical dependency was detected between the constructors of two services. This is my code: //…
Tomas
  • 17,551
  • 43
  • 152
  • 257
2
votes
2 answers

How to Inject properly an IDBContextFactory into a controller's inject IDomainFactory using Ninject MVC3?

Preliminaries I'm using Ninject.MVC3 2.2.2.0 Nuget Package for injecting into my controller an implementation of a IDomain Interface that separates my Business Logic (BL) using an Factory approach. I'm registering my Ninject Modules in the…