mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-24 18:04:52 +08:00
Update Demo
This commit is contained in:
parent
5dd77d91e9
commit
fef5049e24
@ -19,4 +19,15 @@ namespace OrmTest.Models
|
||||
[SugarColumn(IsIgnore=true)]
|
||||
public int TestId { get; set; }
|
||||
}
|
||||
|
||||
public class StudentTest
|
||||
{
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "ID")]
|
||||
public int Id { get; set; }
|
||||
public int? SchoolId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public DateTime? CreateTime { get; set; }
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public int TestId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -151,14 +151,19 @@ namespace OrmTest.UnitTest
|
||||
[Name]=@Name WHERE [Id]=@Id", new List<SugarParameter>() {
|
||||
new SugarParameter("@Name","a"),
|
||||
new SugarParameter("@ID",1)
|
||||
}, t13.Key, t13.Value, "Insert t13 error");
|
||||
}, t13.Key, t13.Value, "Update t13 error");
|
||||
|
||||
var t14 = db.Updateable<Student>(new Dictionary<string, object>() { { "id", 0 }, { "name", "2" } }).ToSql();
|
||||
base.Check(@"UPDATE [STudent] SET
|
||||
[Name]=@Name WHERE [Id]=@Id", new List<SugarParameter>() {
|
||||
new SugarParameter("@Name", "2"),
|
||||
new SugarParameter("@ID", 0)
|
||||
}, t14.Key, t14.Value, "Insert t14 error");
|
||||
}, t14.Key, t14.Value, "Update t14 error");
|
||||
|
||||
|
||||
var t15 = db.Updateable(new StudentTest() { Id = 1, Name = "1" }).AS("student").ToSql();
|
||||
base.Check(@"UPDATE [student] SET
|
||||
[SchoolId]=@SchoolId,[Name]=@Name,[CreateTime]=@CreateTime WHERE [Id]=@Id", null, t15.Key, null, "Update t15 error");
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user