mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 22:11:36 +08:00
Update Demo
This commit is contained in:
parent
45ddf36b46
commit
978f75b4cc
@ -8,8 +8,8 @@ namespace OrmTest
|
|||||||
{
|
{
|
||||||
public class Config
|
public class Config
|
||||||
{
|
{
|
||||||
public static string ConnectionString = "server=.;uid=sa;pwd=@jhl85661501;database=SQLSUGAR4XTEST";
|
public static string ConnectionString = "server=.;uid=sa;pwd=haosql;database=SQLSUGAR4XTEST";
|
||||||
public static string ConnectionString2 = "server=.;uid=sa;pwd=@jhl85661501;database=sqlsugar4xtest";
|
public static string ConnectionString2 = "server=.;uid=sa;pwd=haosql;database=sqlsugar4xtest";
|
||||||
public static string ConnectionString3 = "server=.;uid=sa;pwd=@jhl85661501;database=sqlsugar4xtesT";
|
public static string ConnectionString3 = "server=.;uid=sa;pwd=haosql;database=sqlsugar4xtesT";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,9 @@ namespace OrmTest.Demo
|
|||||||
|
|
||||||
//update reutrn Update Count
|
//update reutrn Update Count
|
||||||
var t1 = db.Updateable(updateObj).ExecuteCommand();
|
var t1 = db.Updateable(updateObj).ExecuteCommand();
|
||||||
|
var t11 = db.Updateable<Student>(it => new Student() { Name = "a", CreateTime = DateTime.Now }).Where(it => it.Id == 11).ExecuteCommand();
|
||||||
|
var t111= db.Updateable<Student>(it => it.Name == "Name").Where(it => it.Id == 1).ExecuteCommand();
|
||||||
|
|
||||||
|
|
||||||
//Only update Name
|
//Only update Name
|
||||||
var t3 = db.Updateable(updateObj).UpdateColumns(it => new { it.Name }).ExecuteCommand();
|
var t3 = db.Updateable(updateObj).UpdateColumns(it => new { it.Name }).ExecuteCommand();
|
||||||
|
@ -636,6 +636,20 @@ namespace SqlSugar
|
|||||||
result.UpdateParameterIsNull = true;
|
result.UpdateParameterIsNull = true;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
public virtual IUpdateable<T> Updateable<T>(Expression<Func<T, T>> columns) where T : class, new()
|
||||||
|
{
|
||||||
|
var result = this.Context.Updateable<T>().UpdateColumns(columns);
|
||||||
|
result.UpdateParameterIsNull = true;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
public virtual IUpdateable<T> Updateable<T>(Expression<Func<T, bool>> columns) where T : class, new()
|
||||||
|
{
|
||||||
|
var result = this.Context.Updateable<T>().UpdateColumns(columns);
|
||||||
|
result.UpdateParameterIsNull = true;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public virtual IUpdateable<T> Updateable<T>(Dictionary<string, object> columnDictionary) where T : class, new()
|
public virtual IUpdateable<T> Updateable<T>(Dictionary<string, object> columnDictionary) where T : class, new()
|
||||||
{
|
{
|
||||||
InitMppingInfo<T>();
|
InitMppingInfo<T>();
|
||||||
|
Loading…
Reference in New Issue
Block a user