In a Ninject dependency injection, if you configured the class binding to yourself as follows:
Bind<SomeClass>().ToSelf();
Ninject very nicely resolves any dependencies SomeClass has and returns the object back. I want to be able to do something with SomeClass, it returns every time it creates a new one, so this is an event after processing. I could use the .ToMethod (or ToFactoryMethod) binding to explicitly update it, but I would like all of its dependencies to be resolved by Ninject in advance.
It would be nice to do something like:
Bind<SomeClass>() .ToSelf() .After(sc => sc.MethodIWantToCall()); // then after here, Ninject returns the object.
Is there a way to do this in Ninject 1.0 / 1.1?
source share