I did the following:
container.Register(Component.For<Dictionary<string, string>>()
.Instance(ServiceDictionaryInstance)
.Named("serviceDictionary"));
The class consumes the component is:
public class BusinessService : IDecisionFilter
{
private readonly Dictionary<string, string> _ServiceDictionary;
public BusinessService(IOtherInterface otherService, Dictionary<string, string> serviceDictionary)
{
_OtherService = otherService,
_ServiceDictionary = serviceDictionary;
}
}
Then Castle can't resolve the Dictionary component:
Failed: NotImplementedException The method or operation is not implemented. Failed: at Castle.MicroKernel.SubSystems.Conversion.GenericDictionaryConverter.PerformConversion(String value, Type targetType)
But if I create another class:
public class DictiornayType : Dictionary<string, string>
{
}
in place of the original Dictionary, everything resolved correctly.
Does this have anything to do with generic type?
Please advise.