Before the upgrade in the version 5.5, this worked and you could resolve a Dog using both traditional injection into e.g. a constructor (ICanine), as well as via something like an AnimalFactory when you have an ID.
Now with the latest Zenject, I am getting:
ZenjectException: Assert hit! Attempted to use AsSingle multiple times for type 'Dog'. As of Zenject 6+, AsSingle as can no longer be used for the same type across different bindings. See the upgrade guide for details.
I am unsure how to resolve it since you can't use WithId() on a single binding where first interface needs to resolve without an ID.
Consider this example:
Before the upgrade in the version 5.5, this worked and you could resolve a
Dog
using both traditional injection into e.g. a constructor (ICanine
), as well as via something like an AnimalFactory when you have an ID.Now with the latest Zenject, I am getting:
I am unsure how to resolve it since you can't use WithId() on a single binding where first interface needs to resolve without an ID.