ninject

NInject vs. StructureMap etc...

Does anyone have any good suggestions around IoC/DI frameworks? I'm looking into them a bit, but since IoC is new to me I'm looking for pointers on what to check out first. ...

Ninject sample application?

Hi I want to get started using Dependency Injection and IOC and I want to get more into using Ninject. Are there any good application with sourcecode available that is written using Ninject that I can look at as a reference? ...

Using Ninject in a plugin like architecture

I'm learning DI, and made my first project recently. In this project I've implement the repository pattern. I have the interfaces and the concrete implementations. I wonder if is possible to build the implementation of my interfaces as "plugins", dlls that my program will load dynamically. So the program could be improved over time wit...

ASP.NET, Ninject and MVC: Performance Load problems

problem description: This model works fine with one user at a time. As soon as I get multiple users at once, I get a serious of errors relating to not closing my SqlDataReader. When i turn off lazy loading like this: persistenceModel.Conventions.OneToManyConvention = (prop => prop.SetAttribute("lazy", "false")); It's fine, yet perfo...

Ninject on asp.net Session state

I'm working with Ninject on a web application, using the BasePage and BaseMaster from the frameworks's integrations. What I would like to do is have an object injected and have a new instance created on each session. I've looked at the OnePerRequest behavior and it's close, but not quite. What I'm doing is performing a lot of calculati...

ninject Linfu databound proxy object.

I have the following scenario. I have a ViewModel object (It's just a regular object, that impliments INotifyPropertyChanged). I'm binding this object to a view, written in WPF. When I bind it it works fine, events fire, and things are updated, perfect!!! Now I've tried to introduce some validation into the object, I'm checking argum...

good open source project using Dependency Injection Framework?

does anyone know about an open source project Implementing Ninject Framework or another one, I haven't work with a DI framework before and Ninject calls my attention because you don't need to have your configuration in XML files. i tend to grasp a lot more when reviewing already implemented code. also if you know about another good p...

Ninject : Resolving an object by type _and_ registration name/identifier

I am looking for a way to do something like this with Ninject : // Sample from the Unity application block IMyService result = myContainer.Resolve<IMyService>("Data"); ( from http://msdn.microsoft.com/en-us/library/cc440957.aspx ) Is it possible? ...

Ninject OnePerRequestBehaviour doesn't seem to work correctly?

I've been using Ninject as my IOC in my web app. It's great and I think it works really well, however I have been trying to register some interfaces / classes as OnePerRequestBehaviour but it doesn't seem to actually use the behaviour. The code runs correctly but in one of my classes it lazy loads page information from the database then ...

Using ninject/autofac for a given scenario

I have some providers, say - <Providers> <Provider Type="Providers.IM" Name="Im"/> <Provider Type="Providers.Web" Name="Web"/> ... </Provider> Each of these providers can give me a session : <Sessions> <Session Name="GoogleIM" Provider="Im" URL="..." /> <Session Name="YahooIM" Provider="Im" URL="..." /> <S...

NInject: Where do you keep your reference to the Kernel?

I'm using NInject on a new web application and there are two things that are unclear to me: Don't I need to keep a reference to the Kernel around (Session/App variable) to insure that GC doesn't collect all my instances? For example, if I specify .Using() and then the Kernel object gets collected, aren't all my "singletons" collected ...

Implementing OnePerSessionBehavior in NInject...

I'd like to create a OnePerSessionBehavior for NInject (v1.0) and I've mostly got it working. The only issue that remains is how to pass in fresh arguments using .WithArguments() as each new session asks for something from the container. Right now I'm keeping a reference to the container as an application variable and therefore the mod...

Ninject, multiple service bindings.

I am using Ninject to load serveral modules. When two modules try to bind two different implementations for an interface, ninject raises an error that multiple binding for a service are not allowed. All other IoC frameworks I'm using (Unity, Windsor, Spring.net, etc) all have the ability to 'register' multiple implementations for an...

How do I declare a chain of responsibility using decorators in Ninject?

I'd like to declare a chain of responsibility using decorators in Ninject. Has anyone done that before? Thanks. ...

Problems with MVC Controllers + Dependency Injection (Ninject) in medium trust

I want to use dependency injection in an medium trust environment. To that aim I picked Ninject as Iv been told its light weight. How do I set-up injection into the controllers? When I tried to create a custom controller factory: public class NinjectControllerFactory : DefaultControllerFactory { private readonly IKernel...

Inversion of control for your Inversion of control container?

I've recently had to update a relatively large control library that uses Ninject 1.0 to Ninject 2.0 to help resolve some issues I had with 1.0. The update has gone well and I think Ninject 2.0 is a lot quicker. However to try and avoid this problem in the future I have created my own interface for injecting fields and properties (which ...

Using Ninject (or some other container) How can I find out the type that is requesting the service?

Suppose I have an interface for a service: public interface IFooService { void DoSomething(); } And a concrete implementation of that service that is a generic: public class FooService<TRequestingClass> : IFooService { public virtual void DoSomething() { } } And I have some other class that needs an instance of IFooService: ...

Ninject kernel reference in win service

Hi all I have simple win service, that executes few tasks periodically. How should I pass Ninject kernel to all my task classes? Is it good idea to create static variable of base task class and initialize it on service start? ...

Why does my Ninject DI application fail with an ActivationException?

I'm new to IoC/DI frameworks. The first one I am trying is the Ninject framework. It seems straightforward, but I can't get my console application to run. I keep getting an ActivationException stating: "Error activating MainWindow: the StandardProvider returned an instance of type FutureRealisticDateManager, which is not compatible wit...

MVP pattern using webforms and DI object instantiation

I am using the generic repository pattern to persist my data. On the PageLoad, I am creating a new Repository (from IRepository) object, and on PageUnload, I dispose of it. Should the MasterPage/Page be in charge of instantiating the objects to pass to the presenter or should the presenter be in charge of this? I'm more concerned wi...