mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-19 18:22:23 +08:00
Add demo
This commit is contained in:
@@ -34,6 +34,7 @@ namespace OrmTest
|
||||
}
|
||||
public static void Init()
|
||||
{
|
||||
UnitDefaultValueTest.Init();
|
||||
Unitsdfayderqys.Init();
|
||||
Unitsdfaysrs.Init();
|
||||
Unitdslasdgy.Init();
|
||||
|
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrmTest
|
||||
{
|
||||
internal class UnitDefaultValueTest
|
||||
{
|
||||
public static void Init()
|
||||
{
|
||||
var db = NewUnitTest.Db;
|
||||
db.CodeFirst.InitTables<UnitXXXYYYZZZ>();
|
||||
db.DbMaintenance.TruncateTable<UnitXXXYYYZZZ>();
|
||||
db.Insertable(new UnitXXXYYYZZZ() { Id = "1" }).ExecuteCommand();
|
||||
db.CodeFirst.InitTables<unitxxxyyyzzz>();//用同名的新类添加一个字段
|
||||
var list=db.Queryable<unitxxxyyyzzz>().ToList();
|
||||
if (list.First().Id2 != "001") throw new Exception("unit error");
|
||||
}
|
||||
}
|
||||
public class UnitXXXYYYZZZ
|
||||
{
|
||||
public string Id { get; set; }
|
||||
}
|
||||
public class unitxxxyyyzzz
|
||||
{
|
||||
public string Id { get; set; }
|
||||
[SqlSugar.SugarColumn(DefaultValue = "001")]
|
||||
public string Id2 { get; set; }
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user