Example #1
0
        public string GetPropertyMappedFrom(string propertyName, Type typeFrom)
        {
            var mapFromProperty = propertyName;

            if (PropertyMaps.Any(pm => pm.Type2Property == propertyName &&
                                 pm.Type1 == typeFrom))
            {
                mapFromProperty = PropertyMaps.First(pm => pm.Type2Property == propertyName &&
                                                     pm.Type1 == typeFrom).Type1Property;
            }
            else if (PropertyMaps.Any(pm => pm.Type1Property == propertyName &&
                                      pm.Type2 == typeFrom))
            {
                mapFromProperty = PropertyMaps.First(pm => pm.Type1Property == propertyName &&
                                                     pm.Type2 == typeFrom).Type2Property;
            }
            return(mapFromProperty);
        }