JasperFx / lamar

Fast Inversion of Control Tool and Successor to StructureMap
https://jasperfx.github.io/lamar
MIT License
572 stars 119 forks source link

Documentation for Container configuration is incorrect #165

Closed swoobie closed 5 years ago

swoobie commented 5 years ago

The 2nd code block in the documentation page here has an outdated method for configuring a container after it has been created. The specific text is:

// Example #2 - Create an container instance but add configuration later.
            var container2 = new Container();

            container2.Configure(c =>
            {
                c.For<IFoo>().Use<Foo>();
                c.For<IBar>().Use<Bar>();
            });

This throws the following error:

'IServiceCollection' does not contain a definition for 'For' and no accessible extension method 'For' accepting a first argument of type 'IServiceCollection' could be found (are you missing a using directive or an assembly reference?)

From @CodingGorilla

the Container.Configure() uses strictly the IServiceCollection which is the abstraction from MS' di system. so it won't have any of the service registry specific DSL functions.

jeremydmiller commented 5 years ago

Got it, I'll get this fixed soon.

jeremydmiller commented 5 years ago

Looks like someone else had gotten to it.