Closed einari closed 4 years ago
Good point, let me add that capability as well - that makes sense and would be the least surprising outcome for developers.
Note to self: use .GroupBy()
for the type in the ContainerBuilderExtensions
for the .To()
type and then bind all interfaces to that type.
Could we pull this as is? It means we would get some more metrics in the Runtime working as this PR does: https://github.com/dolittle-runtime/Runtime/pull/367
And create new tasks for the missing pieces? (@petriw)
/cc: @jakhog @woksin
This adds
.AsSelf()
for all type based bindings. This allows one to ask the container for an instance based on the concrete type in addition to its implementing interface and it will use the same binding for this.The problem we ran into was when leveraging
IInstancesOf<>
which calls the container and asks for a concrete instance and the type also has an interface that typically follows the conventionIFoo
->Foo
in addition to an interface used as marking for discovery, taking a dependency toIFoo
in another place would not follow same binding and honor the same lifecycle - for instanceSingleton
orSingletonPerTenant
.┆Issue is synchronized with this Asana task