passing around values to an AutoMapper Type Converter from outside
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a multilingual database, which returns values based on a key and an enum Language . When I convert a DB object to a model, I want the model to contain the translated value based on the key and the current language. The key comes from the DB object but how can I pass the current language to the the Mapper.Map() function? Currently, I am using a [ThreadStatic] attribute to set the culture before calling Mapper.Map<> , and to retrieve it in the TypeConverter . public enum Language { English, French, Italian, Maltese } public class