我需要RuleFile
在整个应用程序中拥有一个对象 (),表示要序列化的文件,例如与我的应用程序关联的 word (*.docs) 文件。
我使用 Prism 5 和 MEF 作为依赖注入容器。
[Export]
[Serializable()]
public class RuleFile : NotificationBase, IRuleFile { }
现在我已经用它装饰了这个对象[Export]
并尝试将它导入其中一个,MyViewModel
但它正在给出null
。
public class MyViewModel : ViewModelBase
{
[Import]
private RuleFile RuleFile; // 'null' coming here
}
请指导我我错过了什么?或者告诉我任何其他方式来最好地处理这种情况。