diff --git a/Src/Asp.Net/SqlSugar/Infrastructure/InstanceFactory.cs b/Src/Asp.Net/SqlSugar/Infrastructure/InstanceFactory.cs index 13c58d8d9..edec2ff9f 100644 --- a/Src/Asp.Net/SqlSugar/Infrastructure/InstanceFactory.cs +++ b/Src/Asp.Net/SqlSugar/Infrastructure/InstanceFactory.cs @@ -207,6 +207,10 @@ namespace SqlSugar { return new OracleInsertable(); } + else if (currentConnectionConfig.DbType == DbType.PostgreSQL) + { + return new PostgreSQLInserttable(); + } else { return new InsertableProvider(); diff --git a/Src/Asp.Net/SqlSugar/OnlyNet/PostgreSQLExpressionContext.cs b/Src/Asp.Net/SqlSugar/OnlyNet/PostgreSQLExpressionContext.cs index 6bf97aacd..32a0c8699 100644 --- a/Src/Asp.Net/SqlSugar/OnlyNet/PostgreSQLExpressionContext.cs +++ b/Src/Asp.Net/SqlSugar/OnlyNet/PostgreSQLExpressionContext.cs @@ -5,6 +5,9 @@ using System.Text; namespace SqlSugar { + internal class PostgreSQLInserttable :InsertableProvider where T : class, new() + { + } internal class PostgreSQLExpressionContext : ExpressionContext, ILambdaExpressions { public SqlSugarClient Context diff --git a/Src/Asp.NetCore2/SqlSeverTest/PgSqlTest/Config.cs b/Src/Asp.NetCore2/SqlSeverTest/PgSqlTest/Config.cs index f526fa969..f6e313fb4 100644 --- a/Src/Asp.NetCore2/SqlSeverTest/PgSqlTest/Config.cs +++ b/Src/Asp.NetCore2/SqlSeverTest/PgSqlTest/Config.cs @@ -8,8 +8,8 @@ namespace OrmTest { public class Config { - public static string ConnectionString = "PORT=5432;DATABASE=SqlSugar4xTest;HOST=localhost;PASSWORD=jhl52771;USER ID=postgres"; - public static string ConnectionString2 = "PORT=5432;DATABASE=SqlSugar4xTest;HOST=localhost;PASSWORD=jhl52771;USER ID=postgres"; - public static string ConnectionString3 = "PORT=5432;DATABASE=SqlSugar4xTest;HOST=localhost;PASSWORD=jhl52771;USER ID=postgres"; + public static string ConnectionString = "PORT=5432;DATABASE=SqlSugar4xTest;HOST=localhost;PASSWORD=haosql;USER ID=postgres"; + public static string ConnectionString2 = "PORT=5432;DATABASE=SqlSugar4xTest;HOST=localhost;PASSWORD=haosql;USER ID=postgres"; + public static string ConnectionString3 = "PORT=5432;DATABASE=SqlSugar4xTest;HOST=localhost;PASSWORD=haosql;USER ID=postgres"; } } diff --git a/Src/Asp.NetCore2/SqlSeverTest/PgSqlTest/Demos/5_CodeFirst.cs b/Src/Asp.NetCore2/SqlSeverTest/PgSqlTest/Demos/5_CodeFirst.cs index cbe2816fb..ce21adb4c 100644 --- a/Src/Asp.NetCore2/SqlSeverTest/PgSqlTest/Demos/5_CodeFirst.cs +++ b/Src/Asp.NetCore2/SqlSeverTest/PgSqlTest/Demos/5_CodeFirst.cs @@ -47,7 +47,7 @@ namespace OrmTest.Demo InitKeyType = InitKeyType.Attribute }); - db.CodeFirst.InitTables(typeof(Student), typeof(School)); + db.CodeFirst.SetStringDefaultLength(30).InitTables(typeof(Student), typeof(School)); //Backup table //db.CodeFirst.BackupTable().InitTables(typeof(CodeTable),typeof(CodeTable2));