QuickLib
QuickLib copied to clipboard
How to use Factory and inject value in constructor in IOC?
Hi, I am looking at the IOC and I want to do the following:
Say I have TBase class and TClassA and TClassB inheriting from TBase.
Now I want a factory to produce either classA or classB. Can I use Abstract Factory for this?
Thanks
container.AbstractFactory<TBaseA>(TBase) creates a TBase object and returns as TBaseA container.AbstractFactory<TBaseA> creates a TBaseA object and returns as TBaseA object Both examples will resolve constructor injections of TBaseA
Thanks for the explanation.
I alse see the IOC holds an IOCInjector but there is no way to pass it to the IOC. How is this meant to be used? I also see that when you resolve the objects/classes you consider params in constructors/methods but again how do you inject custom params?
Closing this issue as it has been inactive for an extended period of time and there has been no recent activity. If this issue is still relevant, please feel free to reopen it with updated information.