Пример #1
0
        public override void CreateMap(IMapperConfigurationExpression configuration, Type type)
        {
            if (TargetTypes.IsNullOrEmpty())
            {
                return;
            }

            foreach (var targetType in TargetTypes)
            {
                configuration.CreateMap(targetType, type, MemberList);
            }
        }
Пример #2
0
        public override void CreateMap(Type type)
        {
            if (TargetTypes.IsNullOrEmpty())
            {
                return;
            }

            foreach (var targetType in TargetTypes)
            {
                Nelibur.ObjectMapper.TinyMapper.Bind(type, targetType);
            }
        }
Пример #3
0
        public override void CreateMap(TypeAdapterConfig configuration, Type needstoMap)
        {
            if (TargetTypes.IsNullOrEmpty())
            {
                return;
            }

            foreach (Type source in TargetTypes)
            {
                configuration.NewConfig(source, needstoMap);
                configuration.NewConfig(needstoMap, source);
            }
        }
Пример #4
0
        /// <summary>创建映射
        /// </summary>
        public override void CreateMap(IMapperConfigurationExpression configuration, Type type)
        {
            if (TargetTypes.IsNullOrEmpty())
            {
                return;
            }

            configuration.CreateAutoAttributeMaps(type, TargetTypes, MemberList);
            //foreach (var targetType in TargetTypes)
            //{
            //    configuration.CreateMap(type, targetType, MemberList);
            //}
        }
Пример #5
0
        public override void CreateMap(TypeAdapterConfig configuration, Type destination)
        {
            if (TargetTypes.IsNullOrEmpty())
            {
                return;
            }

            foreach (Type source in TargetTypes)
            {
                MethodInfo mapperFunc = configuration.GetType().GetMethod("NewConfig").MakeGenericMethod(source, destination);
                mapperFunc.Invoke(configuration, null);
            }
        }
Пример #6
0
        public override void CreateMap(MapperProfile mapperProfile, Type type)
        {
            if (TargetTypes.IsNullOrEmpty())
            {
                return;
            }

            foreach (var targetType in TargetTypes)
            {
                mapperProfile.CreateMap(type, targetType);
                mapperProfile.CreateMap(targetType, type);
            }
        }
Пример #7
0
        public override void CreateMap(IMapperConfigurationExpression configuration, Type type)
        {
            if (TargetTypes.IsNullOrEmpty())
            {
                return;
            }

            configuration.CreateAutoAttributeMaps(type, TargetTypes, MemberList.Source);

            foreach (var targetType in TargetTypes)
            {
                configuration.CreateAutoAttributeMaps(targetType, new[] { type }, MemberList.Destination);
            }
        }
Пример #8
0
        public override void CreateMap(TypeAdapterConfig configuration, Type needstoMap)
        {
            if (TargetTypes.IsNullOrEmpty())
            {
                return;
            }

            foreach (Type source in TargetTypes)
            {
                MethodInfo mapToDestination = configuration.GetType().GetMethod("NewConfig").MakeGenericMethod(source, needstoMap);
                MethodInfo mapToSource      = configuration.GetType().GetMethod("NewConfig").MakeGenericMethod(needstoMap, source);
                mapToDestination.Invoke(configuration, null);
                mapToSource.Invoke(configuration, null);
            }
        }
Пример #9
0
        public override void CreateMap(Type type)
        {
            if (TargetTypes.IsNullOrEmpty())
            {
                return;
            }

            foreach (var targetType in TargetTypes)
            {
                //if (targetType.FullName == "WinMS.Core.Entities.Info.BarcodeInfo")
                //{
                //    var ww = "";
                //}
                Nelibur.ObjectMapper.TinyMapper.Bind(type, targetType);
                Nelibur.ObjectMapper.TinyMapper.Bind(targetType, type);
            }
        }
Пример #10
0
        public override void CreateMap(IMapperConfigurationExpression configuration, Type type)
        {
            if (TargetTypes.IsNullOrEmpty())
            {
                return;
            }

            foreach (var targetType in TargetTypes)
            {
                var configMap = configuration.CreateMap(targetType, type, MemberList.Destination);
                if (selfMemberOptions != null)
                {
                    foreach (var selfMemberOption in selfMemberOptions)
                    {
                        configMap.ForMember(selfMemberOption.Key, selfMemberOption.Value);
                    }
                }
            }
        }
Пример #11
0
        /// <summary>
        /// 创建映射
        /// </summary>
        /// <param name="configuration"></param>
        /// <param name="type">打标签的类</param>
        public override void CreateMap(IMapperConfigurationExpression configuration, Type type)
        {
            /*
             *
             * [AutoMap(TypeOf(Person),TypeOf(Chinese))]
             * public class Student{}
             *
             * 这里参数的type就是Student,targetTypes就是 Person,Chinese等
             */
            if (TargetTypes.IsNullOrEmpty())
            {
                return;
            }
            //当前类映射到模板类上,当前类是source
            configuration.CreateAutoAttributeMaps(type, TargetTypes, MemberList.Source);

            //遍历所有的目标类,映射到当前类上,当前类是Destination
            foreach (var targetType in TargetTypes)
            {
                configuration.CreateAutoAttributeMaps(targetType, new[] { type }, MemberList.Destination);
            }
        }
 public override void CreateMap(IMapperConfigurationExpression configuration, Type type)
 {
     if (TargetTypes.IsNullOrEmpty())
     {
     }
 }