private static string GetCastFunctionBody(Type type)
{
if (type == typeof(string))
return "VARCHAR(MAX)";
if (type == typeof(int))
return "INT";
if (type == typeof(short))
return "SMALLINT";
if (type == typeof(byte))
return "TINYINT";
if (type == typeof(long))
return "BIGINT";
if (type == typeof(decimal))
return "MONEY";
if (type == typeof(double))
return "FLOAT";
if (type == typeof(DateTime))
return "DATETIME";
if (type == typeof(Guid))
return "UNIQUEIDENTIFIER";
if (type == typeof(bool))
return "BIT";
if (type == typeof(Single))
return "REAL";
throw new ArgumentOutOfRangeException("type", string.Format("No conversion exists for the type: {0}", type.Name));
}