mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-05-04 20:57:58 +08:00
Performance optimization
This commit is contained in:
parent
b8310b8990
commit
a645f815db
@ -402,21 +402,9 @@ namespace SqlSugar
|
|||||||
if (item.IsArray)
|
if (item.IsArray)
|
||||||
{
|
{
|
||||||
parameter.IsArray = true;
|
parameter.IsArray = true;
|
||||||
if (item.PropertyType.IsIn(typeof(Guid[]), typeof(Guid?[])))
|
if (parameter.Value == null || parameter.Value == DBNull.Value)
|
||||||
{
|
{
|
||||||
parameter.DbType = System.Data.DbType.Guid;
|
ArrayNull(item, parameter);
|
||||||
}
|
|
||||||
else if (item.PropertyType.IsIn(typeof(int[]), typeof(int?[])))
|
|
||||||
{
|
|
||||||
parameter.DbType = System.Data.DbType.Int32;
|
|
||||||
}
|
|
||||||
else if (item.PropertyType.IsIn(typeof(long[]), typeof(long?[])))
|
|
||||||
{
|
|
||||||
parameter.DbType = System.Data.DbType.Int64;
|
|
||||||
}
|
|
||||||
else if (item.PropertyType.IsIn(typeof(short[]), typeof(short?[])))
|
|
||||||
{
|
|
||||||
parameter.DbType = System.Data.DbType.Int16;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (item.Value == null && isDic)
|
if (item.Value == null && isDic)
|
||||||
@ -462,6 +450,27 @@ namespace SqlSugar
|
|||||||
this.UpdateBuilder.Parameters.RemoveAll(it => this.UpdateBuilder.SetValues.Any(v => (SqlBuilder.SqlParameterKeyWord + SqlBuilder.GetNoTranslationColumnName(v.Key)) == it.ParameterName));
|
this.UpdateBuilder.Parameters.RemoveAll(it => this.UpdateBuilder.SetValues.Any(v => (SqlBuilder.SqlParameterKeyWord + SqlBuilder.GetNoTranslationColumnName(v.Key)) == it.ParameterName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void ArrayNull(DbColumnInfo item, SugarParameter parameter)
|
||||||
|
{
|
||||||
|
if (item.PropertyType.IsIn(typeof(Guid[]), typeof(Guid?[])))
|
||||||
|
{
|
||||||
|
parameter.DbType = System.Data.DbType.Guid;
|
||||||
|
}
|
||||||
|
else if (item.PropertyType.IsIn(typeof(int[]), typeof(int?[])))
|
||||||
|
{
|
||||||
|
parameter.DbType = System.Data.DbType.Int32;
|
||||||
|
}
|
||||||
|
else if (item.PropertyType.IsIn(typeof(long[]), typeof(long?[])))
|
||||||
|
{
|
||||||
|
parameter.DbType = System.Data.DbType.Int64;
|
||||||
|
}
|
||||||
|
else if (item.PropertyType.IsIn(typeof(short[]), typeof(short?[])))
|
||||||
|
{
|
||||||
|
parameter.DbType = System.Data.DbType.Int16;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private string GetDbColumnName(string propertyName)
|
private string GetDbColumnName(string propertyName)
|
||||||
{
|
{
|
||||||
if (!IsMappingColumns)
|
if (!IsMappingColumns)
|
||||||
|
Loading…
Reference in New Issue
Block a user