internal Type GetTypeFromStorageType(bool isSqlType)
{
if (isSqlType)
{
switch (_type)
{
case SqlBuffer.StorageType.Empty: return null;
case SqlBuffer.StorageType.Boolean: return typeof(SqlBoolean);
case SqlBuffer.StorageType.Byte: return typeof(SqlByte);
case SqlBuffer.StorageType.DateTime: return typeof(SqlDateTime);
case SqlBuffer.StorageType.Decimal: return typeof(SqlDecimal);
case SqlBuffer.StorageType.Double: return typeof(SqlDouble);
case SqlBuffer.StorageType.Int16: return typeof(SqlInt16);
case SqlBuffer.StorageType.Int32: return typeof(SqlInt32);
case SqlBuffer.StorageType.Int64: return typeof(SqlInt64);
case SqlBuffer.StorageType.Money: return typeof(SqlMoney);
case SqlBuffer.StorageType.Single: return typeof(SqlSingle);
case SqlBuffer.StorageType.String: return typeof(SqlString);
case SqlBuffer.StorageType.SqlCachedBuffer: return typeof(SqlString);
case SqlBuffer.StorageType.SqlBinary: return typeof(object);
case SqlBuffer.StorageType.SqlGuid: return typeof(object);
case SqlBuffer.StorageType.SqlXml: return typeof(SqlXml);
}
}
else
{ //Is CLR Type
switch (_type)
{
case SqlBuffer.StorageType.Empty: return null;
case SqlBuffer.StorageType.Boolean: return typeof(Boolean);
case SqlBuffer.StorageType.Byte: return typeof(Byte);
case SqlBuffer.StorageType.DateTime: return typeof(DateTime);
case SqlBuffer.StorageType.Decimal: return typeof(Decimal);
case SqlBuffer.StorageType.Double: return typeof(Double);
case SqlBuffer.StorageType.Int16: return typeof(Int16);
case SqlBuffer.StorageType.Int32: return typeof(Int32);
case SqlBuffer.StorageType.Int64: return typeof(Int64);
case SqlBuffer.StorageType.Money: return typeof(Decimal);
case SqlBuffer.StorageType.Single: return typeof(Single);
case SqlBuffer.StorageType.String: return typeof(String);
case SqlBuffer.StorageType.SqlBinary: return typeof(Byte[]);
case SqlBuffer.StorageType.SqlCachedBuffer: return typeof(string);
case SqlBuffer.StorageType.SqlGuid: return typeof(Guid);
case SqlBuffer.StorageType.SqlXml: return typeof(string);
}
}
return null; // need to return the value as an object of some CLS type
}