コード例 #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
ファイル: AutoMapAttribute.cs プロジェクト: cDoru/Stove
        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);
            }
        }
コード例 #12
0
 public override void CreateMap(IMapperConfigurationExpression configuration, Type type)
 {
     if (TargetTypes.IsNullOrEmpty())
     {
     }
 }