public class Team {
public string Flag
}
public class TeamDto {
public char? Flag
}
using Automapper, how can I map Flag string to Flag char?
Mapper config:
cfg.CreateMap<Team, TeamDto>()
.ForMember(x=>x.Flag, opts => opts.MapFrom(src => src.Flag!= null ? src.Flag[0] : (char?) null))
I am getting the error when running this. using EF6 DbContext
dbContext.Teams.ProjectTo<TeamDto>(mapper.ConfigurationProvider).ToList();
This is the error
System.NotSupportedException: 'LINQ to Entities does not recognize the method 'Char get_Chars(Int32)' method, and this method cannot be translated into a store expression.'