-
Notifications
You must be signed in to change notification settings - Fork 22
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
Nested list in dictionary property through Autofac.Configuration in JSON are not supported #8
Comments
The configuration library isn't doing full "model binding" to figure out property values. It's a much simpler mechanism using a flatter binding concept - much closer to what the classic XML style configuration supported (more "key/value pair" than "recursive binding"). You can see how we parse dictionaries here. It's trying type converters and casting on the value. To understand why that doesn't "just work," think about how Microsoft.Extensions.Configuration parses this configuration. It's all key/value pairs to that system:
The Autofac configuration stuff does its best to try to "infer" what is meant by each property, but it's not an actual model binder. At the time we originally wrote this, the Microsoft.Configuration.Extensions.Binder stuff wasn't there and when it started getting there, it wasn't quite where we needed it. That may be a better option for us now that .NET Core has settled down a bit. We'd be happy to take a pull request with an update for this support. In the meantime, I'll mark the issue as an enhancement request. Also, if you wouldn't mind, in the future try not to cross-post to both the issues list and StackOverflow - try StackOverflow first. Cross-posting the question means we have to cross post the answer and make sure everyone knows where to go for further discussion. It gets confusing. Thanks! |
Enhance Issue #8: Support complex type when configure module
Resolved by f9e5644 - will release this shortly. |
I use the new model of the Autofac.Configuration but I can't use nested property configuration. The following property NestedListInDictPropThatDoesNotWork is not working:
Do I have to use an other syntax for that? I want to configure a Dictionary, where the value is a List of items instead of a simple value type.
I also posted this question to stackoverflow.
I use Autofac.Configuration.4.0.1.
The text was updated successfully, but these errors were encountered: