From 8593bac1ae8c9a6e0d55e802098cca517d6bbe58 Mon Sep 17 00:00:00 2001 From: 2881099 <2881099@qq.com> Date: Thu, 5 Dec 2024 14:31:56 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E4=BF=AE=E5=A4=8D=20Firebird=20=E8=A1=A8?= =?UTF-8?q?=E6=B3=A8=E9=87=8A=E8=BF=81=E7=A7=BB=E9=97=AE=E9=A2=98=EF=BC=88?= =?UTF-8?q?=E5=88=97=E6=B3=A8=E9=87=8A=E6=AD=A3=E5=B8=B8=EF=BC=89=EF=BC=9B?= =?UTF-8?q?#1913?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Examples/base_entity/Program.cs | 11 ++++++++--- Examples/base_entity/base_entity.xml | 5 +++++ .../FreeSql.Provider.Firebird/FirebirdCodeFirst.cs | 4 ++-- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Examples/base_entity/Program.cs b/Examples/base_entity/Program.cs index 1efd22956..ed5d29d38 100644 --- a/Examples/base_entity/Program.cs +++ b/Examples/base_entity/Program.cs @@ -574,16 +574,16 @@ static void Main(string[] args) //.UseSlaveWeight(10, 1, 1, 5) - //.UseConnectionString(FreeSql.DataType.Firebird, @"database=localhost:D:\fbdata\EXAMPLES.fdb;user=sysdba;password=123456;max pool size=5") + .UseConnectionString(FreeSql.DataType.Firebird, @"database=localhost:D:\fbdata\EXAMPLES.fdb;user=sysdba;password=123456;max pool size=5") //.UseQuoteSqlName(false) //.UseConnectionString(FreeSql.DataType.MySql, "Data Source=127.0.0.1;Port=3306;User ID=root;Password=root;Initial Catalog=cccddd;Charset=utf8;SslMode=none;min pool size=1;Max pool size=3;AllowLoadLocalInfile=true") //.UseConnectionString(FreeSql.DataType.SqlServer, "Data Source=.;Integrated Security=True;Initial Catalog=freesqlTest;Pooling=true;Max Pool Size=3;TrustServerCertificate=true") //.UseAdoConnectionPool(false) - .UseConnectionString(FreeSql.DataType.PostgreSQL, "Host=127.0.0.1;Port=5432;Username=postgres;Password=123456;Database=tedb;Pooling=true;Maximum Pool Size=2") + //.UseConnectionString(FreeSql.DataType.PostgreSQL, "Host=127.0.0.1;Port=5432;Username=postgres;Password=123456;Database=tedb;Pooling=true;Maximum Pool Size=2") ////.UseConnectionString(FreeSql.DataType.PostgreSQL, "Host=127.0.0.1;Port=5432;Username=postgres;Password=123456;Database=toc;Pooling=true;Maximum Pool Size=2") - .UseNameConvert(FreeSql.Internal.NameConvertType.ToLower) + //.UseNameConvert(FreeSql.Internal.NameConvertType.ToLower) //.UseConnectionString(FreeSql.DataType.Oracle, "user id=user1;password=123456;data source=//127.0.0.1:1521/XE;Pooling=true;Max Pool Size=2") //.UseNameConvert(FreeSql.Internal.NameConvertType.ToUpper) @@ -619,6 +619,8 @@ static void Main(string[] args) BaseEntity.Initialization(fsql, () => _asyncUow.Value); #endregion + fsql.CodeFirst.SyncStructure(); + var dbpars = new List(); @@ -3310,6 +3312,9 @@ public partial class ProjectItem } +/// +/// 账户 +/// [Table(Name = "t_account")] public class Account { diff --git a/Examples/base_entity/base_entity.xml b/Examples/base_entity/base_entity.xml index 73179bc31..f64b46f9d 100644 --- a/Examples/base_entity/base_entity.xml +++ b/Examples/base_entity/base_entity.xml @@ -331,6 +331,11 @@ 名称 + + + 账户 + + 角色表 diff --git a/Providers/FreeSql.Provider.Firebird/FirebirdCodeFirst.cs b/Providers/FreeSql.Provider.Firebird/FirebirdCodeFirst.cs index 9994cc0cd..7a7fa009f 100644 --- a/Providers/FreeSql.Provider.Firebird/FirebirdCodeFirst.cs +++ b/Providers/FreeSql.Provider.Firebird/FirebirdCodeFirst.cs @@ -268,9 +268,9 @@ from rdb$indices d sb.Remove(sb.Length - 2, 2).Append(");\r\n"); } } - var dbcomment = string.Concat(_orm.Ado.ExecuteScalar(CommandType.Text, _commonUtils.FormatSql(@" select trim(rdb$external_description) from rdb$relations where rdb$system_flag=0 and trim(rdb$relation_name) = {0}", tbname))); + var dbcomment = string.Concat(_orm.Ado.ExecuteScalar(CommandType.Text, _commonUtils.FormatSql(@" select trim(rdb$description) from rdb$relations where rdb$system_flag=0 and trim(rdb$relation_name) = {0}", tbname))); if (dbcomment != (tb.Comment ?? "")) - sb.Append("ALTER TABLE ").Append(_commonUtils.QuoteSqlName(tbname)).Append(" COMMENT ").Append(" ").Append(_commonUtils.FormatSql("{0}", tb.Comment ?? "")).Append(";\r\n"); + sb.Append("COMMENT ON TABLE ").Append(_commonUtils.QuoteSqlName(tbname)).Append(" IS ").Append(_commonUtils.FormatSql("{0}", tb.Comment ?? "")).Append(";\r\n"); } return sb.Length == 0 ? null : sb.ToString(); }