Exemple #1
0
        public Type GetClrTypeForCustom(IColumnInfo typeInfo)
        {
            var customTypeInfo = (CustomColumnInfo)typeInfo;

            if (customTypeInfo.CustomTypeName == null || !customTypeInfo.CustomTypeName.StartsWith(DataTypeParser.UdtTypeName))
            {
                if (_customDeserializers.TryGetValue(customTypeInfo, out ITypeSerializer serializer))
                {
                    return(serializer.Type);
                }
                return(TypeSerializer.PrimitiveByteArraySerializer.Type);
            }
            var dataType = DataTypeParser.ParseFqTypeName(customTypeInfo.CustomTypeName);
            var map      = _udtSerializer.GetUdtMap($"{dataType.Keyspace}.{dataType.Name}");

            if (map == null)
            {
                throw new InvalidTypeException($"No mapping defined for udt type {dataType.Keyspace}.{dataType.Name}");
            }
            return(map.NetType);
        }