diff --git a/Src/Asp.Net/SqlServerTest/Demo/DemoE_CodeFirst.cs b/Src/Asp.Net/SqlServerTest/Demo/DemoE_CodeFirst.cs index 949cbd5c5..f7ea27845 100644 --- a/Src/Asp.Net/SqlServerTest/Demo/DemoE_CodeFirst.cs +++ b/Src/Asp.Net/SqlServerTest/Demo/DemoE_CodeFirst.cs @@ -45,9 +45,41 @@ namespace OrmTest if (db.DbMaintenance.IsAnyTable("CodeFirstMaxString1",false)) db.DbMaintenance.DropTable(); db.CodeFirst.InitTables(); + + + db.CurrentConnectionConfig.ConfigureExternalServices = new ConfigureExternalServices() + { + EntityService = (s, p) => + { + p.IfTable() + .UpdateProperty(it=>it.id,it => + { + it.IsIdentity = true; + it.IsPrimarykey= true; + }) + .UpdateProperty(it => it.Name, it=>{ + it.Length = 100; + it.IsNullable = true; + + }) + .OneToOne(it=>it.UnitIFTableInfo,nameof(UnitIFTable.id)); + } + }; + db.CodeFirst.InitTables(); Console.WriteLine("#### CodeFirst end ####"); } } + + public class UnitIFTable + { + //[SugarColumn(IsPrimaryKey =true,IsIdentity =true)] + public int id { get; set; } + // [SugarColumn(IsNullable =true)] + public string Name { get; set; } + + public UnitIFTable UnitIFTableInfo { get; set; } + } + public class CodeFirstMaxString1 { [SugarColumn(ColumnDataType = StaticConfig.CodeFirst_BigString)]