Is it possible to configure Automapper so it can map from a collection to a single instance based on a run-time parameter?
In our application our entities have labels for each language. Depending on the preference of the current user, a single value should be shown.
DepartmentEntity
Labels: Label[]
Value: string
Culture: CultureInfo
DepartmentViewModel
Label: string
Given I know the current user culture when I map my entities, could I configure Automapper so it can map from DepartmentEntity to DepartmentViewModel?
Something like
var department = Mapper.Map<DepartmentEntity, DepartmentViewModel>(user.Culture);
Other answers like this one seem to want to pass a parameter to use as target value straight up. I want to use it as a way to reduce a list to a single field.