I want to configure per XML a module with a property, which contains a list of class MyObject. My Module and MyObject class are looking like:
public class MyModule : Module
{
public IList<MyObject> MyObjects { get; set; }
protected override void Load(ContainerBuilder builder)
{
base.Load(builder);
// Do something with MyObjects.
}
}
public class MyObject
{
public string Id { get; set; }
public bool IsVisable { get; set; }
}
My assumption was to configure it like this in XML:
<modules name="MyModule">
<type>...</type>
<properties>
<MyObjects>
<MyObject>
<Id>1234</Id>
<IsVisilble>false</IsVisilble>
</MyObject>
</MyObjects>
</properties>
But if I run this, I get the following exception:
Unable to convert object of type 'Autofac.Configuration.Util.ConfiguredDictionaryParameter' to type 'System.Collections.Generic.IList`1[MyObject]'
I'm using Autofac 4.5.0 with Autofac.Configuration 4.0.1.
What am I doing wrong? Is there a way to get it working?