mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-11-09 19:04:58 +08:00
Add IUpdateable<T> Where(string fieldName,string conditionalType, object fieldValue)
This commit is contained in:
@@ -61,7 +61,7 @@ namespace OrmTest.Demo
|
|||||||
|
|
||||||
//sql
|
//sql
|
||||||
db.Updateable(updateObj).Where("id=@x",new { x="1"}).ExecuteCommand();
|
db.Updateable(updateObj).Where("id=@x",new { x="1"}).ExecuteCommand();
|
||||||
|
db.Updateable(updateObj).Where("id","=",1).ExecuteCommand();
|
||||||
var t12 = db.Updateable<School>().AS("Student").UpdateColumns(it => new School() { Name = "jack" }).Where(it => it.Id == 1).ExecuteCommandAsync();
|
var t12 = db.Updateable<School>().AS("Student").UpdateColumns(it => new School() { Name = "jack" }).Where(it => it.Id == 1).ExecuteCommandAsync();
|
||||||
t12.Wait();
|
t12.Wait();
|
||||||
|
|
||||||
|
|||||||
@@ -207,6 +207,15 @@ namespace SqlSugar
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IUpdateable<T> Where(string fieldName,string conditionalType, object fieldValue)
|
||||||
|
{
|
||||||
|
var whereSql=this.SqlBuilder.GetWhere(fieldName, conditionalType,0);
|
||||||
|
this.Where(whereSql);
|
||||||
|
string parameterName = this.SqlBuilder.SqlParameterKeyWord + fieldName+ "0";
|
||||||
|
this.UpdateBuilder.Parameters.Add(new SugarParameter(parameterName, fieldValue));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public IUpdateable<T> With(string lockString)
|
public IUpdateable<T> With(string lockString)
|
||||||
{
|
{
|
||||||
if (this.Context.CurrentConnectionConfig.DbType == DbType.SqlServer)
|
if (this.Context.CurrentConnectionConfig.DbType == DbType.SqlServer)
|
||||||
|
|||||||
@@ -20,6 +20,14 @@ namespace SqlSugar
|
|||||||
IUpdateable<T> Where(Expression<Func<T, bool>> expression);
|
IUpdateable<T> Where(Expression<Func<T, bool>> expression);
|
||||||
IUpdateable<T> Where(string whereSql,object parameters=null);
|
IUpdateable<T> Where(string whereSql,object parameters=null);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="fieldName"></param>
|
||||||
|
/// <param name="conditionalType">for example : = </param>
|
||||||
|
/// <param name="fieldValue"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
IUpdateable<T> Where(string fieldName, string conditionalType, object fieldValue);
|
||||||
|
/// <summary>
|
||||||
/// Non primary key entity update function
|
/// Non primary key entity update function
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="columns"></param>
|
/// <param name="columns"></param>
|
||||||
|
|||||||
Reference in New Issue
Block a user