Example #1
0
        public ListDecoder(ListType listType)
        {
            if (listType.Fields.Count != 1)
            {
                throw new ArgumentException("List type contains more than 1 field.", nameof(listType));
            }

            _childDecoder = SchemaToDecoder.FieldsToDecoders(listType.Fields).First();
            _listType     = typeof(List <>).MakeGenericType(_childDecoder.GetFieldType());
        }
Example #2
0
        public NullDecoder(ColumnDecoder decoder)
        {
            _decoder = decoder;

            _type = _decoder.GetFieldType();

            if (_type.IsPrimitive || _type.IsValueType)
            {
                //If it is a primitive, add nullable
                _type = typeof(Nullable <>).MakeGenericType(_type);
            }
        }