mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-24 18:04:52 +08:00
Optimized code
This commit is contained in:
parent
f5d95c0855
commit
459be0b1af
@ -114,21 +114,7 @@ namespace SqlSugar
|
||||
}
|
||||
if (parameter.IsArray)
|
||||
{
|
||||
// sqlParameter.Value = this.Context.Utilities.SerializeObject(sqlParameter.Value);
|
||||
var type = sqlParameter.Value.GetType();
|
||||
if (ArrayMapping.ContainsKey(type))
|
||||
{
|
||||
sqlParameter.NpgsqlDbType = ArrayMapping[type] | NpgsqlDbType.Array;
|
||||
}
|
||||
else if (type == DBNull.Value.GetType())
|
||||
{
|
||||
DbNullParametrerArray(parameter, sqlParameter);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Check.Exception(true, sqlParameter.Value.GetType().Name + " No Support");
|
||||
}
|
||||
Array(parameter, sqlParameter);
|
||||
}
|
||||
if (sqlParameter.Direction == 0)
|
||||
{
|
||||
@ -158,6 +144,25 @@ namespace SqlSugar
|
||||
return result;
|
||||
}
|
||||
|
||||
private static void Array(SugarParameter parameter, NpgsqlParameter sqlParameter)
|
||||
{
|
||||
// sqlParameter.Value = this.Context.Utilities.SerializeObject(sqlParameter.Value);
|
||||
var type = sqlParameter.Value.GetType();
|
||||
if (ArrayMapping.ContainsKey(type))
|
||||
{
|
||||
sqlParameter.NpgsqlDbType = ArrayMapping[type] | NpgsqlDbType.Array;
|
||||
}
|
||||
else if (type == DBNull.Value.GetType())
|
||||
{
|
||||
DbNullParametrerArray(parameter, sqlParameter);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Check.Exception(true, sqlParameter.Value.GetType().Name + " No Support");
|
||||
}
|
||||
}
|
||||
|
||||
private static void DbNullParametrerArray(SugarParameter parameter, NpgsqlParameter sqlParameter)
|
||||
{
|
||||
if (parameter.DbType.IsIn(System.Data.DbType.Int32))
|
||||
|
Loading…
Reference in New Issue
Block a user