Questions tagged [ninject-extensions]

Ninject Extensions are a collection of open-source projects designed to extend the functionality of the Ninject open-source dependency injector for the .NET framework.

Ninject Extensions are a collection of open-source projects designed to extend the functionality of the Ninject open-source dependency injector for the .NET framework.

Extension projects include, among others, those targeted at situations involving specific technologies such as MVC and WCF, as well as situations involving design patterns, such as Factories and Conventions.

207 questions
0
votes
1 answer

What is the equivalent of Ninject.IKernel in Unity

This may seem odd but what is the equivalent of Ninject.IKernel interface in Unity? Thanks
Jack M
  • 2,564
  • 4
  • 28
  • 49
0
votes
1 answer

How can I Bind by convention a generic interface to a multiple generic concrete type in Ninject

I have a multiple object that implements the same generic interface. So, I want to configure it using Ninject conventions but I don't know how to do it. Right now I have these registrations Bind
vfabre
  • 1,388
  • 12
  • 23
0
votes
0 answers

Ninject Interception not working with MVC 5

I am trying to implement an InterceptAttribute which should intercept any method I add the attribute to. I have it working in a WebAPI solution, however, I cannot get it to work in an MVC 5 application. The code is the same in both projects. The…
0
votes
1 answer

Ninject binding based on object's property? Convention or contextual binding?

I have an interface: public interface IInterface { string Get(obj o); } and I have the 2 classes: public class C1 : IInterface { string Get(obj o); } public class C2 : IInterface { string Get(obj o); } I'd like to send in o and then have Ninject…
0
votes
1 answer

Ninject provider can't resolve types registered within a named scope

I am using the NamedScoped Ninject extension in an attempt to create object graphs that are constructed everytime a command handler is constructed by the container. In other words, I want a fresh object graph for every command that might get…
Jeremy F
  • 417
  • 2
  • 16
0
votes
2 answers

Ninject MockingKernel with Saboteurs

Is it possible to use MockingKernel so that it generates mock objects automatically that, if interacted with, will throw an exception (a.k.a, saboteurs)? This is useful when you want to get an object with various dependencies, but you know your code…
Travis Parks
  • 8,435
  • 12
  • 52
  • 85
0
votes
1 answer

Could not load file or assembly 'System.Web.MVC, Version=3.0.0.0 in WCF project .NET framework 4

In .NET 4.0 - wcf APPLICAITOn project, I have added - DI using- nInject.WCF.Extension package. VErsio is : Ninject.Extensions.Wcf.3.2.1.0 when try to run the WCF service on browser, some times it throws below exception. Could not load file or…
user3711357
  • 1,425
  • 7
  • 32
  • 54
0
votes
0 answers

How to implement nInject DI into WCF service .NET 4.0

Can any one share me how to implement nInject DI into WCF service. Latest packages are this - I…
0
votes
0 answers

How to implement custom factory method with Ninject Factory Extensions

I have a XmlSerializer and a JsonSerializer where a factory should decide which one to instantiate based on command line parameter "json" or "xml". Pretty easy but I would like to do this with Ninjects Factory extensions. So this is what I have…
dasheddot
  • 2,936
  • 4
  • 26
  • 33
0
votes
1 answer

C# Ninject - Binding Factory Method and Generic

I have a factory method called MessageHandlerFactory public class MessageHandlerFactory : IMessageHandlerFactory { public IMessageHandler GetMessageHandler() { return new MessageHandler_1(); } } ... and…
infinity
  • 1,900
  • 4
  • 29
  • 48
0
votes
1 answer

Is it possible to setup Ninject bindings to create multiple instances of same class?

We have a (weird?) requirement to create X number of instances of the same class and we are using Ninject for IoC. Obviously we can do this manually by requesting objects of the same type multiple times: for (var i = 0; i <= 10; i++) { var obj =…
noocyte
  • 2,484
  • 5
  • 29
  • 44
0
votes
1 answer

Why can't I use Get as a method name in Ninject Extension Factory?

Look at this very simple example: Calling CreateCar it works, calling GetCar it fails, saying "Error activating ICar: No matching bindings are available, and the type is not self-bindable". public interface ICar { } public class Car : ICar { …
0
votes
0 answers

An error occurred when trying to create a controller of type

I am using Ninject for DI (with MVC3), its working fine on my development environment, but on the server it's giving this error: An error occurred when trying to create a controller of type 'Mynamespace.MyController'. Make sure that the controller…
Dr. Rajesh Rolen
  • 14,029
  • 41
  • 106
  • 178
0
votes
1 answer

Are my NUnit tests actually running correctly?

I'm trying to be a good developer and actually right some unit tests for some code I have written. I am using NUnit with Ninject.MockingKernel.Moq and followed the documentation on https://github.com/ninject/ninject.mockingkernel/wiki/Examples. …
Matt
  • 2,691
  • 3
  • 22
  • 36
0
votes
1 answer

Is it possible to use Ninject Named Bindings using ninject.extensions.xml

I have a very simple problem of DI, and wanted to know if there is a way to solve it using Ninject (or any other DI helper). I have a Data Access interface that is implemented by several Data Sources providers, like DB, Sharepoint, CRM, etc. I want…
Milton
  • 928
  • 1
  • 10
  • 22
1 2 3
13
14