diff --git a/Src/Asp.NetCore2/PgSqlTest/Demo/DemoE_CodeFirst.cs b/Src/Asp.NetCore2/PgSqlTest/Demo/DemoE_CodeFirst.cs index 82f558b2e..69b4b01af 100644 --- a/Src/Asp.NetCore2/PgSqlTest/Demo/DemoE_CodeFirst.cs +++ b/Src/Asp.NetCore2/PgSqlTest/Demo/DemoE_CodeFirst.cs @@ -19,7 +19,16 @@ namespace OrmTest InitKeyType = InitKeyType.Attribute, IsAutoCloseConnection = true }); - db.DbMaintenance.CreateDatabase(); + db.DbMaintenance.CreateDatabase(); + db.CodeFirst.InitTables(); + db.Insertable(new CodeFirstunitea() + { + id2 = null + }).ExecuteCommand(); + db.Insertable(new CodeFirstunitea() + { + id2 = 1 + }).ExecuteCommand(); db.CodeFirst.InitTables(typeof(CodeFirstTable1));//Create CodeFirstTable1 db.Insertable(new CodeFirstTable1() { Name = "a", Text="a" }).ExecuteCommand(); var list = db.Queryable().ToList(); @@ -35,6 +44,13 @@ namespace OrmTest Console.WriteLine("#### CodeFirst end ####"); } } + public class CodeFirstunitea + { + [SugarColumn(IsIdentity =true,IsPrimaryKey =true)] + public uint id { get; set; } + [SugarColumn(IsNullable =true)] + public uint? id2 { get; set; } + } public class CodeFirstsaf { [SugarColumn(DefaultValue ="")]