0
我有一個主要的應用程序,將有很多插件。這裏是PluginReader
類我主要的應用程序:MEF未加載進口
Public Class PluginReader
<ImportMany(GetType(IWebPlugin))>
Private m_WebPlugins As IEnumerable(Of Lazy(Of IWebPlugin))
Public Sub New()
End Sub
Public Property WebPlugins As IEnumerable(Of Lazy(Of IWebPlugin))
Get
Return m_WebPlugins
End Get
Set(value As IEnumerable(Of Lazy(Of IWebPlugin)))
m_WebPlugins = value
End Set
End Property
End Class
在我的插件我有這樣的代碼:我的插件的出口正確
<Export(GetType(IWebPlugin))>
<PartCreationPolicy(CreationPolicy.NonShared)>
Public Class PluginClass
Implements IWebPlugin
'Code to implement IWebPlugin here
我的自定義控制因素讀取,我可以看到IWebPlugin出口,但ImportMany沒有被填充。
如果您需要任何澄清,請讓我知道!謝謝!