2012-03-12 79 views

回答

3

有幾個方法可以做到這一點,無論是:

1 - 調試器......走進你的代碼,你就可以使用內置到Visual Studio調試功能尋找到您的容器。

enter image description here

2 - 組成分析工具 - (http://msdn.microsoft.com/en-us/library/ff576068.aspx) - 這是用於分析組件,以發現哪些部分是提供的命令行工具。

3 - 如果你正在使用ASP.NET與一瞥,你可能想看看一個插件,我開始開發,探索你的容器也:(https://github.com/Antaris/Glimpse.MEF):

enter image description here

enter image description here

4 - 滾動你自己的。

+0

是的,非常感謝,這是在兩行 var name = AttributedModelServices.GetContractName(serviceType); return Enumerable.Any(_container.Catalog.Parts.SelectMany(part => part.ExportDefinitions),e => e.ContractName == name)? _container.GetExportedValue (name):null; – Coppermill 2012-03-12 10:42:48