private void CreatePropertyMap(PropertyInfo sourceProperty, List <PropertyInfo> targetProperties)
        {
            DataFilterAttribute dataFilterAttribute = sourceProperty.GetCustomAttribute <DataFilterAttribute>();

            var targetPropertyName = dataFilterAttribute?.PropertyName;

            if (string.IsNullOrEmpty(targetPropertyName))
            {
                targetPropertyName = sourceProperty.Name;
            }

            var targetProperty = FindTargetProperty(targetProperties, targetPropertyName);

            if (targetProperty == null)
            {
                throw new InvalidOperationException(string.Format("在类型{0}上未找到{1}属性。", TargetType.FullName, targetPropertyName));
            }

            PropertyMap propertyMap = CreateMap(sourceProperty, targetProperty, dataFilterAttribute);

            propertyMap.ComparisonType = dataFilterAttribute?.ComparisonType ?? ComparisonType.Equal;


            _maps.Add(propertyMap);
        }
        private static PropertyMap CreateMap(PropertyInfo sourceProperty, PropertyInfo targetProperty, DataFilterAttribute dataFilterAttribute)
        {
            bool isEnumerable;

            var sourceType = GetSourceRealType(sourceProperty.PropertyType, out isEnumerable);
            var targetType = targetProperty.PropertyType;

            targetType = Nullable.GetUnderlyingType(targetType) ?? targetType;

            if (sourceType != targetType)
            {
                throw new InvalidOperationException("源字段与目标字段的类型不一致。");
            }

            if (isEnumerable && dataFilterAttribute != null && dataFilterAttribute.ComparisonType != ComparisonType.Equal)
            {
                throw new InvalidOperationException("In 语句只能使用相等操作符。");
            }

            Type propertyType = targetType;

            PropertyMap propertyMap = new PropertyMap();

            propertyMap.SourceProperty = sourceProperty;
            propertyMap.TargetProperty = targetProperty;
            propertyMap.IsEnumerable   = isEnumerable;
            propertyMap.PropertyType   = propertyType;
            propertyMap.SourceGetter   = s_delegateFactory.CreateGet(sourceProperty);
            propertyMap.IsNullable     = targetProperty.PropertyType != targetType;
            return(propertyMap);
        }