public CollectionNamedFieldMapping(PropertyInfo propertyInfo, string fieldPath) : base(propertyInfo, fieldPath) { _targetElementType = GetTargetElementType(); _needsMapping = !NeedsNoConversion(_targetElementType); if (_needsMapping) { _mapper = TypeMapperBase.GetInstanceFor(_targetElementType); _elementFactory = FastConstructor.BuildConstructor(_targetElementType); } }
public DictionaryFieldMapping(PropertyInfo propertyInfo, string fieldPath) : base(propertyInfo, fieldPath) { Type dictionaryType = propertyInfo.PropertyType; _keyType = propertyInfo.PropertyType.GetGenericArguments()[0]; _valueType = propertyInfo.PropertyType.GetGenericArguments()[1]; _needsMapping = !NeedsNoConversion(_valueType); if (_needsMapping) { _mapper = TypeMapperBase.GetInstanceFor(_valueType); _elementFactory = FastConstructor.BuildConstructor(_valueType); } if (propertyInfo.PropertyType.IsInterface) { dictionaryType = typeof(List <>).MakeGenericType(_keyType); } _dictionaryFactory = FastConstructor.BuildConstructor <int>(dictionaryType); }