2
我並執行以下操作:溫莎城堡解決字典<>失敗
container.Register(Component.For<Dictionary<string, string>>()
.Instance(ServiceDictionaryInstance)
.Named("serviceDictionary"));
類消耗的組分是:
public class BusinessService : IDecisionFilter
{
private readonly Dictionary<string, string> _ServiceDictionary;
public BusinessService(IOtherInterface otherService, Dictionary<string, string> serviceDictionary)
{
_OtherService = otherService,
_ServiceDictionary = serviceDictionary;
}
}
然後城堡無法解決字典組件:
失敗:NotImplementedException 該方法或操作未實現。 失敗:在Castle.MicroKernel.SubSystems.Conversion.GenericDictionaryConverter.PerformConversion(字符串值,類型TARGETTYPE)
但如果我創建另一個類:
public class DictiornayType : Dictionary<string, string>
{
}
代替原來詞典,一切都正確解析。
這與泛型有什麼關係?
請指教。
字典有什麼? BusinessService如何處理它? – 2010-07-22 00:20:50