public static System.Type GetDefaultClrTypeFromSpannerType(this TypeCode code) { switch (code) { case TypeCode.Bool: return(typeof(bool)); case TypeCode.Int64: return(typeof(long)); case TypeCode.Float64: return(typeof(double)); case TypeCode.Timestamp: case TypeCode.Date: return(typeof(DateTime)); case TypeCode.String: return(typeof(string)); case TypeCode.Bytes: return(typeof(byte[])); case TypeCode.Array: return(typeof(ArrayList)); case TypeCode.Struct: return(typeof(Hashtable)); default: //if we don't recognize it (or its a struct), we use the google native wellknown type. return(typeof(Value)); } }
public static DbType GetDbType(this TypeCode spannerType) { switch (spannerType) { case TypeCode.Bool: return(DbType.Boolean); case TypeCode.Int64: return(DbType.Int64); case TypeCode.Float64: return(DbType.Double); case TypeCode.Timestamp: return(DbType.DateTime); case TypeCode.Date: return(DbType.Date); case TypeCode.String: return(DbType.String); case TypeCode.Bytes: return(DbType.Binary); case TypeCode.Unspecified: case TypeCode.Array: case TypeCode.Struct: return(DbType.Object); default: throw new ArgumentOutOfRangeException(nameof(spannerType), spannerType, null); } }