Open monry opened 6 years ago
This is intentional, to avoid issues that often occur when scope is omitted. In many cases (most cases) transient is not intended. We could add a setting in ZenjectSettings to relax this constraint however. Would that be useful?
thank you for your answer! I will re-review the design of my program. If it is intentional, I think expansion of setting is unnecessary.
In those cases where you get that error, if you intend for it to be transient, you need to explicitly add the AsTransient
call. The docs are still correct that it's the default, but some bind types require that the scope be chosen explicitly. For example, FromMethod
and FromResolve
do not require an explicit scope to be chosen since AsTransient
is a much safer assumption in those cases
I see! I understood it very well. Thank you for answering politely and quickly!
Is there a list of binding types where scope setting is required somewhere?
What
ZenjectException: Assert hit! Scope must be set for the previous binding! Please either specify AsTransient, AsCached, or AsSingle.
occured when omit scope.AsTransient
is described as default in README, is there any condition to omit it?Detail
Sample Code
https://gist.github.com/monry/7aeebe9fce37fb7884d37086bd6e4e16
Log
Version