Can anyone tell me if i can register an already created instance of a class with Ninject so that it will use this instance everytime it needs injecting?
I suppose you can call it a singleton but I have the instance already created. All the documentation points to creating new instances of a class.
You can use the
ToConstantmethod which takes an already existing instance and registers it as singleton.If you want to something more complex you can use the
ToMethod(where you can use a Func to get your instance) combined with theInSingletonScope