I'm looking into TinyIOC for ASP.NET MVC application.
What I'm trying to do is register some interface as singleton per request using factory method.
var container = TinyIoC.TinyIoCContainer.Current;
container.Register<IGlobal>((c, n) => FactoryMethod()).AsPerRequestSingleton();
The code above gives me Cannot convert current registration of TinyIoC.TinyIoCContainer+DelegateFactory to singleton
. Is there a way to implement this with TinyIOC without using ChildContainers?
Sorry, forgot that....
So, TinyIoC currently (as of 1.2) can't register for singleton lifestyles when using factory methods.
Oh, and as you mention child containers - be careful with those, they're broken as well.