internal MappingTypeInfo(Type inputType, Type outputType) { IsArrayInput = inputType.IsArray; IsArrayOutput = outputType.IsArray; IsInputDynamic = typeof(IDynamicMetaObjectProvider).IsAssignableFrom(inputType); IsOutputDynamic = typeof(IDynamicMetaObjectProvider).IsAssignableFrom(outputType); if (!IsArray) { if (!IsOutputDynamic) { foreach (var propInfo in outputType.GetProperties()) { OutputPropertiesByName.Add(propInfo.Name, propInfo); AddAttributeInfoMapping(propInfo); } } if (!IsInputDynamic) { foreach (var propInfo in inputType.GetProperties()) { InputPropertiesByName.Add(propInfo.Name, propInfo); } } if (!IsDynamic) { CombineInputAndOutputMapping(); } } }
protected void AssignInputProperty(List <AttributeMappingInfo> columnList) { foreach (var ami in columnList) { if (!InputPropertiesByName.ContainsKey(ami.PropNameInInput)) { throw new ETLBoxException($"Property {ami.PropNameInInput} does not exists in target object!"); } ami.PropInInput = InputPropertiesByName[ami.PropNameInInput]; } }
internal MappingTypeInfo(Type inputType, Type outputType) { IsArrayInput = inputType.IsArray; IsArrayOutput = outputType.IsArray; IsDynamic = inputType.IsDynamic() || outputType.IsDynamic(); if (!IsArray && !IsDynamic) { foreach (var propInfo in outputType.GetProperties()) { AddAttributeInfoMapping(propInfo); } foreach (var propInfo in inputType.GetProperties()) { InputPropertiesByName.Add(propInfo.Name, propInfo); } CombineInputAndOutputMapping(); } }