Scrutor icon indicating copy to clipboard operation
Scrutor copied to clipboard

As(Func<Type, IEnumerable<Type>>) and Singleton Lifetime

Open lawrence-laz opened this issue 5 years ago • 2 comments

Currently As(Func<Type, IEnumerable<Type>> selector); allows to specify multiple types, but all of them are registered as separate instances. This causes a problem for me with singleton lifetime as now I have multiple objects.

It feels like it should set up type forwarding similar to how ILifetimeSelector AsSelfWithInterfaces(); does.

What are your thoughts on this?

lawrence-laz avatar Nov 12 '20 15:11 lawrence-laz

A possible workaround for this is described here https://github.com/khellang/Scrutor/issues/47#issuecomment-391663163.

lawrence-laz avatar Nov 12 '20 15:11 lawrence-laz

Maybe, but it would be a breaking change 😅

khellang avatar Nov 12 '20 19:11 khellang