Update Core

This commit is contained in:
sunkaixuan
2018-12-03 00:35:00 +08:00
parent cd6c70001d
commit 8443581bac
5 changed files with 38 additions and 18 deletions

View File

@@ -484,9 +484,22 @@ namespace SqlSugar
}
result.Add(item);
}
}
return result;
}
else {
DiffLogTableInfo diffTable = new DiffLogTableInfo();
diffTable.TableName = this.EntityInfo.DbTableName;
diffTable.TableDescription = this.EntityInfo.TableDescription;
diffTable.Columns = this.EntityInfo.Columns.Where(it => it.IsIgnore == false).Select(it => new DiffLogColumnInfo()
{
ColumnDescription = it.ColumnDescription,
ColumnName = it.DbColumnName,
Value = it.PropertyInfo.GetValue(this.InsertObjs.Last(), null)
}).ToList();
return new List<DiffLogTableInfo>() { diffTable };
}
}
#endregion
}
}

View File

@@ -39,8 +39,7 @@ namespace SqlSugar
{
return 150;
}
else if (this.Context is OracleExpressionContext)
{
else if (this.Context is OracleExpressionContext) {
return 401;
}
@@ -62,10 +61,6 @@ namespace SqlSugar
{
return (HasWhere?"AND":"WHERE")+ " ROWNUM=1";
}
else if (this.Context is PostgreSQLExpressionContext)
{
return "limit 1";
}
else
{
return "limit 0,1";

View File

@@ -364,6 +364,10 @@ namespace SqlSugar
{
item.Length = 50;
}
if (item.DataType == "varchar" && item.Length == 0)
{
item.Length = 50;
}
}
}
string sql = GetCreateTableSql(tableName, columns);

View File

@@ -80,7 +80,7 @@ namespace SqlSugar
{
return this.Context.Insertable(insertObjs).ExecuteCommand() > 0;
}
public bool InsertRange<T>(List<T>[] insertObjs) where T : class, new()
public bool InsertRange<T>(List<T> insertObjs) where T : class, new()
{
return this.Context.Insertable(insertObjs).ExecuteCommand() > 0;
}
@@ -92,6 +92,10 @@ namespace SqlSugar
{
return this.Context.Updateable(updateObjs).ExecuteCommand() > 0;
}
public bool UpdateRange<T>(List<T> updateObjs) where T : class, new()
{
return this.Context.Updateable(updateObjs).ExecuteCommand() > 0;
}
public bool Update<T>(Expression<Func<T, T>> columns, Expression<Func<T, bool>> whereExpression) where T : class, new()
{
return this.Context.Updateable<T>().UpdateColumns(columns).Where(whereExpression).ExecuteCommand() > 0;
@@ -193,7 +197,7 @@ namespace SqlSugar
{
return this.Context.Insertable(insertObjs).ExecuteCommand() > 0;
}
public bool InsertRange(List<T>[] insertObjs)
public bool InsertRange(List<T> insertObjs)
{
return this.Context.Insertable(insertObjs).ExecuteCommand() > 0;
}
@@ -205,6 +209,10 @@ namespace SqlSugar
{
return this.Context.Updateable(updateObjs).ExecuteCommand() > 0;
}
public bool UpdateRange(List<T> updateObjs)
{
return this.Context.Updateable(updateObjs).ExecuteCommand() > 0;
}
public bool Update(Expression<Func<T, T>> columns, Expression<Func<T, bool>> whereExpression)
{
return this.Context.Updateable<T>().UpdateColumns(columns).Where(whereExpression).ExecuteCommand() > 0;