Browse Source

Update ado in

pull/32/head
sunkaixuan 2 years ago
parent
commit
5ec247ee8d
  1. 16
      Src/Asp.NetCore2/SqlSugar/Abstract/AdoProvider/AdoProvider.cs
  2. 16
      Src/Asp.NetCore2/SqlSugar/Utilities/UtilMethods.cs

16
Src/Asp.NetCore2/SqlSugar/Abstract/AdoProvider/AdoProvider.cs

@ -1621,9 +1621,18 @@ namespace SqlSugar
{
sql = sql.Replace("@" + item.ParameterName.Substring(1), newValues.ToArray().ToJoinSqlInVals());
}
if (item.ParameterName.Substring(0, 1) != this.SqlParameterKeyWord&& sql.ObjToString().Contains(this.SqlParameterKeyWord + item.ParameterName))
if (item.ParameterName.Substring(0, 1) != this.SqlParameterKeyWord && sql.ObjToString().Contains(this.SqlParameterKeyWord + item.ParameterName))
{
sql = sql.Replace(this.SqlParameterKeyWord+item.ParameterName, newValues.ToArray().ToJoinSqlInVals());
sql = sql.Replace(this.SqlParameterKeyWord + item.ParameterName, newValues.ToArray().ToJoinSqlInVals());
}
else if (item.Value!=null&&UtilMethods.IsNumberArray(item.Value.GetType()))
{
if (newValues.Any(it => it == ""))
{
newValues.RemoveAll(r => r == "");
newValues.Add("null");
}
sql = sql.Replace(item.ParameterName, string.Join(",", newValues));
}
else
{
@ -1641,6 +1650,9 @@ namespace SqlSugar
}
}
}
private List<TResult> GetData<TResult>(Type entityType, IDataReader dataReader)
{
List<TResult> result;

16
Src/Asp.NetCore2/SqlSugar/Utilities/UtilMethods.cs

@ -17,6 +17,22 @@ namespace SqlSugar
{
public class UtilMethods
{
internal static bool IsNumberArray(Type type)
{
return type.IsIn(typeof(int[]),
typeof(long[]),
typeof(short[]),
typeof(uint[]),
typeof(ulong[]),
typeof(ushort[]),
typeof(int?[]),
typeof(long?[]),
typeof(short?[]),
typeof(uint?[]),
typeof(ulong?[]),
typeof(ushort?[]));
}
public static string GetNativeSql(string sql,SugarParameter[] pars)
{
if (pars == null||pars.Length==0)

Loading…
Cancel
Save