hi, i really dont get it work.
say i have some classes with the same interface which i want to export.
[Export(typeof(IService))]
[ExportMetadata("ExportType", typeof(Service1))]
public class Service1 : IService
{...}
[Export(typeof(IService))]
[ExportMetadata("ExportType", typeof(Service2))]
public class Service2 : IService
{...}
[Export(typeof(IService))]
[ExportMetadata("ExportType", typeof(Service3))]
public class Service3 : IService
{...}
now i have one class which import the IService and this class did not matter wich service it is.
public class Blup
{
[ImPortingConstructor]
public Blup(IService service)
{}
}
what i try to achieve now is to build an ExportProvider which select the right Export on Compose.
Something like this:
public TypeExportProvider<TTypeToExport>() : ExportProvider
{}
i really have no idea how the
protected override IEnumerable<Export> GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
should look like. maybe anyone know a blog to read about this. there a lot of custom ExportProvider samples out but not for this situation.
thx