Fork me on GitHub

Lamar 2.0.0


Next

Constructor Selection

Previous

Policies

Changing Configuration at Runtime


Note! Don't do this, you've been warned.

The Lamar team respectfully recommends that you don't do this, but this functionality is here because we had to have this for Jasper's integration with ASP.Net Core. Please note that this should only be used additively. Unlike StructureMap, Lamar will not rewrite build plans for existing registrations to accomodate changes here.


[Fact]
public void add_all_new_services()
{
    var container = new Container(_ => { _.AddTransient<IWidget, RedWidget>(); });
    
    container.Configure(_ => _.AddTransient<IService, WhateverService>());

    container.GetInstance<IService>()
        .ShouldBeOfType<WhateverService>();
}