mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-05 17:37:58 +08:00
Add demo
This commit is contained in:
parent
5cb81830ee
commit
7ce9bf3e8b
@ -29,23 +29,36 @@ namespace OrmTest
|
||||
TestBool(db);
|
||||
TestGuid(db);
|
||||
db.CodeFirst.InitTables<CodeFirstTable2>();
|
||||
db.Insertable(new List<CodeFirstTable2>() { new CodeFirstTable2() { CreateTime = DateTime.Now, Name = "a", Text = new ulong[] { } } }).ExecuteCommand();
|
||||
var list2=db.Queryable<CodeFirstTable2>().ToList();
|
||||
db.Insertable(new List<CodeFirstTable2>() { new CodeFirstTable2() { CreateTime = DateTime.Now, Name = "a", Text = new ulong[] { } } }).ExecuteCommand();
|
||||
var list2 = db.Queryable<CodeFirstTable2>().ToList();
|
||||
|
||||
db.CodeFirst.InitTables<CodeFirstTable3>();
|
||||
db.Insertable(
|
||||
new CodeFirstTable3() { CreateTime = DateTime.Now, Name = "123123123", Text = new string[0] }
|
||||
).ExecuteCommand();
|
||||
|
||||
db.Insertable(new List<CodeFirstTable3>()
|
||||
db.Insertable(new List<CodeFirstTable3>()
|
||||
{
|
||||
new CodeFirstTable3() { CreateTime = DateTime.Now, Name = "add", Text = new string[] { "sdfsfd" } },
|
||||
new CodeFirstTable3() { CreateTime = DateTime.Now, Name = "addd", Text = new string[]{ "13123123" } },
|
||||
}).ExecuteCommand();
|
||||
var list3 = db.Queryable<CodeFirstTable3>().ToList();
|
||||
|
||||
|
||||
db.CodeFirst.InitTables<TestNull>();
|
||||
db.Insertable(new TestNull() { Id=1 }).ExecuteCommand();
|
||||
db.Insertable(new List<TestNull>() { new TestNull() { Id = 2}, new TestNull() { Id = 3 } }).ExecuteCommand();
|
||||
var list4=db.Queryable<TestNull>().ToList();
|
||||
db.Deleteable(list4).ExecuteCommand();
|
||||
Console.WriteLine("#### CodeFirst end ####");
|
||||
}
|
||||
public class TestNull
|
||||
{
|
||||
[SugarColumn(IsPrimaryKey =true)]
|
||||
public long Id { get; set; }
|
||||
public DateTime? DateTime { get; set; }
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public Guid? UUID { get; set; }
|
||||
}
|
||||
private static void TestGuid(SqlSugarClient db)
|
||||
{
|
||||
db.CodeFirst.InitTables<GuidTest>();
|
||||
|
Loading…
Reference in New Issue
Block a user