I use XML for my configuration files and currently I deserialize into objects or lists of objects directly. I also use Managed Extensibility Framework (MEF) to make extensions to our application platform but I haven't found a way to tie the two together.
For instance if I wanted to add a new object to this base class using XMLInclude:
[XmlInclude(typeof(SubObject1))]
[XmlInclude(typeof(SubObject2))]
[XmlInclude(typeof(SubObject3))]
//New XmlInclude Types based on plugins?
[XmlType("SupportedObject")]
public class SupportedObject
{
public string Name { get; set; }
}
with XML:
<SupportedObjects>
<SupportedObject xsi:type="SubObject1">
<Name>MainSub1</Name>
<SubObject1Param>FooBar</SubObject1Param>
</SupportedObject>
<!-- MEF Plugin Object -->
<SupportedObject xsi:type="MefObject1">
<Name>MainSub1</Name>
<MefParam1>something new</MefParam1>
</SupportedObject>
</SupportedObjects>
The first object would load fine because it is defined using the XmlInclude but how do I define an extension that is compiled in a dll and loaded as a lazy list object with contract to be included as a supported object xmlinclude as well? I'm quite vexed.