Faced a problem where our database uses prefixes and we dont want them in our api. I could have just use AddField with an alias, but since we allready have AutoMapper set up I wanted to use that configuration to avoid writing the configuration twice.
With this modification Im able to do like this:
var mapping = AutoMapper.Mapper.Configuration.FindTypeMapFor<TEntity, TModel>();
schema.AddAllFields(mapping.GetPropertyMaps().ToDictionary(key => key.SourceMember.Name, val => val.DestinationProperty.Name));
Faced a problem where our database uses prefixes and we dont want them in our api. I could have just use AddField with an alias, but since we allready have AutoMapper set up I wanted to use that configuration to avoid writing the configuration twice.
With this modification Im able to do like this:
var mapping = AutoMapper.Mapper.Configuration.FindTypeMapFor<TEntity, TModel>();
schema.AddAllFields(mapping.GetPropertyMaps().ToDictionary(key => key.SourceMember.Name, val => val.DestinationProperty.Name));