internal PropertiesNotMapped GetPropertiesNotMapped()
        {
            // 克隆属性信息
            var sourceProperties = SourceType.GetProperties().ToList();
            var targetProperties = TargetType.GetProperties().ToList();

            var visitor = new PropertiesVisitor(TargetType);
            foreach (var members in memberForNew)
            {
                var members1 = members;
                sourceProperties.RemoveAll((p) => members1.Member.Name == p.Name);
                targetProperties.RemoveAll((p) => visitor.GetProperties(members.Expression).Contains(p));
            }

            // 检查被忽略映射的成员
            sourceProperties.RemoveAll((p) => _propertiesToIgnore.Contains(p));
            return new PropertiesNotMapped
            {
                sourceProperties = sourceProperties,
                targetProperties = targetProperties
            };
        }
Пример #2
0
        internal PropertiesNotMapped GetPropertiesNotMapped()
        {
            PropertiesNotMapped result = new PropertiesNotMapped();
            // Clone PropertyInfo.
            List <PropertyInfo> sourceProperties = SourceType.GetProperties().ToList();
            List <PropertyInfo> targetProperties = TargetType.GetProperties().ToList();

            PropertiesVisitor visitor = new PropertiesVisitor(TargetType);

            for (int i = 0; i < memberForNew.Count; i++)
            {
                var members = memberForNew[i];
                // Simple remove.
                sourceProperties.RemoveAll((p) => members.Member.Name == p.Name);
                targetProperties.RemoveAll((p) => visitor.GetProperties(members.Expression).Contains(p));
            }
            // Check the ignored properties.
            sourceProperties.RemoveAll((p) => propertiesToIgnore.Contains(p));
            result.sourceProperties = sourceProperties;
            result.targetProperties = targetProperties;

            return(result);
        }
        internal PropertiesNotMapped GetPropertiesNotMapped()
        {
            PropertiesNotMapped result = new PropertiesNotMapped();
            // 克隆属性信息
            List <PropertyInfo> sourceProperties = SourceType.GetProperties().ToList();
            List <PropertyInfo> targetProperties = TargetType.GetProperties().ToList();

            PropertiesVisitor visitor = new PropertiesVisitor(TargetType);

            foreach (var members in memberForNew)
            {
                var members1 = members;
                sourceProperties.RemoveAll((p) => members1.Member.Name == p.Name);
                targetProperties.RemoveAll((p) => visitor.GetProperties(members.Expression).Contains(p));
            }

            // 检查被忽略映射的成员
            sourceProperties.RemoveAll((p) => _propertiesToIgnore.Contains(p));
            result.sourceProperties = sourceProperties;
            result.targetProperties = targetProperties;

            return(result);
        }