Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IConfigurationRoot is not assignable to IConfiguration parameter type, sample/test broken #3

Closed
beachwalker opened this issue Jan 13, 2016 · 4 comments

Comments

@beachwalker
Copy link

The description about using ConfigurationModule does not work (does not even compile).

How to use ConfigurationModule as described here: http://autofac.readthedocs.org/en/latest/configuration/xml.html#quick-start does not work.

// Add the configuration to the ConfigurationBuilder.
var config = new ConfigurationBuilder();
config.AddJsonFile("autofac.json");

// Register the ConfigurationModule with Autofac.
_var module = new ConfigurationModule(config.Build());_
var builder = new ContainerBuilder();
builder.RegisterModule(module);

The config.Build() returns _IConfigurationRoot_ but ContainerBuilder requires _IConfiguration_ parameter.

Seems MS changed the API a little bit. Is there a way to create configuration from IConfiguraionRoot?

@beachwalker
Copy link
Author

It worked with beta, broken since release candidate.
There is no Unit Test for ConfigurationModule.

@beachwalker
Copy link
Author

Seems there is a problem with Microsoft.Extensions.Configuration (used by Autofac.Configuration) and the Documentation which states to use Microsoft.Framework.Configuration.

@beachwalker
Copy link
Author

The problem is announced here:
aspnet/Announcements#77
aspnet/Configuration#304

Just add Assemblies with Microsoft.Extensions.Configuration.* name instead of the former Microsoft.Framework.Configuration.* names to solve the Problem.

Anyway, I leave this open until the documentation is fixed.

@tillig
Copy link
Member

tillig commented Jan 13, 2016

PR accepted, docs updated. Thanks!

@tillig tillig closed this as completed Jan 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants