mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-23 04:23:47 +08:00
Update .net core project
This commit is contained in:
@@ -33,7 +33,7 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (!IsDefaultValue(navPropertyValue))
|
if (!IsDefaultValue(navPropertyValue)&& parentColumn.IsPrimarykey==false)
|
||||||
{
|
{
|
||||||
this._Context.Updateable<DbTableInfo>
|
this._Context.Updateable<DbTableInfo>
|
||||||
().AS(parentEntity.DbTableName)
|
().AS(parentEntity.DbTableName)
|
||||||
|
@@ -32,6 +32,7 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
private string _ExecuteCommand()
|
private string _ExecuteCommand()
|
||||||
{
|
{
|
||||||
|
CheckWhere();
|
||||||
PreToSql();
|
PreToSql();
|
||||||
AutoRemoveDataCache();
|
AutoRemoveDataCache();
|
||||||
Check.Exception(UpdateBuilder.WhereValues.IsNullOrEmpty() && GetPrimaryKeys().IsNullOrEmpty(), "You cannot have no primary key and no conditions");
|
Check.Exception(UpdateBuilder.WhereValues.IsNullOrEmpty() && GetPrimaryKeys().IsNullOrEmpty(), "You cannot have no primary key and no conditions");
|
||||||
@@ -42,6 +43,14 @@ namespace SqlSugar
|
|||||||
return sql;
|
return sql;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CheckWhere()
|
||||||
|
{
|
||||||
|
if (UpdateParameterIsNull && UpdateBuilder.WhereValues.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
Check.ExceptionEasy("Update requires conditions", "更新需要条件 Where");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void _WhereColumn(string columnName)
|
private void _WhereColumn(string columnName)
|
||||||
{
|
{
|
||||||
var columnInfos = columns.Where(it => it.DbColumnName.Equals(columnName, StringComparison.OrdinalIgnoreCase) || it.PropertyName.Equals(columnName, StringComparison.OrdinalIgnoreCase)).ToList();
|
var columnInfos = columns.Where(it => it.DbColumnName.Equals(columnName, StringComparison.OrdinalIgnoreCase) || it.PropertyName.Equals(columnName, StringComparison.OrdinalIgnoreCase)).ToList();
|
||||||
|
@@ -18,6 +18,10 @@ namespace SqlSugar
|
|||||||
public UpdateBuilder UpdateBuilder { get; set; }
|
public UpdateBuilder UpdateBuilder { get; set; }
|
||||||
public IAdo Ado { get { return Context.Ado; } }
|
public IAdo Ado { get { return Context.Ado; } }
|
||||||
public T[] UpdateObjs { get; set; }
|
public T[] UpdateObjs { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// true : by expression update
|
||||||
|
/// false: by object update
|
||||||
|
/// </summary>
|
||||||
public bool UpdateParameterIsNull { get; set; }
|
public bool UpdateParameterIsNull { get; set; }
|
||||||
public bool IsMappingTable { get { return this.Context.MappingTables != null && this.Context.MappingTables.Any(); } }
|
public bool IsMappingTable { get { return this.Context.MappingTables != null && this.Context.MappingTables.Any(); } }
|
||||||
public bool IsMappingColumns { get { return this.Context.MappingColumns != null && this.Context.MappingColumns.Any(); } }
|
public bool IsMappingColumns { get { return this.Context.MappingColumns != null && this.Context.MappingColumns.Any(); } }
|
||||||
|
Reference in New Issue
Block a user