Update Core

This commit is contained in:
skx
2020-04-21 15:57:08 +08:00
parent 6a50885e27
commit 2e4a984564
5 changed files with 33 additions and 6 deletions

View File

@@ -311,7 +311,8 @@ namespace SqlSugar
sqlCommand.Parameters.Clear();
ExecuteAfter(sql, parameters);
SetConnectionEnd(sql);
//sqlCommand.Dispose();
if (this.Context.CurrentConnectionConfig.DbType == DbType.Sqlite)
sqlCommand.Dispose();
return sqlDataReader;
}
catch (Exception ex)
@@ -445,7 +446,8 @@ namespace SqlSugar
sqlCommand.Parameters.Clear();
ExecuteAfter(sql, parameters);
SetConnectionEnd(sql);
//sqlCommand.Dispose();
if (this.Context.CurrentConnectionConfig.DbType == DbType.Sqlite)
sqlCommand.Dispose();
return sqlDataReader;
}
catch (Exception ex)

View File

@@ -191,16 +191,28 @@ namespace SqlSugar
public IDeleteable<T> Where(string whereString, SugarParameter parameter)
{
if (DeleteBuilder.Parameters == null)
{
DeleteBuilder.Parameters = new List<SugarParameter>();
}
DeleteBuilder.Parameters.Add(parameter);
return this;
}
public IDeleteable<T> Where(string whereString, SugarParameter[] parameters)
{
if (DeleteBuilder.Parameters == null)
{
DeleteBuilder.Parameters = new List<SugarParameter>();
}
DeleteBuilder.Parameters.AddRange(parameters);
return this;
}
public IDeleteable<T> Where(string whereString, List<SugarParameter> parameters)
{
if (DeleteBuilder.Parameters == null)
{
DeleteBuilder.Parameters = new List<SugarParameter>();
}
DeleteBuilder.Parameters.AddRange(parameters);
return this;
}

View File

@@ -965,7 +965,12 @@ namespace SqlSugar
addParameters.Add(parameter);
}
parsmeters.AddRange(addParameters);
itemSql = itemSql.TrimEnd(';')+";";
itemSql = itemSql
.TrimEnd('\r')
.TrimEnd('\n')
.TrimEnd('\r')
.TrimEnd('\n')
.TrimEnd(';')+";";
sqlBuilder.AppendLine(itemSql);
index++;
}

View File

@@ -15,9 +15,9 @@ namespace SqlSugar
IDbFirst SettingNamespaceTemplate(Func<string, string> func);
RazorFirst UseRazorAnalysis(string razorClassString, string classNamespace = "Models");
IDbFirst IsCreateAttribute(bool isCreateAttribute = true);
IDbFirst IsCreateDefaultValue(bool isCreateDefaultValue=true);
IDbFirst IsCreateDefaultValue(bool isCreateDefaultValue = true);
IDbFirst Where(params string[] objectNames);
IDbFirst Where(Func<string,bool> func);
IDbFirst Where(Func<string, bool> func);
IDbFirst WhereColumns(Func<string, bool> func);
IDbFirst Where(DbObjectType dbObjectType);
void CreateClassFile(string directoryPath, string nameSpace = "Models");

View File

@@ -10,6 +10,10 @@ namespace SqlSugar
{
int reval = 0;
if (thisValue == null) return 0;
if (thisValue is Enum)
{
return (int)thisValue;
}
if (thisValue != null && thisValue != DBNull.Value && int.TryParse(thisValue.ToString(), out reval))
{
return reval;
@@ -20,6 +24,10 @@ namespace SqlSugar
public static int ObjToInt(this object thisValue, int errorValue)
{
int reval = 0;
if (thisValue is Enum)
{
return (int)thisValue;
}
if (thisValue != null && thisValue != DBNull.Value && int.TryParse(thisValue.ToString(), out reval))
{
return reval;