コード例 #1
0
 public CollectionNamedFieldMapping(PropertyInfo propertyInfo, string fieldPath)
     : base(propertyInfo, fieldPath)
 {
     _targetElementType = GetTargetElementType();
     _needsMapping      = !NeedsNoConversion(_targetElementType);
     if (_needsMapping)
     {
         _mapper         = TypeMapperBase.GetInstanceFor(_targetElementType);
         _elementFactory = FastConstructor.BuildConstructor(_targetElementType);
     }
 }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
 public HashSetNamedFieldMapping(PropertyInfo propertyInfo, string fieldPath)
     : base(propertyInfo, fieldPath)
 {
     _listFactory = FastConstructor.BuildConstructor(_propertyInfo.PropertyType);
     _addFunc     = FastCall.BuildCaller(_propertyInfo.PropertyType.GetMethod("Add"));
 }
コード例 #6
0
 public ArrayNamedFieldMapping(PropertyInfo propertyInfo, string fieldPath)
     : base(propertyInfo, fieldPath)
 {
     _arrayFactory = FastConstructor.BuildConstructor <int>(propertyInfo.PropertyType);
 }
コード例 #7
0
 public ListNamedFieldMapping(PropertyInfo propertyInfo, string fieldPath)
     : base(propertyInfo, fieldPath)
 {
     _listFactory = FastConstructor.BuildConstructor(_propertyInfo.PropertyType);
 }