我的AutoMapper配置文件中有以下映射,它正在运行:
CreateMap<KeyValuePair<int, string>, SelectListItem>()
.ForMember(m => m.Selected, opt => opt.Ignore())
.ForMember(m => m.Text, opt => opt.MapFrom(c => c.Value))
.ForMember(m => m.Value, opt => opt.MapFrom(c => c.Key.ToString()));
CreateMap<KeyValuePair<short, string>, SelectListItem>()
.ForMember(m => m.Selected, opt => opt.Ignore())
.ForMember(m => m.Text, opt => opt.MapFrom(c => c.Value))
.ForMember(m => m.Value, opt => opt.MapFrom(c => c.Key.ToString()));
更新到Veriosn 5.1.1
后,我在AutoMapper初始化中收到以下错误:
Instance property 'Item(KeyValuePair`2)' is not defined for type 'System.Collections.Generic.Dictionary`2[System.Object,System.Object]'
通过评论上面的地图线,我不再感到错误,但我需要它们 我该如何解决?