mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-22 20:13:41 +08:00
CodeFirst support not null default
This commit is contained in:
@@ -15,8 +15,31 @@ namespace OrmTest
|
||||
Db.DbMaintenance.DropTable("UnitCodeTest1");
|
||||
Db.CodeFirst.InitTables<UnitCodeTest1>();
|
||||
Db.CodeFirst.InitTables<UnitCodeFirstpks2>();
|
||||
if (Db.DbMaintenance.IsAnyTable("UnitCodeFirst131", false))
|
||||
Db.DbMaintenance.DropTable("UnitCodeFirst131");
|
||||
Db.CodeFirst.InitTables<UnitCodeFirst131>();
|
||||
Db.Insertable(new UnitCodeFirst131() { Id = 1 }).ExecuteCommand();
|
||||
Db.CodeFirst.InitTables<UNITCODEFIRST131>();
|
||||
Db.CodeFirst.InitTables<UNITCOdEFIRST131>();
|
||||
}
|
||||
public class UnitCodeFirst131
|
||||
{
|
||||
public int Id { get; set; }
|
||||
}
|
||||
public class UNITCODEFIRST131
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[SqlSugar.SugarColumn(DefaultValue ="a")]
|
||||
public string Name { get; set; }
|
||||
}
|
||||
public class UNITCOdEFIRST131
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[SqlSugar.SugarColumn(DefaultValue = "a")]
|
||||
public string Name { get; set; }
|
||||
[SqlSugar.SugarColumn(DefaultValue = "getdate()")]
|
||||
public DateTime dt { get; set; }
|
||||
}
|
||||
|
||||
public class UnitCodeFirstpks2
|
||||
{
|
||||
[SqlSugar.SugarColumn(IsPrimaryKey =true)]
|
||||
|
Reference in New Issue
Block a user