public static void LoadConfig(ref MapperConfigurationExpression config) { //if there is any naming conventions for specified classes, conventions can be applied //description's here --> https://github.com/AutoMapper/AutoMapper/wiki/Conventions //cfg.CreateMap<Source, Dest>(); - simple mapping example config.AddConditionalObjectMapper().Where((s, d) => s.Name.Replace("Model", "Dto") == d.Name); config.AddConditionalObjectMapper().Where((s, d) => s.Name.Replace("Dto", "Model") == d.Name); }
public static void LoadConfig(ref MapperConfigurationExpression config) { DAL.Mapping.MapperConfig.LoadConfig(ref config); //cfg.CreateMap<Source, Dest>(); - simple mapping example config.AddConditionalObjectMapper().Where((s, d) => s.Name.Replace("ViewModel", "Dto") == d.Name); config.AddConditionalObjectMapper().Where((s, d) => s.Name.Replace("Dto", "ViewModel") == d.Name); config.CreateMap <RegisterViewModel, UserDto>(); }
private ObjectMapper(MapperConfigurationExpression configuration) { Configuration = configuration; Configuration.ValidateInlineMaps = false; Configuration.AddConditionalObjectMapper().Conventions.Add(pair => pair.SourceType.Namespace != "Castle.Proxies"); }