MEF如何知道要进口哪些部件?

时间:2022-04-29 17:13:08

Currently I use unity and prism.

目前我使用的是unity和prism。

If I want to put stuff into unity i do it at the module level.

如果我想把东西放到统一中,我在模块级做。

How do I do it with MEF?

我该怎么做呢?

I see that I add exports to the class, but how does MEF know to add these? Does it do it by class library? is there a way to link it to modules?

我看到我向类添加了export,但是MEF如何知道添加这些?它是通过类库完成的吗?有没有办法把它和模块连接起来?

1 个解决方案

#1


1  

MEFContrib has a "MEF + Unity Integration" project you should look at. Here's a blog post about it: http://pwlodek.blogspot.com/2009/05/unity-mef-integration-layer.html

mef悔过有一个“MEF + Unity Integration”项目,您应该看看。这里有一篇关于它的博文:http://pwlodek.blogspot.com/2009/05/un-mef - integrationlayer .html

It makes MEF aware of Unity and vice-versa. Pretty nice.

它使我意识到统一,反之亦然。很好。

As for "How does MEF work", I would suggest watching this excellent video: http://channel9.msdn.com/Shows/SilverlightTV/Silverlight-TV-Episode-4-3-Steps-to-MEF-Export-Import-Compose

至于《MEF是如何工作的》,我建议你看一下这段精彩的视频:http://channel9.msdn.com/shows/silverlighttv/silverlight - tv片段——4-3步-到MEF- export - import - composer

It shows all of the component parts of MEF and how they work together.

它展示了MEF的所有组成部分以及它们如何一起工作。

#1


1  

MEFContrib has a "MEF + Unity Integration" project you should look at. Here's a blog post about it: http://pwlodek.blogspot.com/2009/05/unity-mef-integration-layer.html

mef悔过有一个“MEF + Unity Integration”项目,您应该看看。这里有一篇关于它的博文:http://pwlodek.blogspot.com/2009/05/un-mef - integrationlayer .html

It makes MEF aware of Unity and vice-versa. Pretty nice.

它使我意识到统一,反之亦然。很好。

As for "How does MEF work", I would suggest watching this excellent video: http://channel9.msdn.com/Shows/SilverlightTV/Silverlight-TV-Episode-4-3-Steps-to-MEF-Export-Import-Compose

至于《MEF是如何工作的》,我建议你看一下这段精彩的视频:http://channel9.msdn.com/shows/silverlighttv/silverlight - tv片段——4-3步-到MEF- export - import - composer

It shows all of the component parts of MEF and how they work together.

它展示了MEF的所有组成部分以及它们如何一起工作。