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 ListNamedFieldMapping(PropertyInfo propertyInfo, string fieldPath) : base(propertyInfo, fieldPath) { Type listType = propertyInfo.PropertyType; if (propertyInfo.PropertyType.GetTypeInfo().IsInterface) { Type paramType = propertyInfo.PropertyType.GetTypeInfo().GetGenericArguments()[0]; listType = typeof(List <>).MakeGenericType(paramType); } _listFactory = FastConstructor.BuildConstructor(listType); }
public DictionaryFieldMapping(PropertyInfo propertyInfo, string fieldPath) : base(propertyInfo, fieldPath) { Type dictionaryType = propertyInfo.PropertyType; if (propertyInfo.PropertyType.IsInterface) { Type paramType = propertyInfo.PropertyType.GetGenericArguments()[0]; dictionaryType = typeof(List <>).MakeGenericType(paramType); } _dictionaryFactory = FastConstructor.BuildConstructor <int>(dictionaryType); }
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); }
public HashSetNamedFieldMapping(PropertyInfo propertyInfo, string fieldPath) : base(propertyInfo, fieldPath) { _listFactory = FastConstructor.BuildConstructor(_propertyInfo.PropertyType); _addFunc = FastCall.BuildCaller(_propertyInfo.PropertyType.GetMethod("Add")); }
public ArrayNamedFieldMapping(PropertyInfo propertyInfo, string fieldPath) : base(propertyInfo, fieldPath) { _arrayFactory = FastConstructor.BuildConstructor <int>(propertyInfo.PropertyType); }
public ListNamedFieldMapping(PropertyInfo propertyInfo, string fieldPath) : base(propertyInfo, fieldPath) { _listFactory = FastConstructor.BuildConstructor(_propertyInfo.PropertyType); }