Fork me on GitHub

Get a Service by PluginType Edit on GitHub


Requesting the default configured object of a plugin type is done through the IContainer.GetInstance() method shown below:


[Fact]
public void get_the_default_instance()
{
    var container = new Container(x => { x.For<IWidget>().Use<AWidget>(); });

    container.GetInstance<IWidget>()
        .ShouldBeOfType<AWidget>();

    // or

    container.GetInstance(typeof(IWidget))
        .ShouldBeOfType<AWidget>();
}