Exemple #1
0
        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);
        }
Exemple #2
0
        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>();
        }
Exemple #3
0
 private ObjectMapper(MapperConfigurationExpression configuration)
 {
     Configuration = configuration;
     Configuration.ValidateInlineMaps = false;
     Configuration.AddConditionalObjectMapper().Conventions.Add(pair => pair.SourceType.Namespace != "Castle.Proxies");
 }