Open Griboedoff opened 4 days ago
@Griboedoff Does it work if you remove .WithIgnoringReuseForFuncWithArgs()
?
It will.
But for some legacy reasons we have .WithDefaultReuse(Reuse.Singleton)
on whole container
Is there any way to achieve same behaviour?
I need to think about that. Problem is, I cannot say if a scoped service or singleton or its dependency still need the passed argument. Container can tell that for sure only when traversing to the last dependency in a chain. By this moment, it is already too late to keep the reuse. Another approach may be to mark a specific dependency with reuse to be omitted by this rule. More configs to the God of configs :)
Okay, thanks
For now I think the best solution is explicit factory for class B which curries all arguments except string from B constructor
But let keep this issue open for now. It is also an interesting number of issue.
net6, DryIoc 5.4.3
Hi!
I can't find the way to reuse depencency A when using creation Func for B.
My use case is this:
currently DryIoc calls A constructor every time
getB
called.Is there a way to reuse A instance in creating B?
P.S. I saw docs for Func wrapper but
asResolutionCall
does not do the job.