Looking for Ninject equivalent of StructureMap's ObjectFactory.GetInstance() method?

AFAIK, NInject doesn't have static method like this so all resolving should go to some kernel But you can implement it easily class ObjectFactory { static IKernel kernel = new StandardKernel(.....); public static T GetInstance() { return kernel.Get(); } } Although, IMO, NInject is much more useful as DI container than as service locator.

AFAIK, NInject doesn't have static method like this so all resolving should go to some kernel. But you can implement it easily; class ObjectFactory { static IKernel kernel = new StandardKernel(.....); public static T GetInstance() { return kernel.Get(); } } Although, IMO, NInject is much more useful as DI container than as service locator.

Yeah, it is very simple to add a static container accessor. We have one that gets reused when the accessor is needed: github. Com/idavis/ninject.extensions.

Wcf/blob/master/source/… – Ian Davis Oct 16 '09 at 13:34.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions