0
我有以下程序在MEF如何在MEF組合引擎中結合a)MEF和泛型?
方法1:
public ObjectResult<PartnerListingStatement> GetCommissionListingRecords(string uRL, PortalConstant.DataSourceType DataSourceType)
{
ObjectResult<PartnerListingStatement> lstCommissionPartner = null;
var dataPlugin = DataPlugins.FirstOrDefault(i => i.Metadata["SQLMetaData"].ToString() == DataSourceType.EnumToString());
if (dataPlugin != null)
{
lstCommissionPartner = dataPlugin.Value.GetCommissionListingRecords(uRL);
}
return lstCommissionPartner;
}
方法B
public ObjectResult<CommissionEarned> GetCommissionPaidToPartners(string uRL, PortalConstant.DataSourceType DataSourceType)
{
ObjectResult<CommissionEarned> lstCommissionEarned = null;
var dataPlugin = DataPlugins.FirstOrDefault(i => i.Metadata["SQLMetaData"].ToString() == DataSourceType.EnumToString());
if (dataPlugin != null)
{
lstCommissionEarned = dataPlugin.Value.GetCommissionPaidToPartners(uRL);
}
return lstCommissionEarned;
}
使用泛型或類似物可以在這兩種組合。數據類型也不同。 注:〜這個問題是不是Generics program to access WCF service from client
感謝
無法獲得此工作...數據pulgin是[ImportMany] public System.Lazy> [] DataPlugins {get;組; } –
user1025901
2012-01-13 05:13:13
在這種情況下,PluginType會出現什麼情況? – user1025901 2012-01-13 05:21:51
好吧,我解決了它..我需要通過界面..感謝您的解釋 – user1025901 2012-01-13 05:44:21