Bosphorus.Dao.Common.Mapper.Default.ValueInjectorFlattenMapper.Map C# (CSharp) Method

Map() public method

public Map ( Type sourceType, object source, Type targetType, object target ) : void
sourceType System.Type
source object
targetType System.Type
target object
return void
        public void Map(Type sourceType, object source, Type targetType, object target)
        {
            foreach (PropertyDescriptor propertyDescriptor in TypeDescriptor.GetProperties(target))
            {
                PropertyDescriptor t1 = propertyDescriptor;
                IEnumerable<PropertyWithComponent> source1 = UberFlatter.Flat(propertyDescriptor.Name, source);
                if (source1.Count() != 0)
                {
                    PropertyWithComponent propertyWithComponent = source1.First();
                    if (propertyWithComponent != null)
                    {
                        object sourcePropertyValue = propertyWithComponent.Property.GetValue(propertyWithComponent.Component);
                        object targetValue = GetTargetValue(propertyWithComponent.Property.PropertyType, sourcePropertyValue, propertyDescriptor.PropertyType);
                        propertyDescriptor.SetValue(target, targetValue);
                    }
                }
            }
        }