MEF - [ImportMany] using ExportFactory<T> in WPF - .NET 4.0

强颜欢笑 提交于 2019-12-07 15:17:39

In general on .NET 4.0 ExportFactory isn't supported out of the box. ExportFactory is special type that the container (or a custom export provider) knows about and treats specially and based on the error message you have received it doesn't look like this container knows anything special about ExportFactory because it is trying to cast it to IMyModule.

Have a look at Glen's tests for ExportFactory did you add a Microsoft.ComponentModel.Composition.Hosting.ExportFactoryProvider to your container?

Also note that if you have an option to switch to .NET 4.5, ExportFactory is supported out of the box.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!