From df13a23bcf190ae2d41d3db3a8a84644e0369555 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Fri, 30 Jun 2023 10:35:03 +0800 Subject: [PATCH] Add demo --- Src/Asp.Net/PgSqlTest/Demo/DemoE_CodeFirst.cs | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/Src/Asp.Net/PgSqlTest/Demo/DemoE_CodeFirst.cs b/Src/Asp.Net/PgSqlTest/Demo/DemoE_CodeFirst.cs index de7d6d1ac..4fd59d6c2 100644 --- a/Src/Asp.Net/PgSqlTest/Demo/DemoE_CodeFirst.cs +++ b/Src/Asp.Net/PgSqlTest/Demo/DemoE_CodeFirst.cs @@ -83,9 +83,57 @@ namespace OrmTest db.Insertable(new List { new CodeFloatddfa1a2() { xx = DateTimeOffset.Now }, new CodeFloatddfa1a2() { xx = DateTimeOffset.Now } }).ExecuteCommand(); db.CodeFirst.InitTables(); db.CodeFirst.InitTables(); + //db.Ado.ExecuteCommand("CREATE SCHEMA IF NOT EXISTS haha;"); + //SqlSugarClient db2 = new SqlSugarClient(new ConnectionConfig() + //{ + // DbType = DbType.PostgreSQL, + // ConnectionString = Config.ConnectionString+ "searchpath=haha", + // InitKeyType = InitKeyType.Attribute, + // IsAutoCloseConnection = true + //}); + //db2.CodeFirst.InitTables(); + //var list10 = db2.Queryable().ToList(); + //db.CurrentConnectionConfig.MoreSettings = new ConnMoreSettings() + //{ + // PgSqlIsAutoToLowerCodeFirst = true, + // PgSqlIsAutoToLower = true + //}; + //var list11=db.Queryable().AS("haha.系统用户角色表").ToList(); Console.WriteLine("#### CodeFirst end ####"); } } + [SugarTable("系统用户角色表")] + + public class test1 + + { + + /// + + /// 用户Id + + /// + + [SugarColumn(ColumnDescription = "用户Id")] + + public int Id { get; set; } + + + + /// + + /// 名称 + + /// + + [SugarColumn(ColumnDescription = "名称")] + + public string name { get; set; } + + + + } + public class CodeFirstadfa { [SugarColumn(IsNullable = true, DefaultValue = "CURRENT_TIMESTAMP")]