-
-
Notifications
You must be signed in to change notification settings - Fork 120
Open
Description
According to the docs, it should be possible to register an existing object when the type isn't known at compile time. The docs show this:
[Fact]
public void should_be_able_to_resolve_from_the_generic_family_expression()
{
var widget = new AWidget();
var container = new Container(x => x.For(typeof(IWidget)).Use(widget).Named("mine"));
container.GetInstance<IWidget>("mine").ShouldBeTheSameAs(widget);
}
However, it looks like there isn't an overload of Use that will accept an instance. The exact code from the docs fails.
I also found this old issue (2020) that shows this was implemented: #233
Is there a different, preferred way to register an existing object when the type isn't compile-time constant?
Metadata
Metadata
Assignees
Labels
No labels