Esempio n. 1
0
        private void CreateMapping(IMatchingStrategy <string> matching, Dictionary <string, PropertyInfo> sourcePropertyLookup, PropertyInfo target)
        {
            var targetName = matching.GetLookup(target);

            if (sourcePropertyLookup.ContainsKey(targetName) &&
                sourcePropertyLookup[targetName].PropertyType == target.PropertyType)
            {
                AddMapping(CreateMapping(sourcePropertyLookup[targetName], target));
            }
        }
Esempio n. 2
0
        protected override void CreateMappings(Type sourceType, Type targetType, IMatchingStrategy <string> matching)
        {
            var sourceProperties     = sourceType.GetAccessiblePublicInstanceProperties();
            var targetProperties     = targetType.GetAccessiblePublicInstanceProperties();
            var sourcePropertyLookup = new Dictionary <string, PropertyInfo>();

            foreach (var source in sourceProperties)
            {
                sourcePropertyLookup.Add(matching.GetLookup(source), source);
            }
            foreach (var target in targetProperties)
            {
                CreateMapping(matching, sourcePropertyLookup, target);
            }
        }