Browse Source

Optimized code

pull/31/head
sunkaixuan 2 years ago
parent
commit
459be0b1af
  1. 35
      Src/Asp.Net/SqlSugar/Realization/PostgreSQL/PostgreSQLProvider.cs

35
Src/Asp.Net/SqlSugar/Realization/PostgreSQL/PostgreSQLProvider.cs

@ -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…
Cancel
Save