From 01b9ae00760c23d67ae2f7b32103ea554501cbd9 Mon Sep 17 00:00:00 2001 From: 2881099 <2881099@qq.com> Date: Fri, 8 Nov 2024 14:35:10 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E8=B0=83=E6=95=B4=20resources=20=E8=BD=AC?= =?UTF-8?q?=E6=8D=A2=E6=88=90=20static=20class=20=E9=9D=99=E6=80=81?= =?UTF-8?q?=E7=B1=BB=EF=BC=9B#1917?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AggregateRootRepository.cs | 4 +- .../AggregateRootRepositoryAsync.cs | 2 +- .../AggregateRootRepositorySync.cs | 4 +- .../AggregateRootUtils.cs | 4 +- .../BaseEntityReadOnly.cs | 2 +- .../FreeSqlExtensionsLinq.cs | 2 +- .../QueryableProvider.cs | 16 +- .../ZeroDbContext.SelectImpl.cs | 2 +- .../ZeroDbContext.cs | 4 +- Extensions/FreeSql.Generator/ConsoleApp.cs | 10 +- FreeSql.DbContext/DbContext/DbContext.cs | 6 +- .../DbContext/DbContextErrorStrings.cs | 266 +++ FreeSql.DbContext/DbSet/DbSet.cs | 30 +- FreeSql.DbContext/DbSet/DbSetAsync.cs | 10 +- FreeSql.DbContext/DbSet/DbSetSync.cs | 20 +- .../EfCoreFluentApi/EfCoreTableFluent.cs | 48 +- .../EfCoreFluentApi/EfCoreTableFluent`1.cs | 40 +- .../Extensions/DependencyInjection.cs | 4 +- FreeSql.DbContext/FreeSql.DbContext.csproj | 22 - FreeSql.DbContext/FreeSql.DbContext.xml | 385 ++-- .../Properties/DbContextStrings.Designer.cs | 375 --- .../Properties/DbContextStrings.Designer.tt | 5 - .../Properties/DbContextStrings.resx | 246 -- .../Properties/DbContextStrings.zh-Hans.resx | 246 -- .../Repository/Repository/BaseRepository.cs | 6 +- FreeSql.DbContext/UnitOfWork/UnitOfWork.cs | 2 +- .../UnitOfWork/UnitOfWorkManager.cs | 6 +- FreeSql/DataAnnotations/TableAttribute.cs | 30 +- FreeSql/DataAnnotations/TableFluent.cs | 12 +- FreeSql/Extensions/AdoNetExtensions.cs | 28 +- .../FreeSqlGlobalExpressionCallExtensions.cs | 2 +- FreeSql/Extensions/FreeSqlGlobalExtensions.cs | 46 +- FreeSql/FreeSql.csproj | 18 - FreeSql/FreeSql.xml | 453 ++-- FreeSql/FreeSqlBuilder.cs | 16 +- FreeSql/Internal/CommonExpression.cs | 50 +- .../CommonProvider/AdoProvider/AdoProvider.cs | 2 +- .../AdoProvider/AdoProviderAsync.cs | 2 +- .../AdoProvider/AdoProviderTransaction.cs | 2 +- .../Internal/CommonProvider/BaseDbProvider.cs | 8 +- .../Internal/CommonProvider/DeleteProvider.cs | 4 +- .../CommonProvider/InsertOrUpdateProvider.cs | 16 +- .../Internal/CommonProvider/InsertProvider.cs | 24 +- .../CommonProvider/InsertProviderAsync.cs | 18 +- .../SelectProvider/Select0Provider.cs | 32 +- .../SelectProvider/Select0ProviderReader.cs | 16 +- .../SelectProvider/Select1Provider.cs | 40 +- .../SelectProvider/SelectGroupingProvider.cs | 2 +- .../Internal/CommonProvider/UpdateProvider.cs | 24 +- .../CommonProvider/UpdateProviderAsync.cs | 6 +- .../Internal/Exception/CoreErrorStrings.cs | 2027 +++++++++++++++++ FreeSql/Internal/UtilsExpressionTree.cs | 66 +- FreeSql/Properties/CoreStrings.Designer.cs | 1243 ---------- FreeSql/Properties/CoreStrings.Designer.tt | 5 - FreeSql/Properties/CoreStrings.resx | 603 ----- FreeSql/Properties/CoreStrings.zh-Hans.resx | 638 ------ FreeSql/Properties/Resources.tt | 281 --- .../ClickHouseAdo/ClickHouseAdo.cs | 8 +- .../ClickHouseAdo/ClickHouseConnectionPool.cs | 10 +- .../ClickHouseCodeFirst.cs | 4 +- .../ClickHouseExpression.cs | 2 +- .../Curd/ClickHouseDelete.cs | 4 +- .../Curd/ClickHouseUpdate.cs | 4 +- .../Curd/CustomDelete.cs | 4 +- .../Curd/CustomInsert.cs | 4 +- .../Curd/CustomSelect.cs | 2 +- .../Curd/CustomUpdate.cs | 4 +- .../CustomAdo/CustomAdo.cs | 4 +- .../CustomCodeFirst.cs | 2 +- .../FreeSql.Provider.Custom/CustomProvider.cs | 4 +- .../MySql/Curd/CustomMySqlInsertOrUpdate.cs | 2 +- .../Curd/CustomMySqlOnDuplicateKeyUpdate.cs | 2 +- .../MySql/CustomMySqlAdo/CustomMySqlAdo.cs | 2 +- .../MySql/CustomMySqlCodeFirst.cs | 4 +- .../MySql/CustomMySqlExpression.cs | 2 +- .../Oracle/Curd/CustomOracleDelete.cs | 4 +- .../Oracle/Curd/CustomOracleInsertOrUpdate.cs | 2 +- .../Oracle/Curd/CustomOracleUpdate.cs | 4 +- .../Oracle/CustomOracleAdo/CustomOracleAdo.cs | 2 +- .../Oracle/CustomOracleCodeFirst.cs | 6 +- .../Oracle/CustomOracleDbFirst.cs | 2 +- .../Oracle/CustomOracleExpression.cs | 2 +- .../CustomPostgreSQLOnConflictDoUpdate.cs | 4 +- .../CustomPostgreSQLAdo.cs | 2 +- .../PostgreSQL/CustomPostgreSQLCodeFirst.cs | 4 +- .../PostgreSQL/CustomPostgreSQLExpression.cs | 2 +- .../SqlServer/Curd/CustomSqlServerDelete.cs | 4 +- .../SqlServer/Curd/CustomSqlServerInsert.cs | 8 +- .../Curd/CustomSqlServerInsertOrUpdate.cs | 2 +- .../SqlServer/Curd/CustomSqlServerUpdate.cs | 4 +- .../CustomSqlServerAdo/CustomSqlServerAdo.cs | 2 +- .../SqlServer/CustomSqlServerCodeFirst.cs | 4 +- .../SqlServer/CustomSqlServerExpression.cs | 2 +- .../Curd/DamengDelete.cs | 4 +- .../Curd/DamengInsertOrUpdate.cs | 2 +- .../Curd/DamengUpdate.cs | 4 +- .../DamengAdo/DamengAdo.cs | 8 +- .../DamengAdo/DamengConnectionPool.cs | 10 +- .../DamengCodeFirst.cs | 6 +- .../FreeSql.Provider.Dameng/DamengDbFirst.cs | 2 +- .../DamengExpression.cs | 2 +- .../DamengExtensions.cs | 4 +- .../Curd/DuckdbDelete.cs | 4 +- .../Curd/DuckdbUpdate.cs | 4 +- .../Curd/OnConflictDoUpdate.cs | 4 +- .../DuckdbAdo/DuckdbAdo.cs | 8 +- .../DuckdbAdo/DuckdbConnectionPool.cs | 6 +- .../DuckdbCodeFirst.cs | 4 +- .../DuckdbExpression.cs | 2 +- .../Curd/FirebirdInsertOrUpdate.cs | 2 +- .../FirebirdAdo/FirebirdAdo.cs | 8 +- .../FirebirdAdo/FirebirdConnectionPool.cs | 6 +- .../FirebirdCodeFirst.cs | 4 +- .../FirebirdExpression.cs | 2 +- .../Curd/GBaseDelete.cs | 4 +- .../Curd/GBaseInsert.cs | 2 +- .../Curd/GBaseInsertOrUpdate.cs | 2 +- .../Curd/GBaseUpdate.cs | 4 +- .../GBaseAdo/GBaseAdo.cs | 8 +- .../GBaseAdo/GBaseConnectionPool.cs | 10 +- .../FreeSql.Provider.GBase/GBaseCodeFirst.cs | 4 +- .../FreeSql.Provider.GBase/GBaseExpression.cs | 2 +- .../Curd/KingbaseESOnConflictDoUpdate.cs | 4 +- .../KingbaseESAdo/KingbaseESAdo.cs | 8 +- .../KingbaseESAdo/KingbaseESConnectionPool.cs | 10 +- .../KingbaseESCodeFirst.cs | 4 +- .../KingbaseESExpression.cs | 2 +- .../KingbaseESExtensions.cs | 4 +- .../Curd/MsAccessDelete.cs | 4 +- .../Curd/MsAccessInsert.cs | 2 +- .../Curd/MsAccessSelect.cs | 2 +- .../Curd/MsAccessUpdate.cs | 6 +- .../MsAccessAdo/MsAccessAdo.cs | 8 +- .../MsAccessAdo/MsAccessConnectionPool.cs | 6 +- .../MsAccessCodeFirst.cs | 6 +- .../MsAccessExpression.cs | 2 +- .../MsAccessProvider.cs | 2 +- .../Curd/MySqlInsertOrUpdate.cs | 2 +- .../Curd/OnDuplicateKeyUpdate.cs | 2 +- .../MySqlAdo/MySqlAdo.cs | 8 +- .../MySqlAdo/MySqlConnectionPool.cs | 10 +- .../MySqlAdo/MygisTypes.cs | 2 +- .../FreeSql.Provider.MySql/MySqlCodeFirst.cs | 4 +- .../FreeSql.Provider.MySql/MySqlExpression.cs | 2 +- .../FreeSql.Provider.MySql/MySqlExtensions.cs | 2 +- .../FreeSqlMySqlConnectorGlobalExtensions.cs | 8 +- .../Default/Curd/OdbcDelete.cs | 4 +- .../Default/Curd/OdbcInsert.cs | 4 +- .../Default/Curd/OdbcSelect.cs | 2 +- .../Default/Curd/OdbcUpdate.cs | 4 +- .../Default/OdbcAdo/OdbcAdo.cs | 8 +- .../Default/OdbcAdo/OdbcConnectionPool.cs | 10 +- .../Default/OdbcCodeFirst.cs | 2 +- .../Default/OdbcProvider.cs | 2 +- .../MySql/Curd/OdbcMySqlInsertOrUpdate.cs | 2 +- .../Curd/OdbcMySqlOnDuplicateKeyUpdate.cs | 2 +- .../MySql/OdbcMySqlAdo/OdbcMySqlAdo.cs | 8 +- .../OdbcMySqlAdo/OdbcMySqlConnectionPool.cs | 10 +- .../MySql/OdbcMySqlCodeFirst.cs | 4 +- .../MySql/OdbcMySqlExpression.cs | 2 +- .../Oracle/Curd/OdbcOracleDelete.cs | 4 +- .../Oracle/Curd/OdbcOracleInsertOrUpdate.cs | 2 +- .../Oracle/Curd/OdbcOracleUpdate.cs | 4 +- .../Oracle/OdbcOracleAdo/OdbcOracleAdo.cs | 8 +- .../OdbcOracleAdo/OdbcOracleConnectionPool.cs | 10 +- .../Oracle/OdbcOracleCodeFirst.cs | 6 +- .../Oracle/OdbcOracleDbFirst.cs | 2 +- .../Oracle/OdbcOracleExpression.cs | 2 +- .../Curd/OdbcPostgreSQLOnConflictDoUpdate.cs | 4 +- .../OdbcPostgreSQLAdo/OdbcPostgreSQLAdo.cs | 8 +- .../OdbcPostgreSQLConnectionPool.cs | 10 +- .../PostgreSQL/OdbcPostgreSQLCodeFirst.cs | 4 +- .../PostgreSQL/OdbcPostgreSQLExpression.cs | 2 +- .../SqlServer/Curd/OdbcSqlServerDelete.cs | 4 +- .../SqlServer/Curd/OdbcSqlServerInsert.cs | 8 +- .../Curd/OdbcSqlServerInsertOrUpdate.cs | 2 +- .../SqlServer/Curd/OdbcSqlServerUpdate.cs | 4 +- .../OdbcSqlServerAdo/OdbcSqlServerAdo.cs | 8 +- .../OdbcSqlServerConnectionPool.cs | 10 +- .../SqlServer/OdbcSqlServerCodeFirst.cs | 4 +- .../SqlServer/OdbcSqlServerExpression.cs | 2 +- .../Curd/OracleDelete.cs | 4 +- .../Curd/OracleInsertOrUpdate.cs | 2 +- .../Curd/OracleUpdate.cs | 4 +- .../OracleAdo/OracleAdo.cs | 8 +- .../OracleAdo/OracleConnectionPool.cs | 10 +- .../OracleCodeFirst.cs | 6 +- .../FreeSql.Provider.Oracle/OracleDbFirst.cs | 4 +- .../OracleExpression.cs | 2 +- .../OracleExtensions.cs | 4 +- .../Curd/OnConflictDoUpdate.cs | 4 +- .../PostgreSQLAdo/PostgreSQLAdo.cs | 8 +- .../PostgreSQLAdo/PostgreSQLConnectionPool.cs | 10 +- .../PostgreSQLCodeFirst.cs | 4 +- .../PostgreSQLExpression.cs | 2 +- .../PostgreSQLExtensions.cs | 8 +- .../Curd/OnConflictDoUpdate.cs | 4 +- .../QuestDbAdo/QuestDbAdo.cs | 8 +- .../QuestDbAdo/QuestDbConnectionPool.cs | 10 +- .../QuestDbCodeFirst.cs | 4 +- .../QuestDbExpression.cs | 2 +- .../Curd/ShenTongInsertOrUpdate.cs | 2 +- .../ShenTongAdo/ShenTongAdo.cs | 8 +- .../ShenTongAdo/ShenTongConnectionPool.cs | 10 +- .../ShenTongCodeFirst.cs | 4 +- .../ShenTongExpression.cs | 2 +- .../Curd/SqlServerDelete.cs | 4 +- .../Curd/SqlServerInsert.cs | 8 +- .../Curd/SqlServerInsertOrUpdate.cs | 2 +- .../Curd/SqlServerUpdate.cs | 4 +- .../SqlServerAdo/SqlServerAdo.cs | 8 +- .../SqlServerAdo/SqlServerConnectionPool.cs | 10 +- .../SqlServerCodeFirst.cs | 4 +- .../SqlServerExpression.cs | 2 +- .../SqlServerExtensions.cs | 8 +- .../Curd/SqliteDelete.cs | 4 +- .../Curd/SqliteInsertOrUpdate.cs | 4 +- .../Curd/SqliteUpdate.cs | 4 +- .../SqliteAdo/SqliteAdo.cs | 8 +- .../SqliteAdo/SqliteConnectionPool.cs | 6 +- .../SqliteCodeFirst.cs | 4 +- .../FreeSql.Provider.Sqlite/SqliteDbFirst.cs | 2 +- .../SqliteExpression.cs | 2 +- .../Curd/XuguInsertOrUpdate.cs | 2 +- .../FreeSql.Provider.Xugu/XuguAdo/XuguAdo.cs | 8 +- .../XuguAdo/XuguConnectionPool.cs | 10 +- .../FreeSql.Provider.Xugu/XuguCodeFirst.cs | 4 +- .../FreeSql.Provider.Xugu/XuguExpression.cs | 2 +- 228 files changed, 3422 insertions(+), 4845 deletions(-) create mode 100644 FreeSql.DbContext/DbContext/DbContextErrorStrings.cs delete mode 100644 FreeSql.DbContext/Properties/DbContextStrings.Designer.cs delete mode 100644 FreeSql.DbContext/Properties/DbContextStrings.Designer.tt delete mode 100644 FreeSql.DbContext/Properties/DbContextStrings.resx delete mode 100644 FreeSql.DbContext/Properties/DbContextStrings.zh-Hans.resx create mode 100644 FreeSql/Internal/Exception/CoreErrorStrings.cs delete mode 100644 FreeSql/Properties/CoreStrings.Designer.cs delete mode 100644 FreeSql/Properties/CoreStrings.Designer.tt delete mode 100644 FreeSql/Properties/CoreStrings.resx delete mode 100644 FreeSql/Properties/CoreStrings.zh-Hans.resx delete mode 100644 FreeSql/Properties/Resources.tt diff --git a/Extensions/FreeSql.Extensions.AggregateRoot/AggregateRootRepository/AggregateRootRepository.cs b/Extensions/FreeSql.Extensions.AggregateRoot/AggregateRootRepository/AggregateRootRepository.cs index 207bb3d9c..9ec4a032e 100644 --- a/Extensions/FreeSql.Extensions.AggregateRoot/AggregateRootRepository/AggregateRootRepository.cs +++ b/Extensions/FreeSql.Extensions.AggregateRoot/AggregateRootRepository/AggregateRootRepository.cs @@ -94,9 +94,9 @@ public Dictionary CompareState(TEntity newdata) { if (newdata == null) return null; var _table = Orm.CodeFirst.GetTableByEntity(EntityType); - if (_table.Primarys.Any() == false) throw new Exception(DbContextStrings.Incomparable_EntityHasNo_PrimaryKey(Orm.GetEntityString(EntityType, newdata))); + if (_table.Primarys.Any() == false) throw new Exception(DbContextErrorStrings.Incomparable_EntityHasNo_PrimaryKey(Orm.GetEntityString(EntityType, newdata))); var key = Orm.GetEntityKeyString(EntityType, newdata, false); - if (string.IsNullOrEmpty(key)) throw new Exception(DbContextStrings.Incomparable_PrimaryKey_NotSet(Orm.GetEntityString(EntityType, newdata))); + if (string.IsNullOrEmpty(key)) throw new Exception(DbContextErrorStrings.Incomparable_PrimaryKey_NotSet(Orm.GetEntityString(EntityType, newdata))); if (_states.TryGetValue(key, out var oldState) == false || oldState == null) throw new Exception($"不可对比,数据未被跟踪:{Orm.GetEntityString(EntityType, newdata)}"); AggregateRootTrackingChangeInfo tracking = new AggregateRootTrackingChangeInfo(); AggregateRootUtils.CompareEntityValue(_boundaryName, Orm, EntityType, oldState, newdata, null, tracking); diff --git a/Extensions/FreeSql.Extensions.AggregateRoot/AggregateRootRepository/AggregateRootRepositoryAsync.cs b/Extensions/FreeSql.Extensions.AggregateRoot/AggregateRootRepository/AggregateRootRepositoryAsync.cs index 06eb16baa..b84d2548f 100644 --- a/Extensions/FreeSql.Extensions.AggregateRoot/AggregateRootRepository/AggregateRootRepositoryAsync.cs +++ b/Extensions/FreeSql.Extensions.AggregateRoot/AggregateRootRepository/AggregateRootRepositoryAsync.cs @@ -154,7 +154,7 @@ async public virtual Task InsertOrUpdateAsync(TEntity entity, Cancellat var stateKey = Orm.GetEntityKeyString(EntityType, entity, false); if (entity == null) throw new ArgumentNullException(nameof(entity)); var table = Orm.CodeFirst.GetTableByEntity(EntityType); - if (table.Primarys.Any() == false) throw new Exception(DbContextStrings.CannotAdd_EntityHasNo_PrimaryKey(Orm.GetEntityString(EntityType, entity))); + if (table.Primarys.Any() == false) throw new Exception(DbContextErrorStrings.CannotAdd_EntityHasNo_PrimaryKey(Orm.GetEntityString(EntityType, entity))); var flagExists = ExistsInStates(entity); if (flagExists == false) diff --git a/Extensions/FreeSql.Extensions.AggregateRoot/AggregateRootRepository/AggregateRootRepositorySync.cs b/Extensions/FreeSql.Extensions.AggregateRoot/AggregateRootRepository/AggregateRootRepositorySync.cs index cc864d1ff..0f3584403 100644 --- a/Extensions/FreeSql.Extensions.AggregateRoot/AggregateRootRepository/AggregateRootRepositorySync.cs +++ b/Extensions/FreeSql.Extensions.AggregateRoot/AggregateRootRepository/AggregateRootRepositorySync.cs @@ -32,7 +32,7 @@ public virtual void BeginEdit(List data) { if (data == null) return; var table = Orm.CodeFirst.GetTableByEntity(EntityType); - if (table.Primarys.Any() == false) throw new Exception(DbContextStrings.CannotEdit_EntityHasNo_PrimaryKey(Orm.GetEntityString(EntityType, data.First()))); + if (table.Primarys.Any() == false) throw new Exception(DbContextErrorStrings.CannotEdit_EntityHasNo_PrimaryKey(Orm.GetEntityString(EntityType, data.First()))); _statesEditing.Clear(); _dataEditing = data; foreach (var item in data) @@ -216,7 +216,7 @@ public virtual TEntity InsertOrUpdate(TEntity entity) var stateKey = Orm.GetEntityKeyString(EntityType, entity, false); if (entity == null) throw new ArgumentNullException(nameof(entity)); var table = Orm.CodeFirst.GetTableByEntity(EntityType); - if (table.Primarys.Any() == false) throw new Exception(DbContextStrings.CannotAdd_EntityHasNo_PrimaryKey(Orm.GetEntityString(EntityType, entity))); + if (table.Primarys.Any() == false) throw new Exception(DbContextErrorStrings.CannotAdd_EntityHasNo_PrimaryKey(Orm.GetEntityString(EntityType, entity))); var flagExists = ExistsInStates(entity); if (flagExists == false) diff --git a/Extensions/FreeSql.Extensions.AggregateRoot/AggregateRootRepository/AggregateRootUtils.cs b/Extensions/FreeSql.Extensions.AggregateRoot/AggregateRootRepository/AggregateRootUtils.cs index a79f9af51..54a35455c 100644 --- a/Extensions/FreeSql.Extensions.AggregateRoot/AggregateRootRepository/AggregateRootUtils.cs +++ b/Extensions/FreeSql.Extensions.AggregateRoot/AggregateRootRepository/AggregateRootUtils.cs @@ -499,7 +499,7 @@ Expression LocalGetAutoIncludeQuery(Expression queryExp, int depth, Type entityT void LocalInclude(TableRef tbref, Expression exp) { var incMethod = queryExp.Type.GetMethod("Include"); - if (incMethod == null) throw new Exception(CoreStrings.RunTimeError_Reflection_IncludeMany.Replace("IncludeMany", "Include")); + if (incMethod == null) throw new Exception(CoreErrorStrings.RunTimeError_Reflection_IncludeMany.Replace("IncludeMany", "Include")); queryExp = Expression.Call(queryExp, incMethod.MakeGenericMethod(tbref.RefEntityType), Expression.Lambda(typeof(Func<,>).MakeGenericType(entityType, tbref.RefEntityType), exp, navigateParameterExp)); } @@ -508,7 +508,7 @@ void LocalIncludeMany(TableRef tbref, Expression exp, bool isthen) var funcType = typeof(Func<,>).MakeGenericType(entityType, typeof(IEnumerable<>).MakeGenericType(tbref.RefEntityType)); var navigateSelector = Expression.Lambda(funcType, exp, navigateParameterExp); var incMethod = queryExp.Type.GetMethod("IncludeMany"); - if (incMethod == null) throw new Exception(CoreStrings.RunTimeError_Reflection_IncludeMany); + if (incMethod == null) throw new Exception(CoreErrorStrings.RunTimeError_Reflection_IncludeMany); LambdaExpression navigateThen = null; var navigateThenType = typeof(Action<>).MakeGenericType(typeof(ISelect<>).MakeGenericType(tbref.RefEntityType)); var thenParameter = Expression.Parameter(typeof(ISelect<>).MakeGenericType(tbref.RefEntityType), "then"); diff --git a/Extensions/FreeSql.Extensions.BaseEntity/BaseEntityReadOnly.cs b/Extensions/FreeSql.Extensions.BaseEntity/BaseEntityReadOnly.cs index d9ac6b96a..f66c1508b 100644 --- a/Extensions/FreeSql.Extensions.BaseEntity/BaseEntityReadOnly.cs +++ b/Extensions/FreeSql.Extensions.BaseEntity/BaseEntityReadOnly.cs @@ -24,7 +24,7 @@ public abstract class BaseEntity static Func _resoleOrm; internal static Func _resolveUow; - public static IFreeSql Orm => _resoleOrm?.Invoke() ?? throw new Exception(CoreStrings.S_BaseEntity_Initialization_Error); + public static IFreeSql Orm => _resoleOrm?.Invoke() ?? throw new Exception(CoreErrorStrings.S_BaseEntity_Initialization_Error); public static void Initialization(IFreeSql fsql, Func resolveUow) => Initialization(() => fsql, resolveUow); public static void Initialization(Func resoleOrm, Func resolveUow) diff --git a/Extensions/FreeSql.Extensions.Linq/FreeSqlExtensionsLinq.cs b/Extensions/FreeSql.Extensions.Linq/FreeSqlExtensionsLinq.cs index b45a05381..1f3e499ad 100644 --- a/Extensions/FreeSql.Extensions.Linq/FreeSqlExtensionsLinq.cs +++ b/Extensions/FreeSql.Extensions.Linq/FreeSqlExtensionsLinq.cs @@ -33,7 +33,7 @@ public static IQueryable AsQueryable(this ISelect that) where T1 : c /// public static ISelect RestoreToSelect(this IQueryable that) where T1 : class { - var queryable = that as QueryableProvider ?? throw new Exception(CoreStrings.S_CannotBeConverted_To_ISelect(typeof(T1).Name)); + var queryable = that as QueryableProvider ?? throw new Exception(CoreErrorStrings.S_CannotBeConverted_To_ISelect(typeof(T1).Name)); return queryable._select; } diff --git a/Extensions/FreeSql.Extensions.Linq/QueryableProvider.cs b/Extensions/FreeSql.Extensions.Linq/QueryableProvider.cs index 12e0131ce..11b2226f9 100644 --- a/Extensions/FreeSql.Extensions.Linq/QueryableProvider.cs +++ b/Extensions/FreeSql.Extensions.Linq/QueryableProvider.cs @@ -121,7 +121,7 @@ object tplOrderBy(string method, bool isDescending) case "Average": return tplMaxMinAvgSum("Avg"); case "Concat": - return throwCallExp(CoreStrings.Not_Support); + return throwCallExp(CoreErrorStrings.Not_Support); case "Contains": if (callExp.Arguments.Count == 2) { @@ -141,7 +141,7 @@ object tplOrderBy(string method, bool isDescending) _select.Distinct(); break; } - return throwCallExp(CoreStrings.Not_Support); + return throwCallExp(CoreErrorStrings.Not_Support); case "ElementAt": case "ElementAtOrDefault": @@ -178,7 +178,7 @@ object tplOrderBy(string method, bool isDescending) _select.InternalWhere(whereParam); break; } - return throwCallExp(CoreStrings.Not_Support); + return throwCallExp(CoreErrorStrings.Not_Support); case "Skip": _select.Offset((int)callExp.Arguments[1].GetConstExprValue()); @@ -190,7 +190,7 @@ object tplOrderBy(string method, bool isDescending) case "ToList": if (callExp.Arguments.Count == 1) return _select.ToList(); - return throwCallExp(CoreStrings.Not_Support); + return throwCallExp(CoreErrorStrings.Not_Support); case "Select": var selectParam = (callExp.Arguments[1] as UnaryExpression)?.Operand as LambdaExpression; @@ -199,7 +199,7 @@ object tplOrderBy(string method, bool isDescending) _select._selectExpression = selectParam; break; } - return throwCallExp(CoreStrings.Not_Support); + return throwCallExp(CoreErrorStrings.Not_Support); case "Join": if (callExp.Arguments.Count == 5) @@ -241,13 +241,13 @@ object tplOrderBy(string method, bool isDescending) case "Last": case "LastOrDefault": - return throwCallExp(CoreStrings.Not_Support); + return throwCallExp(CoreErrorStrings.Not_Support); case "GroupBy": - return throwCallExp(CoreStrings.Not_Support); + return throwCallExp(CoreErrorStrings.Not_Support); default: - return throwCallExp(CoreStrings.Not_Support); + return throwCallExp(CoreErrorStrings.Not_Support); } } if (tresult == null) return null; diff --git a/Extensions/FreeSql.Extensions.ZeroEntity/ZeroDbContext.SelectImpl.cs b/Extensions/FreeSql.Extensions.ZeroEntity/ZeroDbContext.SelectImpl.cs index aee96eb7a..f1d8cda75 100644 --- a/Extensions/FreeSql.Extensions.ZeroEntity/ZeroDbContext.SelectImpl.cs +++ b/Extensions/FreeSql.Extensions.ZeroEntity/ZeroDbContext.SelectImpl.cs @@ -571,7 +571,7 @@ NativeTuple ParseField(ZeroTableInfo firstTable, string firs var ta = _tableAlias.Where(a => string.Join(".", a.NavPath) == navPath).FirstOrDefault(); if (ta?.Table.ColumnsByCs.TryGetValue(field.Last(), out var col) == true) return NativeTuple.Create($"{ta.Alias}.{_common.QuoteSqlName(col.Attribute.Name)}", col); - throw new Exception(CoreStrings.Cannot_Match_Property(property)); + throw new Exception(CoreErrorStrings.Cannot_Match_Property(property)); } /// diff --git a/Extensions/FreeSql.Extensions.ZeroEntity/ZeroDbContext.cs b/Extensions/FreeSql.Extensions.ZeroEntity/ZeroDbContext.cs index 2731ed830..2a1343751 100644 --- a/Extensions/FreeSql.Extensions.ZeroEntity/ZeroDbContext.cs +++ b/Extensions/FreeSql.Extensions.ZeroEntity/ZeroDbContext.cs @@ -295,12 +295,12 @@ void TransactionInvoke(Action handler) _orm.Aop.TraceBeforeHandler?.Invoke(this, transBefore); handler?.Invoke(); _transaction.Commit(); - _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.Commit, null)); + _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreErrorStrings.Commit, null)); } catch (Exception ex) { _transaction.Rollback(); - _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.RollBack, ex)); + _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreErrorStrings.RollBack, ex)); throw; } finally diff --git a/Extensions/FreeSql.Generator/ConsoleApp.cs b/Extensions/FreeSql.Generator/ConsoleApp.cs index 0588094b2..a0590ae18 100644 --- a/Extensions/FreeSql.Generator/ConsoleApp.cs +++ b/Extensions/FreeSql.Generator/ConsoleApp.cs @@ -163,7 +163,7 @@ public ConsoleApp(string[] args, ManualResetEvent wait) case "-nameoptions": ArgsNameOptions = args[a + 1].Split(',').Select(opt => opt == "1").ToArray(); - if (ArgsNameOptions.Length != 4) throw new ArgumentException(CoreStrings.S_NameOptions_Incorrect); + if (ArgsNameOptions.Length != 4) throw new ArgumentException(CoreErrorStrings.S_NameOptions_Incorrect); a++; break; case "-namespace": @@ -172,7 +172,7 @@ public ConsoleApp(string[] args, ManualResetEvent wait) break; case "-db": var dbargs = args[a + 1].Split(',', 2); - if (dbargs.Length != 2) throw new ArgumentException(CoreStrings.S_DB_ParameterError); + if (dbargs.Length != 2) throw new ArgumentException(CoreErrorStrings.S_DB_ParameterError); switch (dbargs[0].Trim().ToLower()) { @@ -186,7 +186,7 @@ public ConsoleApp(string[] args, ManualResetEvent wait) case "kingbasees": ArgsDbType = DataType.KingbaseES; break; case "shentong": ArgsDbType = DataType.ShenTong; break; case "clickhouse": ArgsDbType = DataType.ClickHouse; break; - default: throw new ArgumentException(CoreStrings.S_DB_ParameterError_UnsupportedType(dbargs[0])); + default: throw new ArgumentException(CoreErrorStrings.S_DB_ParameterError_UnsupportedType(dbargs[0])); } ArgsConnectionString = dbargs[1].Trim(); a++; @@ -225,11 +225,11 @@ public ConsoleApp(string[] args, ManualResetEvent wait) a++; break; default: - throw new ArgumentException(CoreStrings.S_WrongParameter(args[a])); + throw new ArgumentException(CoreErrorStrings.S_WrongParameter(args[a])); } } - if (string.IsNullOrEmpty(ArgsConnectionString)) throw new ArgumentException(CoreStrings.S_DB_Parameter_Error_NoConnectionString); + if (string.IsNullOrEmpty(ArgsConnectionString)) throw new ArgumentException(CoreErrorStrings.S_DB_Parameter_Error_NoConnectionString); RazorEngine.Engine.Razor = RazorEngineService.Create(new RazorEngine.Configuration.TemplateServiceConfiguration { diff --git a/FreeSql.DbContext/DbContext/DbContext.cs b/FreeSql.DbContext/DbContext/DbContext.cs index adeccc301..19b39bd38 100644 --- a/FreeSql.DbContext/DbContext/DbContext.cs +++ b/FreeSql.DbContext/DbContext/DbContext.cs @@ -12,12 +12,12 @@ namespace FreeSql public abstract partial class DbContext : IDisposable { internal DbContextScopedFreeSql _ormScoped; - internal IFreeSql OrmOriginal => _ormScoped?._originalFsql ?? throw new ArgumentNullException(DbContextStrings.ConfigureUseFreeSql); + internal IFreeSql OrmOriginal => _ormScoped?._originalFsql ?? throw new ArgumentNullException(DbContextErrorStrings.ConfigureUseFreeSql); /// /// 该对象 Select/Delete/Insert/Update/InsertOrUpdate 与 DbContext 事务保持一致,可省略传递 WithTransaction /// - public IFreeSql Orm => _ormScoped ?? throw new ArgumentNullException(DbContextStrings.ConfigureUseFreeSql); + public IFreeSql Orm => _ormScoped ?? throw new ArgumentNullException(DbContextErrorStrings.ConfigureUseFreeSql); #region Property UnitOfWork internal bool _isUseUnitOfWork = true; //是否创建工作单元事务 @@ -135,7 +135,7 @@ public virtual IDbSet Set(Type entityType) void CheckEntityTypeOrThrow(Type entityType) { if (OrmOriginal.CodeFirst.GetTableByEntity(entityType) == null) - throw new ArgumentException(DbContextStrings.ParameterDataTypeError(entityType.FullName)); + throw new ArgumentException(DbContextErrorStrings.ParameterDataTypeError(entityType.FullName)); } /// /// 添加 diff --git a/FreeSql.DbContext/DbContext/DbContextErrorStrings.cs b/FreeSql.DbContext/DbContext/DbContextErrorStrings.cs new file mode 100644 index 000000000..e989c07c6 --- /dev/null +++ b/FreeSql.DbContext/DbContext/DbContextErrorStrings.cs @@ -0,0 +1,266 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FreeSql +{ + public static class DbContextErrorStrings + { + public static string Language = "en"; + /// + /// AddFreeDbContext 发生错误,请检查 {dbContextTypeName} 的构造参数都已正确注入 + /// + public static string AddFreeDbContextError_CheckConstruction(object dbContextTypeName) => string.Format(Language == "cn" ? + @"AddFreeDbContext 发生错误,请检查 {0} 的构造参数都已正确注入" : + @"FreeSql: An error occurred in AddFreeDbContext, check that the construction parameters of {0} have been injected correctly", dbContextTypeName); + /// + /// 不可添加,已存在于状态管理:{entityString} + /// + public static string CannotAdd_AlreadyExistsInStateManagement(object entityString) => string.Format(Language == "cn" ? + @"不可添加,已存在于状态管理:{0}" : + @"FreeSql: Not addable, already exists in state management: {0}", entityString); + /// + /// 不可添加,实体没有主键:{entityString} + /// + public static string CannotAdd_EntityHasNo_PrimaryKey(object entityString) => string.Format(Language == "cn" ? + @"不可添加,实体没有主键:{0}" : + @"FreeSql: Not addable, entity has no primary key: {0}", entityString); + /// + /// 不可添加,未设置主键的值:{entityString} + /// + public static string CannotAdd_PrimaryKey_NotSet(object entityString) => string.Format(Language == "cn" ? + @"不可添加,未设置主键的值:{0}" : + @"FreeSql: Not addable, no value for primary key set: {0}", entityString); + /// + /// 不可添加,自增属性有值:{entityString} + /// + public static string CannotAdd_SelfIncreasingHasValue(object entityString) => string.Format(Language == "cn" ? + @"不可添加,自增属性有值:{0}" : + @"FreeSql: Not addable, self-increasing attribute has value: {0}", entityString); + /// + /// 不可附加,实体没有主键:{entityString} + /// + public static string CannotAttach_EntityHasNo_PrimaryKey(object entityString) => string.Format(Language == "cn" ? + @"不可附加,实体没有主键:{0}" : + @"FreeSql: Not attachable, entity has no primary key: {0}", entityString); + /// + /// 不可附加,未设置主键的值:{entityString} + /// + public static string CannotAttach_PrimaryKey_NotSet(object entityString) => string.Format(Language == "cn" ? + @"不可附加,未设置主键的值:{0}" : + @"FreeSql: Not attachable, no value for primary key set: {0}", entityString); + /// + /// 不可删除,数据未被跟踪,应该先查询:{entityString} + /// + public static string CannotDelete_DataNotTracked_ShouldQuery(object entityString) => string.Format(Language == "cn" ? + @"不可删除,数据未被跟踪,应该先查询:{0}" : + @"FreeSql: Not deletable, data not tracked, should query first: {0}", entityString); + /// + /// 不可删除,实体没有主键:{entityString} + /// + public static string CannotDelete_EntityHasNo_PrimaryKey(object entityString) => string.Format(Language == "cn" ? + @"不可删除,实体没有主键:{0}" : + @"FreeSql: Not deletable, entity has no primary key: {0}", entityString); + /// + /// 不可删除,未设置主键的值:{entityString} + /// + public static string CannotDelete_PrimaryKey_NotSet(object entityString) => string.Format(Language == "cn" ? + @"不可删除,未设置主键的值:{0}" : + @"FreeSql: Not deletable, no value for primary key set: {0}", entityString); + /// + /// 不可进行编辑,实体没有主键:{entityString} + /// + public static string CannotEdit_EntityHasNo_PrimaryKey(object entityString) => string.Format(Language == "cn" ? + @"不可进行编辑,实体没有主键:{0}" : + @"FreeSql: Not editable, entity has no primary key: {0}", entityString); + /// + /// 不可更新,数据未被跟踪,应该先查询 或者 Attach:{entityString} + /// + public static string CannotUpdate_DataShouldQueryOrAttach(object entityString) => string.Format(Language == "cn" ? + @"不可更新,数据未被跟踪,应该先查询 或者 Attach:{0}" : + @"FreeSql: Not updatable, data not tracked, should be queried first or Attach:{0}", entityString); + /// + /// 不可更新,实体没有主键:{entityString} + /// + public static string CannotUpdate_EntityHasNo_PrimaryKey(object entityString) => string.Format(Language == "cn" ? + @"不可更新,实体没有主键:{0}" : + @"FreeSql: Not updatable, entity has no primary key: {0}", entityString); + /// + /// 不可更新,未设置主键的值:{entityString} + /// + public static string CannotUpdate_PrimaryKey_NotSet(object entityString) => string.Format(Language == "cn" ? + @"不可更新,未设置主键的值:{0}" : + @"FreeSql: Not updatable, no value for primary key set: {0}", entityString); + /// + /// 不可更新,数据库不存在该记录:{entityString} + /// + public static string CannotUpdate_RecordDoesNotExist(object entityString) => string.Format(Language == "cn" ? + @"不可更新,数据库不存在该记录:{0}" : + @"FreeSql: Not updatable, the record does not exist in the database: {0}", entityString); + /// + /// 请在 OnConfiguring 或 AddFreeDbContext 中配置 UseFreeSql + /// + public static string ConfigureUseFreeSql => Language == "cn" ? + @"请在 OnConfiguring 或 AddFreeDbContext 中配置 UseFreeSql" : + @"FreeSql: Please configure UseFreeSql in OnConfiguring or AddFreeDbContext"; + /// + /// DbSet.AsType 参数错误,请传入正确的实体类型 + /// + public static string DbSetAsType_NotSupport_Object => Language == "cn" ? + @"DbSet.AsType 参数错误,请传入正确的实体类型" : + @"FreeSql: DbSet. AsType parameter error, please pass in the correct entity type"; + /// + /// 实体类型 {EntityTypeName} 无法转换为 {name},无法使用该方法 + /// + public static string EntityType_CannotConvert(object EntityTypeName, object name) => string.Format(Language == "cn" ? + @"实体类型 {0} 无法转换为 {1},无法使用该方法" : + @"FreeSql: Entity type {0} cannot be converted to {1} and cannot use this method", EntityTypeName, name); + /// + /// 实体类型 {EntityTypeName} 主键类型不为 {fullName},无法使用该方法 + /// + public static string EntityType_PrimaryKeyError(object EntityTypeName, object fullName) => string.Format(Language == "cn" ? + @"实体类型 {0} 主键类型不为 {1},无法使用该方法" : + @"FreeSql: Entity type {0} Primary key type is not {1} and cannot be used with this method", EntityTypeName, fullName); + /// + /// 实体类型 {EntityTypeName} 主键数量不为 1,无法使用该方法 + /// + public static string EntityType_PrimaryKeyIsNotOne(object EntityTypeName) => string.Format(Language == "cn" ? + @"实体类型 {0} 主键数量不为 1,无法使用该方法" : + @"FreeSql: Entity type {0} Primary key number is not 1 and cannot be used with this method", EntityTypeName); + /// + /// FreeSql.Repository 设置过滤器失败,原因是对象不属于 IRepository + /// + public static string FailedSetFilter_NotBelongIRpository => Language == "cn" ? + @"FreeSql.Repository 设置过滤器失败,原因是对象不属于 IRepository" : + @"FreeSql: FreeSql. Repository failed to set filter because object does not belong to IRepository"; + /// + /// 不可比较,实体没有主键:{entityString} + /// + public static string Incomparable_EntityHasNo_PrimaryKey(object entityString) => string.Format(Language == "cn" ? + @"不可比较,实体没有主键:{0}" : + @"FreeSql: Not comparable, entity has no primary key: {0}", entityString); + /// + /// 不可比较,未设置主键的值:{entityString} + /// + public static string Incomparable_PrimaryKey_NotSet(object entityString) => string.Format(Language == "cn" ? + @"不可比较,未设置主键的值:{0}" : + @"FreeSql: Non-comparable, no value for primary key set: {0}", entityString); + /// + /// FreeSql.Repository Insert 失败,因为设置了过滤器 {filterKey}: {filterValueExpression},插入的数据不符合 {entityString} + /// + public static string InsertError_Filter(object filterKey, object filterValueExpression, object entityString) => string.Format(Language == "cn" ? + @"FreeSql.Repository Insert 失败,因为设置了过滤器 {0}: {1},插入的数据不符合 {2}" : + @"FreeSql: FreeSql.Repository Insert failed because the filter {0}: {1} was set and the inserted data does not conform to {2}", filterKey, filterValueExpression, entityString); + /// + /// ISelect.AsType 参数不支持指定为 object + /// + public static string ISelectAsType_ParameterError => Language == "cn" ? + @"ISelect.AsType 参数不支持指定为 object" : + @"FreeSql: ISelect. AsType parameter does not support specifying as object"; + /// + /// {tableTypeFullName} 不存在属性 {propertyName} + /// + public static string NotFound_Property(object propertyName, object tableTypeFullName) => string.Format(Language == "cn" ? + @"{1} 不存在属性 {0}" : + @"FreeSql: Property {0} does not exist for {1}", propertyName, tableTypeFullName); + /// + /// 找不到方法 DbSet&lt;&gt;.StatesRemoveByObjects + /// + public static string NotFoundMethod_StatesRemoveByObjects => Language == "cn" ? + @"找不到方法 DbSet<>.StatesRemoveByObjects" : + @"FreeSql: Method DbSet<> not found. StatesRemoveByObjects"; + /// + /// 参数 data 类型错误 {entityTypeFullName} + /// + public static string ParameterDataTypeError(object entityTypeFullName) => string.Format(Language == "cn" ? + @"参数 data 类型错误 {0} " : + @"FreeSql: Parameter data type error {0}", entityTypeFullName); + /// + /// 参数错误 {param} + /// + public static string ParameterError(object param) => string.Format(Language == "cn" ? + @"参数错误 {0}" : + @"FreeSql: Parameter error {0}", param); + /// + /// 参数错误 {param} 不能为 null + /// + public static string ParameterError_CannotBeNull(object param) => string.Format(Language == "cn" ? + @"参数错误 {0} 不能为 null" : + @"FreeSql: Parameter error {0} cannot be null", param); + /// + /// 参数错误 {many} 不是集合属性 + /// + public static string ParameterError_IsNot_CollectionProperties(object many) => string.Format(Language == "cn" ? + @"参数错误 {0} 不是集合属性" : + @"FreeSql: Parameter error {0} is not a collection property", many); + /// + /// 参数错误 {many} 集合属性不存在 + /// + public static string ParameterError_NotFound_CollectionProperties(object many) => string.Format(Language == "cn" ? + @"参数错误 {0} 集合属性不存在" : + @"FreeSql: Parameter error {0} Collection property does not exist", many); + /// + /// 参数错误 {one} 属性不存在 + /// + public static string ParameterError_NotFound_Property(object one) => string.Format(Language == "cn" ? + @"参数错误 {0} 属性不存在" : + @"FreeSql: Parameter error {0} attribute does not exist", one); + /// + /// Propagation_Mandatory: 使用当前事务,如果没有当前事务,就抛出异常 + /// + public static string Propagation_Mandatory => Language == "cn" ? + @"Propagation_Mandatory: 使用当前事务,如果没有当前事务,就抛出异常" : + @"FreeSql: Propagation_ Mandatory: With the current transaction, throw an exception if there is no current transaction"; + /// + /// Propagation_Never: 以非事务方式执行操作,如果当前事务存在则抛出异常 + /// + public static string Propagation_Never => Language == "cn" ? + @"Propagation_Never: 以非事务方式执行操作,如果当前事务存在则抛出异常" : + @"FreeSql: Propagation_ Never: Perform the operation non-transactionally and throw an exception if the current transaction exists"; + /// + /// {tableTypeFullName} 类型的属性 {propertyName} 不是 OneToMany 或 ManyToMany 特性 + /// + public static string PropertyOfType_IsNot_OneToManyOrManyToMany(object propertyName, object tableTypeFullName) => string.Format(Language == "cn" ? + @"{1} 类型的属性 {0} 不是 OneToMany 或 ManyToMany 特性" : + @"FreeSql: Property {0} of type {1} is not OneToMany or ManyToMany attribute", propertyName, tableTypeFullName); + /// + /// 特别错误:批量添加失败,{dataType} 的返回数据,与添加的数目不匹配 + /// + public static string SpecialError_BatchAdditionFailed(object dataType) => string.Format(Language == "cn" ? + @"特别错误:批量添加失败,{0} 的返回数据,与添加的数目不匹配" : + @"FreeSql: Special error: Bulk add failed, {0} returned data, does not match the number added", dataType); + /// + /// 特别错误:更新失败,数据未被跟踪:{entityString} + /// + public static string SpecialError_UpdateFailedDataNotTracked(object entityString) => string.Format(Language == "cn" ? + @"特别错误:更新失败,数据未被跟踪:{0}" : + @"FreeSql: Special error: Update failed, data not tracked: {0}", entityString); + /// + /// 已开启事务,不能禁用工作单元 + /// + public static string TransactionHasBeenStarted => Language == "cn" ? + @"已开启事务,不能禁用工作单元" : + @"FreeSql: Transaction opened, unit of work cannot be disabled"; + /// + /// {tableTypeFullName} 类型已设置属性 {propertyName} 忽略特性 + /// + public static string TypeHasSetProperty_IgnoreAttribute(object tableTypeFullName, object propertyName) => string.Format(Language == "cn" ? + @"{0} 类型已设置属性 {1} 忽略特性" : + @"FreeSql: The {0} type has set the property {1} Ignore the attribute", tableTypeFullName, propertyName); + /// + /// {unitOfWorkManager} 构造参数 {fsql} 不能为 null + /// + public static string UnitOfWorkManager_Construction_CannotBeNull(object unitOfWorkManager, object fsql) => string.Format(Language == "cn" ? + @"{0} 构造参数 {1} 不能为 null" : + @"FreeSql: The {0} constructor parameter {1} cannot be null", unitOfWorkManager, fsql); + /// + /// FreeSql.Repository Update 失败,因为设置了过滤器 {filterKey}: {filterValueExpression},更新的数据不符合{entityString} + /// + public static string UpdateError_Filter(object filterKey, object filterValueExpression, object entityString) => string.Format(Language == "cn" ? + @"FreeSql.Repository Update 失败,因为设置了过滤器 {0}: {1},更新的数据不符合{2}" : + @"FreeSql: FreeSql.Repository Update failed because the filter {0}: {1} is set and the updated data does not conform to {2}", filterKey, filterValueExpression, entityString); + } + +} diff --git a/FreeSql.DbContext/DbSet/DbSet.cs b/FreeSql.DbContext/DbSet/DbSet.cs index ade54e245..b66df0505 100644 --- a/FreeSql.DbContext/DbSet/DbSet.cs +++ b/FreeSql.DbContext/DbSet/DbSet.cs @@ -162,10 +162,10 @@ internal void TrackToList(object list) /// public DbSet AsType(Type entityType) { - if (entityType == typeof(object)) throw new Exception(CoreStrings.TypeAsType_NotSupport_Object("DbSet")); + if (entityType == typeof(object)) throw new Exception(CoreErrorStrings.TypeAsType_NotSupport_Object("DbSet")); if (entityType == _entityType) return this; var newtb = _db.OrmOriginal.CodeFirst.GetTableByEntity(entityType); - _tablePriv = newtb ?? throw new Exception(CoreStrings.Type_AsType_Parameter_Error("DbSet")); + _tablePriv = newtb ?? throw new Exception(CoreErrorStrings.Type_AsType_Parameter_Error("DbSet")); _tableIdentitysPriv = null; _tableReturnColumnsPriv = null; _entityType = entityType; @@ -220,7 +220,7 @@ public EntityState(TEntity value, string key) void AttachPriv(IEnumerable data, bool isAuditValue) { if (data == null || data.Any() == false) return; - if (_table.Primarys.Any() == false) throw new Exception(DbContextStrings.CannotAttach_EntityHasNo_PrimaryKey(_db.OrmOriginal.GetEntityString(_entityType, data.First()))); + if (_table.Primarys.Any() == false) throw new Exception(DbContextErrorStrings.CannotAttach_EntityHasNo_PrimaryKey(_db.OrmOriginal.GetEntityString(_entityType, data.First()))); foreach (var item in data) { if (isAuditValue) @@ -229,7 +229,7 @@ void AttachPriv(IEnumerable data, bool isAuditValue) _db.Options.AuditValue?.Invoke(new DbContextAuditValueEventArgs(Aop.AuditValueType.Update, _table.Type, item)); } var key = _db.OrmOriginal.GetEntityKeyString(_entityType, item, false); - if (string.IsNullOrEmpty(key)) throw new Exception(DbContextStrings.CannotAttach_PrimaryKey_NotSet(_db.OrmOriginal.GetEntityString(_entityType, item))); + if (string.IsNullOrEmpty(key)) throw new Exception(DbContextErrorStrings.CannotAttach_PrimaryKey_NotSet(_db.OrmOriginal.GetEntityString(_entityType, item))); _states.AddOrUpdate(key, k => CreateEntityState(item), (k, ov) => { @@ -264,9 +264,9 @@ public DbSet AttachOnlyPrimary(TEntity data) public Dictionary CompareState(TEntity newdata) { if (newdata == null) return null; - if (_table.Primarys.Any() == false) throw new Exception(DbContextStrings.Incomparable_EntityHasNo_PrimaryKey(_db.OrmOriginal.GetEntityString(_entityType, newdata))); + if (_table.Primarys.Any() == false) throw new Exception(DbContextErrorStrings.Incomparable_EntityHasNo_PrimaryKey(_db.OrmOriginal.GetEntityString(_entityType, newdata))); var key = _db.OrmOriginal.GetEntityKeyString(_entityType, newdata, false); - if (string.IsNullOrEmpty(key)) throw new Exception(DbContextStrings.Incomparable_PrimaryKey_NotSet(_db.OrmOriginal.GetEntityString(_entityType, newdata))); + if (string.IsNullOrEmpty(key)) throw new Exception(DbContextErrorStrings.Incomparable_PrimaryKey_NotSet(_db.OrmOriginal.GetEntityString(_entityType, newdata))); if (_states.TryGetValue(key, out var oldState) == false || oldState == null) return _table.ColumnsByCs.ToDictionary(a => a.Key, a => new object[] { @@ -326,7 +326,7 @@ bool CanAdd(TEntity data, bool isThrow) } if (_table.Primarys.Any() == false) { - if (isThrow) throw new Exception(DbContextStrings.CannotAdd_EntityHasNo_PrimaryKey(_db.OrmOriginal.GetEntityString(_entityType, data))); + if (isThrow) throw new Exception(DbContextErrorStrings.CannotAdd_EntityHasNo_PrimaryKey(_db.OrmOriginal.GetEntityString(_entityType, data))); return false; } FreeSql.Internal.CommonProvider.InsertProvider.AuditDataValue(this, data, _db.OrmOriginal, _table, null); @@ -350,7 +350,7 @@ bool CanAdd(TEntity data, bool isThrow) default: if (_tableIdentitys.Length == 1 && _table.Primarys.Length == 1) return true; - if (isThrow) throw new Exception(DbContextStrings.CannotAdd_PrimaryKey_NotSet(_db.OrmOriginal.GetEntityString(_entityType, data))); + if (isThrow) throw new Exception(DbContextErrorStrings.CannotAdd_PrimaryKey_NotSet(_db.OrmOriginal.GetEntityString(_entityType, data))); return false; } } @@ -359,14 +359,14 @@ bool CanAdd(TEntity data, bool isThrow) //不可添加,已存在于状态管理 //if (_states.ContainsKey(key)) //{ - // if (isThrow) throw new Exception(DbContextStrings.CannotAdd_AlreadyExistsInStateManagement(_db.OrmOriginal.GetEntityString(_entityType, data))); + // if (isThrow) throw new Exception(DbContextErrorStrings.CannotAdd_AlreadyExistsInStateManagement(_db.OrmOriginal.GetEntityString(_entityType, data))); // return false; //} if (_db.OrmOriginal.Ado.DataType == DataType.ClickHouse) return true; var idval = _db.OrmOriginal.GetEntityIdentityValueWithPrimary(_entityType, data); if (idval > 0) { - if (isThrow) throw new Exception(DbContextStrings.CannotAdd_SelfIncreasingHasValue(_db.OrmOriginal.GetEntityString(_entityType, data))); + if (isThrow) throw new Exception(DbContextErrorStrings.CannotAdd_SelfIncreasingHasValue(_db.OrmOriginal.GetEntityString(_entityType, data))); return false; } } @@ -393,7 +393,7 @@ bool CanUpdate(TEntity data, bool isThrow) } if (_table.Primarys.Any() == false) { - if (isThrow) throw new Exception(DbContextStrings.CannotUpdate_EntityHasNo_PrimaryKey(_db.OrmOriginal.GetEntityString(_entityType, data))); + if (isThrow) throw new Exception(DbContextErrorStrings.CannotUpdate_EntityHasNo_PrimaryKey(_db.OrmOriginal.GetEntityString(_entityType, data))); return false; } FreeSql.Internal.CommonProvider.UpdateProvider.AuditDataValue(this, data, _db.OrmOriginal, _table, null); @@ -401,12 +401,12 @@ bool CanUpdate(TEntity data, bool isThrow) var key = _db.OrmOriginal.GetEntityKeyString(_entityType, data, false); if (string.IsNullOrEmpty(key)) { - if (isThrow) throw new Exception(DbContextStrings.CannotUpdate_PrimaryKey_NotSet(_db.OrmOriginal.GetEntityString(_entityType, data))); + if (isThrow) throw new Exception(DbContextErrorStrings.CannotUpdate_PrimaryKey_NotSet(_db.OrmOriginal.GetEntityString(_entityType, data))); return false; } if (_states.TryGetValue(key, out var tryval) == false) { - if (isThrow) throw new Exception(DbContextStrings.CannotUpdate_DataShouldQueryOrAttach(_db.OrmOriginal.GetEntityString(_entityType, data))); + if (isThrow) throw new Exception(DbContextErrorStrings.CannotUpdate_DataShouldQueryOrAttach(_db.OrmOriginal.GetEntityString(_entityType, data))); return false; } return true; @@ -432,13 +432,13 @@ bool CanRemove(TEntity data, bool isThrow) } if (_table.Primarys.Any() == false) { - if (isThrow) throw new Exception(DbContextStrings.CannotDelete_EntityHasNo_PrimaryKey(_db.OrmOriginal.GetEntityString(_entityType, data))); + if (isThrow) throw new Exception(DbContextErrorStrings.CannotDelete_EntityHasNo_PrimaryKey(_db.OrmOriginal.GetEntityString(_entityType, data))); return false; } var key = _db.OrmOriginal.GetEntityKeyString(_entityType, data, false); if (string.IsNullOrEmpty(key)) { - if (isThrow) throw new Exception(DbContextStrings.CannotDelete_PrimaryKey_NotSet(_db.OrmOriginal.GetEntityString(_entityType, data))); + if (isThrow) throw new Exception(DbContextErrorStrings.CannotDelete_PrimaryKey_NotSet(_db.OrmOriginal.GetEntityString(_entityType, data))); return false; } //if (_states.TryGetValue(key, out var tryval) == false) { diff --git a/FreeSql.DbContext/DbSet/DbSetAsync.cs b/FreeSql.DbContext/DbSet/DbSetAsync.cs index 31231e5b1..361bd4473 100644 --- a/FreeSql.DbContext/DbSet/DbSetAsync.cs +++ b/FreeSql.DbContext/DbSet/DbSetAsync.cs @@ -119,7 +119,7 @@ async public Task AddRangeAsync(IEnumerable data, CancellationToken can case DataType.DuckDB: await DbContextFlushCommandAsync(cancellationToken); var rets = await this.OrmInsert(data).ExecuteInsertedAsync(cancellationToken); - if (rets.Count != data.Count()) throw new Exception(DbContextStrings.SpecialError_BatchAdditionFailed(_db.OrmOriginal.Ado.DataType)); + if (rets.Count != data.Count()) throw new Exception(DbContextErrorStrings.SpecialError_BatchAdditionFailed(_db.OrmOriginal.Ado.DataType)); _db._entityChangeReport.AddRange(rets.Select(a => new DbContext.EntityChangeReport.ChangeInfo { EntityType = _entityType, Object = a, Type = DbContext.EntityChangeType.Insert })); var idx = 0; foreach (var s in data) @@ -321,7 +321,7 @@ async Task DbContextBatchUpdatePrivAsync(EntityState[] ups, bool isLiveUpda if (_states.TryGetValue(uplst1.Key, out var lstval1) == false) return -999; var lstval2 = default(EntityState); - if (uplst2 != null && _states.TryGetValue(uplst2.Key, out lstval2) == false) throw new Exception(DbContextStrings.SpecialError_UpdateFailedDataNotTracked(_db.OrmOriginal.GetEntityString(_entityType, uplst2.Value))); + if (uplst2 != null && _states.TryGetValue(uplst2.Key, out lstval2) == false) throw new Exception(DbContextErrorStrings.SpecialError_UpdateFailedDataNotTracked(_db.OrmOriginal.GetEntityString(_entityType, uplst2.Value))); var cuig1 = _db.OrmOriginal.CompareEntityValueReturnColumns(_entityType, uplst1.Value, lstval1.Value, true); var cuig2 = uplst2 != null ? _db.OrmOriginal.CompareEntityValueReturnColumns(_entityType, uplst2.Value, lstval2.Value, true) : null; @@ -373,11 +373,11 @@ async Task DbContextBatchUpdatePrivAsync(EntityState[] ups, bool isLiveUpda async public Task UpdateAsync(TEntity data, CancellationToken cancellationToken = default) { var exists = ExistsInStates(data); - if (exists == null) throw new Exception(DbContextStrings.CannotUpdate_PrimaryKey_NotSet(_db.OrmOriginal.GetEntityString(_entityType, data))); + if (exists == null) throw new Exception(DbContextErrorStrings.CannotUpdate_PrimaryKey_NotSet(_db.OrmOriginal.GetEntityString(_entityType, data))); if (exists == false) { var olddata = await OrmSelect(data).FirstAsync(cancellationToken); - if (olddata == null) throw new Exception(DbContextStrings.CannotUpdate_RecordDoesNotExist(_db.OrmOriginal.GetEntityString(_entityType, data))); + if (olddata == null) throw new Exception(DbContextErrorStrings.CannotUpdate_RecordDoesNotExist(_db.OrmOriginal.GetEntityString(_entityType, data))); } await UpdateRangePrivAsync(new[] { data }, true, cancellationToken); @@ -442,7 +442,7 @@ async public Task RemoveAsync(Expression> predicate, Ca async public Task AddOrUpdateAsync(TEntity data, CancellationToken cancellationToken = default) { if (data == null) throw new ArgumentNullException(nameof(data)); - if (_table.Primarys.Any() == false) throw new Exception(DbContextStrings.CannotAdd_EntityHasNo_PrimaryKey(_db.OrmOriginal.GetEntityString(_entityType, data))); + if (_table.Primarys.Any() == false) throw new Exception(DbContextErrorStrings.CannotAdd_EntityHasNo_PrimaryKey(_db.OrmOriginal.GetEntityString(_entityType, data))); var flagExists = ExistsInStates(data); if (flagExists == false) diff --git a/FreeSql.DbContext/DbSet/DbSetSync.cs b/FreeSql.DbContext/DbSet/DbSetSync.cs index 3cf7b2190..5d639539f 100644 --- a/FreeSql.DbContext/DbSet/DbSetSync.cs +++ b/FreeSql.DbContext/DbSet/DbSetSync.cs @@ -122,7 +122,7 @@ public void AddRange(IEnumerable data) case DataType.DuckDB: DbContextFlushCommand(); var rets = this.OrmInsert(data).ExecuteInserted(); - if (rets.Count != data.Count()) throw new Exception(DbContextStrings.SpecialError_BatchAdditionFailed(_db.OrmOriginal.Ado.DataType)); + if (rets.Count != data.Count()) throw new Exception(DbContextErrorStrings.SpecialError_BatchAdditionFailed(_db.OrmOriginal.Ado.DataType)); _db._entityChangeReport.AddRange(rets.Select(a => new DbContext.EntityChangeReport.ChangeInfo { EntityType = _entityType, Object = a, Type = DbContext.EntityChangeType.Insert })); var idx = 0; foreach (var s in data) @@ -347,7 +347,7 @@ int DbContextBatchUpdatePriv(EntityState[] ups, bool isLiveUpdate) if (_states.TryGetValue(uplst1.Key, out var lstval1) == false) return -999; var lstval2 = default(EntityState); - if (uplst2 != null && _states.TryGetValue(uplst2.Key, out lstval2) == false) throw new Exception(DbContextStrings.SpecialError_UpdateFailedDataNotTracked(_db.OrmOriginal.GetEntityString(_entityType, uplst2.Value))); + if (uplst2 != null && _states.TryGetValue(uplst2.Key, out lstval2) == false) throw new Exception(DbContextErrorStrings.SpecialError_UpdateFailedDataNotTracked(_db.OrmOriginal.GetEntityString(_entityType, uplst2.Value))); var cuig1 = _db.OrmOriginal.CompareEntityValueReturnColumns(_entityType, uplst1.Value, lstval1.Value, true); var cuig2 = uplst2 != null ? _db.OrmOriginal.CompareEntityValueReturnColumns(_entityType, uplst2.Value, lstval2.Value, true) : null; @@ -405,11 +405,11 @@ int DbContextBatchUpdatePriv(EntityState[] ups, bool isLiveUpdate) public void Update(TEntity data) { var exists = ExistsInStates(data); - if (exists == null) throw new Exception(DbContextStrings.CannotUpdate_PrimaryKey_NotSet(_db.OrmOriginal.GetEntityString(_entityType, data))); + if (exists == null) throw new Exception(DbContextErrorStrings.CannotUpdate_PrimaryKey_NotSet(_db.OrmOriginal.GetEntityString(_entityType, data))); if (exists == false) { var olddata = OrmSelect(data).First(); - if (olddata == null) throw new Exception(DbContextStrings.CannotUpdate_RecordDoesNotExist(_db.OrmOriginal.GetEntityString(_entityType, data))); + if (olddata == null) throw new Exception(DbContextErrorStrings.CannotUpdate_RecordDoesNotExist(_db.OrmOriginal.GetEntityString(_entityType, data))); } UpdateRangePriv(new[] { data }, true); @@ -506,7 +506,7 @@ public int Remove(Expression> predicate) public void AddOrUpdate(TEntity data) { if (data == null) throw new ArgumentNullException(nameof(data)); - if (_table.Primarys.Any() == false) throw new Exception(DbContextStrings.CannotAdd_EntityHasNo_PrimaryKey(_db.OrmOriginal.GetEntityString(_entityType, data))); + if (_table.Primarys.Any() == false) throw new Exception(DbContextErrorStrings.CannotAdd_EntityHasNo_PrimaryKey(_db.OrmOriginal.GetEntityString(_entityType, data))); var flagExists = ExistsInStates(data); if (flagExists == false) @@ -546,7 +546,7 @@ public void AddOrUpdate(TEntity data) public void BeginEdit(List data) { if (data == null) return; - if (_table.Primarys.Any() == false) throw new Exception(DbContextStrings.CannotEdit_EntityHasNo_PrimaryKey(_db.OrmOriginal.GetEntityString(_entityType, data.First()))); + if (_table.Primarys.Any() == false) throw new Exception(DbContextErrorStrings.CannotEdit_EntityHasNo_PrimaryKey(_db.OrmOriginal.GetEntityString(_entityType, data.First()))); _statesEditing.Clear(); _dataEditing = data; foreach (var item in data) @@ -845,7 +845,7 @@ void LocalEach(DbSet dbset, IEnumerable items, bool isOneToOne) var rawset = _db.Set(dbset.EntityType); var statesRemove = typeof(DbSet<>).MakeGenericType(dbset.EntityType).GetMethod("StatesRemoveByObjects", BindingFlags.NonPublic | BindingFlags.Instance, null, new[] { typeof(IEnumerable) }, null); - if (statesRemove == null) throw new Exception(DbContextStrings.NotFoundMethod_StatesRemoveByObjects); + if (statesRemove == null) throw new Exception(DbContextErrorStrings.NotFoundMethod_StatesRemoveByObjects); statesRemove.Invoke(rawset, new object[] { items }); } returnDeleted?.AddRange(items); @@ -866,8 +866,8 @@ public void SaveMany(TEntity item, string propertyName) { if (item == null) return; if (string.IsNullOrEmpty(propertyName)) return; - if (_table.Properties.TryGetValue(propertyName, out var prop) == false) throw new KeyNotFoundException(DbContextStrings.NotFound_Property(_table.Type.FullName, propertyName)); - if (_table.ColumnsByCsIgnore.ContainsKey(propertyName)) throw new ArgumentException(DbContextStrings.TypeHasSetProperty_IgnoreAttribute(_table.Type.FullName, propertyName)); + if (_table.Properties.TryGetValue(propertyName, out var prop) == false) throw new KeyNotFoundException(DbContextErrorStrings.NotFound_Property(_table.Type.FullName, propertyName)); + if (_table.ColumnsByCsIgnore.ContainsKey(propertyName)) throw new ArgumentException(DbContextErrorStrings.TypeHasSetProperty_IgnoreAttribute(_table.Type.FullName, propertyName)); var tref = _table.GetTableRef(propertyName, true, false); if (tref == null) return; @@ -876,7 +876,7 @@ public void SaveMany(TEntity item, string propertyName) case TableRefType.OneToOne: case TableRefType.ManyToOne: case TableRefType.PgArrayToMany: - throw new ArgumentException(DbContextStrings.PropertyOfType_IsNot_OneToManyOrManyToMany(_table.Type.FullName, propertyName)); + throw new ArgumentException(DbContextErrorStrings.PropertyOfType_IsNot_OneToManyOrManyToMany(_table.Type.FullName, propertyName)); } DbContextFlushCommand(); diff --git a/FreeSql.DbContext/EfCoreFluentApi/EfCoreTableFluent.cs b/FreeSql.DbContext/EfCoreFluentApi/EfCoreTableFluent.cs index 27ffbe880..c0072718a 100644 --- a/FreeSql.DbContext/EfCoreFluentApi/EfCoreTableFluent.cs +++ b/FreeSql.DbContext/EfCoreFluentApi/EfCoreTableFluent.cs @@ -42,7 +42,7 @@ public EfCoreTableFluent ToView(string name) #region HasKey public EfCoreTableFluent HasKey(string key) { - if (key == null) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("key")); + if (key == null) throw new ArgumentException(DbContextErrorStrings.ParameterError_CannotBeNull("key")); foreach (string name in key.Split(',')) { if (string.IsNullOrEmpty(name.Trim())) continue; @@ -55,7 +55,7 @@ public EfCoreTableFluent HasKey(string key) #region HasIndex public HasIndexFluent HasIndex(string index) { - if (index == null) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("index")); + if (index == null) throw new ArgumentException(DbContextErrorStrings.ParameterError_CannotBeNull("index")); var indexName = $"idx_{Guid.NewGuid().ToString("N").Substring(0, 8)}"; var columns = new List(); foreach (string name in index.Split(',')) @@ -98,8 +98,8 @@ public HasIndexFluent HasName(string name) #region HasOne public HasOneFluent HasOne(string one) { - if (string.IsNullOrEmpty(one)) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("one")); - if (_entityType.GetPropertiesDictIgnoreCase().TryGetValue(one, out var oneProperty) == false) throw new ArgumentException(DbContextStrings.ParameterError_NotFound_Property(one)); + if (string.IsNullOrEmpty(one)) throw new ArgumentException(DbContextErrorStrings.ParameterError_CannotBeNull("one")); + if (_entityType.GetPropertiesDictIgnoreCase().TryGetValue(one, out var oneProperty) == false) throw new ArgumentException(DbContextErrorStrings.ParameterError_NotFound_Property(one)); return new HasOneFluent(_fsql, _tf, _entityType, oneProperty.PropertyType, one); } public class HasOneFluent @@ -124,8 +124,8 @@ internal HasOneFluent(IFreeSql fsql, TableFluent modelBuilder, Type entityType1, } public HasOneFluent WithMany(string many) { - if (many == null) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("many")); - if (_entityType2.GetPropertiesDictIgnoreCase().TryGetValue(many, out var manyProperty) == false) throw new ArgumentException(DbContextStrings.ParameterError_NotFound_Property(many)); + if (many == null) throw new ArgumentException(DbContextErrorStrings.ParameterError_CannotBeNull("many")); + if (_entityType2.GetPropertiesDictIgnoreCase().TryGetValue(many, out var manyProperty) == false) throw new ArgumentException(DbContextErrorStrings.ParameterError_NotFound_Property(many)); _withManyProperty = manyProperty.Name; if (string.IsNullOrEmpty(_selfBind) == false) _fsql.CodeFirst.ConfigEntity(_entityType2, eb2 => eb2.Navigate(many, _selfBind)); @@ -133,18 +133,18 @@ public HasOneFluent WithMany(string many) } public HasOneFluent WithOne(string one, string foreignKey) { - if (string.IsNullOrEmpty(one)) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("one")); - if (_entityType1.GetPropertiesDictIgnoreCase().TryGetValue(one, out var oneProperty) == false) throw new ArgumentException(DbContextStrings.ParameterError_NotFound_Property(one)); - if (oneProperty != _entityType1) throw new ArgumentException(DbContextStrings.ParameterError_NotFound_Property(one)); + if (string.IsNullOrEmpty(one)) throw new ArgumentException(DbContextErrorStrings.ParameterError_CannotBeNull("one")); + if (_entityType1.GetPropertiesDictIgnoreCase().TryGetValue(one, out var oneProperty) == false) throw new ArgumentException(DbContextErrorStrings.ParameterError_NotFound_Property(one)); + if (oneProperty != _entityType1) throw new ArgumentException(DbContextErrorStrings.ParameterError_NotFound_Property(one)); _withOneProperty = oneProperty.Name; - if (foreignKey == null) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("foreignKey")); + if (foreignKey == null) throw new ArgumentException(DbContextErrorStrings.ParameterError_CannotBeNull("foreignKey")); foreach (string name in foreignKey.Split(',')) { if (string.IsNullOrEmpty(name.Trim())) continue; _withOneBind += ", " + name.Trim(); } - if (string.IsNullOrEmpty(_withOneBind)) throw new ArgumentException(DbContextStrings.ParameterError("foreignKey")); + if (string.IsNullOrEmpty(_withOneBind)) throw new ArgumentException(DbContextErrorStrings.ParameterError("foreignKey")); _withOneBind = _withOneBind.TrimStart(',', ' '); if (string.IsNullOrEmpty(_selfBind) == false) _fsql.CodeFirst.ConfigEntity(_entityType2, eb2 => eb2.Navigate(_withOneProperty, _withOneBind)); @@ -152,13 +152,13 @@ public HasOneFluent WithOne(string one, string foreignKey) } public HasOneFluent HasForeignKey(string foreignKey) { - if (foreignKey == null) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("foreignKey")); + if (foreignKey == null) throw new ArgumentException(DbContextErrorStrings.ParameterError_CannotBeNull("foreignKey")); foreach (string name in foreignKey.Split(',')) { if (string.IsNullOrEmpty(name.Trim())) continue; _selfBind += ", " + name.Trim(); } - if (string.IsNullOrEmpty(_selfBind)) throw new ArgumentException(DbContextStrings.ParameterError("foreignKey")); + if (string.IsNullOrEmpty(_selfBind)) throw new ArgumentException(DbContextErrorStrings.ParameterError("foreignKey")); _selfBind = _selfBind.TrimStart(',', ' '); _tf.Navigate(_selfProperty, _selfBind); if (string.IsNullOrEmpty(_withManyProperty) == false) @@ -173,9 +173,9 @@ public HasOneFluent HasForeignKey(string foreignKey) #region HasMany public HasManyFluent HasMany(string many) { - if (string.IsNullOrEmpty(many)) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("many")); - if (_entityType.GetPropertiesDictIgnoreCase().TryGetValue(many, out var manyProperty) == false) throw new ArgumentException(DbContextStrings.ParameterError_NotFound_CollectionProperties(many)); - if (typeof(IEnumerable).IsAssignableFrom(manyProperty.PropertyType) == false || manyProperty.PropertyType.IsGenericType == false) throw new ArgumentException(DbContextStrings.ParameterError_IsNot_CollectionProperties(many)); + if (string.IsNullOrEmpty(many)) throw new ArgumentException(DbContextErrorStrings.ParameterError_CannotBeNull("many")); + if (_entityType.GetPropertiesDictIgnoreCase().TryGetValue(many, out var manyProperty) == false) throw new ArgumentException(DbContextErrorStrings.ParameterError_NotFound_CollectionProperties(many)); + if (typeof(IEnumerable).IsAssignableFrom(manyProperty.PropertyType) == false || manyProperty.PropertyType.IsGenericType == false) throw new ArgumentException(DbContextErrorStrings.ParameterError_IsNot_CollectionProperties(many)); return new HasManyFluent(_fsql, _tf, _entityType, manyProperty.PropertyType.GetGenericArguments()[0], manyProperty.Name); } public class HasManyFluent @@ -200,18 +200,18 @@ internal HasManyFluent(IFreeSql fsql, TableFluent modelBuilder, Type entityType1 public void WithMany(string many, Type middleType) { - if (string.IsNullOrEmpty(many)) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("many")); - if (_entityType2.GetPropertiesDictIgnoreCase().TryGetValue(many, out var manyProperty) == false) throw new ArgumentException(DbContextStrings.ParameterError_NotFound_CollectionProperties(many)); - if (typeof(IEnumerable).IsAssignableFrom(manyProperty.PropertyType) == false || manyProperty.PropertyType.IsGenericType == false) throw new ArgumentException(DbContextStrings.ParameterError_IsNot_CollectionProperties(many)); + if (string.IsNullOrEmpty(many)) throw new ArgumentException(DbContextErrorStrings.ParameterError_CannotBeNull("many")); + if (_entityType2.GetPropertiesDictIgnoreCase().TryGetValue(many, out var manyProperty) == false) throw new ArgumentException(DbContextErrorStrings.ParameterError_NotFound_CollectionProperties(many)); + if (typeof(IEnumerable).IsAssignableFrom(manyProperty.PropertyType) == false || manyProperty.PropertyType.IsGenericType == false) throw new ArgumentException(DbContextErrorStrings.ParameterError_IsNot_CollectionProperties(many)); _withManyProperty = manyProperty.Name; _tf.Navigate(_selfProperty, null, middleType); _fsql.CodeFirst.ConfigEntity(_entityType2, eb2 => eb2.Navigate(_withManyProperty, null, middleType)); } public HasManyFluent WithOne(string one) { - if (string.IsNullOrEmpty(one)) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("one")); - if (_entityType2.GetPropertiesDictIgnoreCase().TryGetValue(one, out var oneProperty) == false) throw new ArgumentException(DbContextStrings.ParameterError_NotFound_Property(one)); - if (oneProperty.PropertyType != _entityType1) throw new ArgumentException(DbContextStrings.ParameterError_NotFound_Property(one)); + if (string.IsNullOrEmpty(one)) throw new ArgumentException(DbContextErrorStrings.ParameterError_CannotBeNull("one")); + if (_entityType2.GetPropertiesDictIgnoreCase().TryGetValue(one, out var oneProperty) == false) throw new ArgumentException(DbContextErrorStrings.ParameterError_NotFound_Property(one)); + if (oneProperty.PropertyType != _entityType1) throw new ArgumentException(DbContextErrorStrings.ParameterError_NotFound_Property(one)); _withOneProperty = oneProperty.Name; if (string.IsNullOrEmpty(_selfBind) == false) _fsql.CodeFirst.ConfigEntity(_entityType2, eb2 => eb2.Navigate(oneProperty.Name, _selfBind)); @@ -219,13 +219,13 @@ public HasManyFluent WithOne(string one) } public HasManyFluent HasForeignKey(string foreignKey) { - if (foreignKey == null) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("foreignKey")); + if (foreignKey == null) throw new ArgumentException(DbContextErrorStrings.ParameterError_CannotBeNull("foreignKey")); foreach (string name in foreignKey.Split(',')) { if (string.IsNullOrEmpty(name.Trim())) continue; _selfBind += ", " + name.Trim(); } - if (string.IsNullOrEmpty(_selfBind)) throw new ArgumentException(DbContextStrings.ParameterError("foreignKey")); + if (string.IsNullOrEmpty(_selfBind)) throw new ArgumentException(DbContextErrorStrings.ParameterError("foreignKey")); _selfBind = _selfBind.TrimStart(',', ' '); _tf.Navigate(_selfProperty, _selfBind); if (string.IsNullOrEmpty(_withOneProperty) == false) diff --git a/FreeSql.DbContext/EfCoreFluentApi/EfCoreTableFluent`1.cs b/FreeSql.DbContext/EfCoreFluentApi/EfCoreTableFluent`1.cs index e142bd75a..1d8c97d10 100644 --- a/FreeSql.DbContext/EfCoreFluentApi/EfCoreTableFluent`1.cs +++ b/FreeSql.DbContext/EfCoreFluentApi/EfCoreTableFluent`1.cs @@ -42,7 +42,7 @@ public EfCoreTableFluent HasKey(Expression> key) { var exp = key?.Body; if (exp?.NodeType == ExpressionType.Convert) exp = (exp as UnaryExpression)?.Operand; - if (exp == null) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("key")); + if (exp == null) throw new ArgumentException(DbContextErrorStrings.ParameterError_CannotBeNull("key")); switch (exp.NodeType) { @@ -63,7 +63,7 @@ public HasIndexFluent HasIndex(Expression> index) { var exp = index?.Body; if (exp?.NodeType == ExpressionType.Convert) exp = (exp as UnaryExpression)?.Operand; - if (exp == null) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("index")); + if (exp == null) throw new ArgumentException(DbContextErrorStrings.ParameterError_CannotBeNull("index")); var indexName = $"idx_{Guid.NewGuid().ToString("N").Substring(0, 8)}"; var columns = new List(); @@ -114,7 +114,7 @@ public HasOneFluent HasOne(Expression> one) { var exp = one?.Body; if (exp?.NodeType == ExpressionType.Convert) exp = (exp as UnaryExpression)?.Operand; - if (exp == null) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("one")); + if (exp == null) throw new ArgumentException(DbContextErrorStrings.ParameterError_CannotBeNull("one")); var oneProperty = ""; switch (exp.NodeType) @@ -123,7 +123,7 @@ public HasOneFluent HasOne(Expression> one) oneProperty = (exp as MemberExpression).Member.Name; break; } - if (string.IsNullOrEmpty(oneProperty)) throw new ArgumentException(DbContextStrings.ParameterError("one")); + if (string.IsNullOrEmpty(oneProperty)) throw new ArgumentException(DbContextErrorStrings.ParameterError("one")); return new HasOneFluent(_fsql, _tf, oneProperty); } public class HasOneFluent @@ -146,7 +146,7 @@ public HasOneFluent WithMany(Expression> many) { var exp = many?.Body; if (exp?.NodeType == ExpressionType.Convert) exp = (exp as UnaryExpression)?.Operand; - if (exp == null) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("many")); + if (exp == null) throw new ArgumentException(DbContextErrorStrings.ParameterError_CannotBeNull("many")); switch (exp.NodeType) { @@ -154,7 +154,7 @@ public HasOneFluent WithMany(Expression> many) _withManyProperty = (exp as MemberExpression).Member.Name; break; } - if (string.IsNullOrEmpty(_withManyProperty)) throw new ArgumentException(DbContextStrings.ParameterError("many")); + if (string.IsNullOrEmpty(_withManyProperty)) throw new ArgumentException(DbContextErrorStrings.ParameterError("many")); if (string.IsNullOrEmpty(_selfBind) == false) _fsql.CodeFirst.ConfigEntity(eb2 => eb2.Navigate(_withManyProperty, _selfBind)); return this; @@ -163,7 +163,7 @@ public HasOneFluent WithOne(Expression> one, Expression WithOne(Expression> one, Expression WithOne(Expression> one, Expression(eb2 => eb2.Navigate(_withOneProperty, _withOneBind)); return this; @@ -199,7 +199,7 @@ public HasOneFluent HasForeignKey(Expression> foreignKey) { var exp = foreignKey?.Body; if (exp?.NodeType == ExpressionType.Convert) exp = (exp as UnaryExpression)?.Operand; - if (exp == null) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("foreignKey")); + if (exp == null) throw new ArgumentException(DbContextErrorStrings.ParameterError_CannotBeNull("foreignKey")); switch (exp.NodeType) { @@ -214,7 +214,7 @@ public HasOneFluent HasForeignKey(Expression> foreignKey) _selfBind = _selfBind.TrimStart(',', ' '); break; } - if (string.IsNullOrEmpty(_selfBind)) throw new ArgumentException(DbContextStrings.ParameterError("foreignKey")); + if (string.IsNullOrEmpty(_selfBind)) throw new ArgumentException(DbContextErrorStrings.ParameterError("foreignKey")); _tf.Navigate(_selfProperty, _selfBind); if (string.IsNullOrEmpty(_withManyProperty) == false) _fsql.CodeFirst.ConfigEntity(eb2 => eb2.Navigate(_withManyProperty, _selfBind)); @@ -230,7 +230,7 @@ public HasManyFluent HasMany(Expression>> many) { var exp = many?.Body; if (exp?.NodeType == ExpressionType.Convert) exp = (exp as UnaryExpression)?.Operand; - if (exp == null) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("many")); + if (exp == null) throw new ArgumentException(DbContextErrorStrings.ParameterError_CannotBeNull("many")); var manyProperty = ""; switch (exp.NodeType) @@ -239,7 +239,7 @@ public HasManyFluent HasMany(Expression>> many) manyProperty = (exp as MemberExpression).Member.Name; break; } - if (string.IsNullOrEmpty(manyProperty)) throw new ArgumentException(DbContextStrings.ParameterError("many")); + if (string.IsNullOrEmpty(manyProperty)) throw new ArgumentException(DbContextErrorStrings.ParameterError("many")); return new HasManyFluent(_fsql, _tf, manyProperty); } public class HasManyFluent @@ -262,7 +262,7 @@ public void WithMany(Expression>> many, Type middleType) { var exp = many?.Body; if (exp?.NodeType == ExpressionType.Convert) exp = (exp as UnaryExpression)?.Operand; - if (exp == null) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("many")); + if (exp == null) throw new ArgumentException(DbContextErrorStrings.ParameterError_CannotBeNull("many")); switch (exp.NodeType) { @@ -270,7 +270,7 @@ public void WithMany(Expression>> many, Type middleType) _withManyProperty = (exp as MemberExpression).Member.Name; break; } - if (string.IsNullOrEmpty(_withManyProperty)) throw new ArgumentException(DbContextStrings.ParameterError("many")); + if (string.IsNullOrEmpty(_withManyProperty)) throw new ArgumentException(DbContextErrorStrings.ParameterError("many")); _tf.Navigate(_selfProperty, null, middleType); _fsql.CodeFirst.ConfigEntity(eb2 => eb2.Navigate(_withManyProperty, null, middleType)); @@ -279,7 +279,7 @@ public HasManyFluent WithOne(Expression> one) { var exp = one?.Body; if (exp?.NodeType == ExpressionType.Convert) exp = (exp as UnaryExpression)?.Operand; - if (exp == null) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("one")); + if (exp == null) throw new ArgumentException(DbContextErrorStrings.ParameterError_CannotBeNull("one")); switch (exp.NodeType) { @@ -287,7 +287,7 @@ public HasManyFluent WithOne(Expression> one) _withOneProperty = (exp as MemberExpression).Member.Name; break; } - if (string.IsNullOrEmpty(_withOneProperty)) throw new ArgumentException(DbContextStrings.ParameterError("one")); + if (string.IsNullOrEmpty(_withOneProperty)) throw new ArgumentException(DbContextErrorStrings.ParameterError("one")); if (string.IsNullOrEmpty(_selfBind) == false) _fsql.CodeFirst.ConfigEntity(eb2 => eb2.Navigate(_withOneProperty, _selfBind)); @@ -297,7 +297,7 @@ public HasManyFluent HasForeignKey(Expression> foreignKey) { var exp = foreignKey?.Body; if (exp?.NodeType == ExpressionType.Convert) exp = (exp as UnaryExpression)?.Operand; - if (exp == null) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("foreignKey")); + if (exp == null) throw new ArgumentException(DbContextErrorStrings.ParameterError_CannotBeNull("foreignKey")); switch (exp.NodeType) { @@ -312,7 +312,7 @@ public HasManyFluent HasForeignKey(Expression> foreignKey) _selfBind = _selfBind.TrimStart(',', ' '); break; } - if (string.IsNullOrEmpty(_selfBind)) throw new ArgumentException(DbContextStrings.ParameterError("foreignKey")); + if (string.IsNullOrEmpty(_selfBind)) throw new ArgumentException(DbContextErrorStrings.ParameterError("foreignKey")); _tf.Navigate(_selfProperty, _selfBind); if (string.IsNullOrEmpty(_withOneProperty) == false) _fsql.CodeFirst.ConfigEntity(eb2 => eb2.Navigate(_withOneProperty, _selfBind)); diff --git a/FreeSql.DbContext/Extensions/DependencyInjection.cs b/FreeSql.DbContext/Extensions/DependencyInjection.cs index 78664f09f..3d5cd5a3d 100644 --- a/FreeSql.DbContext/Extensions/DependencyInjection.cs +++ b/FreeSql.DbContext/Extensions/DependencyInjection.cs @@ -21,7 +21,7 @@ static IServiceCollection AddFreeDbContext(this IServiceCollection services, Typ } catch(Exception ex) { - throw new Exception(DbContextStrings.AddFreeDbContextError_CheckConstruction(dbContextType.Name), ex); + throw new Exception(DbContextErrorStrings.AddFreeDbContextError_CheckConstruction(dbContextType.Name), ex); } if (ctx != null && ctx._ormScoped == null) { @@ -31,7 +31,7 @@ static IServiceCollection AddFreeDbContext(this IServiceCollection services, Typ ctx._optionsPriv = builder._options; if (ctx._ormScoped == null) - throw new Exception(DbContextStrings.ConfigureUseFreeSql); + throw new Exception(DbContextErrorStrings.ConfigureUseFreeSql); ctx.InitPropSets(); } diff --git a/FreeSql.DbContext/FreeSql.DbContext.csproj b/FreeSql.DbContext/FreeSql.DbContext.csproj index 650678f3b..a9e910513 100644 --- a/FreeSql.DbContext/FreeSql.DbContext.csproj +++ b/FreeSql.DbContext/FreeSql.DbContext.csproj @@ -63,26 +63,4 @@ - - - True - True - DbContextStrings.Designer.tt - - - - - - TextTemplatingFileGenerator - DbContextStrings.Designer.cs - - - Designer - FreeSql - - - FreeSql - - - diff --git a/FreeSql.DbContext/FreeSql.DbContext.xml b/FreeSql.DbContext/FreeSql.DbContext.xml index 7bd2291ce..c941a15d9 100644 --- a/FreeSql.DbContext/FreeSql.DbContext.xml +++ b/FreeSql.DbContext/FreeSql.DbContext.xml @@ -83,413 +83,396 @@ 刷新队列中的命令 - - - 是否开启 一对一(OneToOne)、一对多(OneToMany)、多对多(ManyToMany) 级联保存功能 - - 【一对一】模型下,保存时级联保存 OneToOne 属性。 - - 【一对多】模型下,保存时级联保存 OneToMany 集合属性。出于安全考虑我们没做完整对比,只针对实体属性集合的添加或更新操作,因此不会删除数据库表已有的数据。 - 完整对比的功能使用起来太危险,试想下面的场景: - - 保存的时候,实体的属性集合为空时(!=null),表记录全部删除? - - 保存的时候,由于数据库子表的记录很多,只想保存子表的部分数据,又或者只需要添加,如何操作? - - 【多对多】模型下,对中间表的保存是完整对比操作,对外部实体的只作新增操作(*注意不会更新) - - 属性集合为空时(!=null),删除他们的所有关联数据(中间表) - - 属性集合不为空时,与数据库存在的关联数据(中间表)完全对比,计算出应该删除和添加的记录 - - - - - 使用无参数化设置(对应 IInsert/IUpdate) - - - + - 是否开启 IFreeSql GlobalFilter 功能(默认:true) + AddFreeDbContext 发生错误,请检查 {dbContextTypeName} 的构造参数都已正确注入 - + - 实体变化事件 + 不可添加,已存在于状态管理:{entityString} - + - DbContext/Repository 审计值,适合 Scoped IOC 中获取登陆信息 + 不可添加,实体没有主键:{entityString} - + - 类型 + 不可添加,未设置主键的值:{entityString} - + - 类型 + 不可添加,自增属性有值:{entityString} - + - 实体对象 + 不可附加,实体没有主键:{entityString} - + - 动态Type,在使用 DbSet<object> 后使用本方法,指定实体类型 + 不可附加,未设置主键的值:{entityString} - - - + - 附加实体,可用于不查询就更新或删除 + 不可删除,数据未被跟踪,应该先查询:{entityString} - - + - 附加实体,并且只附加主键值,可用于不更新属性值为null或默认值的字段 + 不可删除,实体没有主键:{entityString} - - + - 比较实体,计算出值发生变化的属性,以及属性变化的前后值 + 不可删除,未设置主键的值:{entityString} - 最新的实体对象,它将与附加实体的状态对比 - key: 属性名, value: [旧值, 新值] - + - 清空状态数据 + 不可进行编辑,实体没有主键:{entityString} - + - 添加 + 不可更新,数据未被跟踪,应该先查询 或者 Attach:{entityString} - - + - 更新 + 不可更新,实体没有主键:{entityString} - - + - 删除 + 不可更新,未设置主键的值:{entityString} - - + - 根据 lambda 条件删除数据 + 不可更新,数据库不存在该记录:{entityString} - - - + - 添加或更新 + 请在 OnConfiguring 或 AddFreeDbContext 中配置 UseFreeSql - - + - 开始编辑数据,然后调用方法 EndEdit 分析出添加、修改、删除 SQL 语句进行执行 - 场景:winform 加载表数据后,一顿添加、修改、删除操作之后,最后才点击【保存】 - 示例:https://github.com/dotnetcore/FreeSql/issues/397 - 注意:* 本方法只支持单表操作,不支持导航属性级联保存 + DbSet.AsType 参数错误,请传入正确的实体类型 - - + - 完成编辑数据,进行保存动作 - 该方法根据 BeginEdit 传入的数据状态分析出添加、修改、删除 SQL 语句 - 注意:* 本方法只支持单表操作,不支持导航属性级联保存 + 实体类型 {EntityTypeName} 无法转换为 {name},无法使用该方法 - 可选参数:手工传递最终的 data 值进行对比默认:如果不传递,则使用 BeginEdit 传入的 data 引用进行对比 - - + - 根据设置的 OneToOne/OneToMany/ManyToMany 导航属性,级联查询所有的数据库记录,删除并返回它们 + 实体类型 {EntityTypeName} 主键类型不为 {fullName},无法使用该方法 - - - + - 保存实体的指定 ManyToMany/OneToMany 导航属性(完整对比) - 场景:在关闭级联保存功能之后,手工使用本方法 - 例子:保存商品的 OneToMany 集合属性,SaveMany(goods, "Skus") - 当 goods.Skus 为空(非null)时,会删除表中已存在的所有数据 - 当 goods.Skus 不为空(非null)时,添加/更新后,删除表中不存在 Skus 集合属性的所有记录 + 实体类型 {EntityTypeName} 主键数量不为 1,无法使用该方法 - 实体对象 - 属性名 - + - 使用 FreeSql FluentApi 方法,当 EFCore FluentApi 方法无法表示的时候使用 + FreeSql.Repository 设置过滤器失败,原因是对象不属于 IRepository - - + - 使用 FreeSql FluentApi 方法,当 EFCore FluentApi 方法无法表示的时候使用 + 不可比较,实体没有主键:{entityString} - - + - 使用 Repository + EnableCascadeSave + NoneParameter 方式插入种子数据 + 不可比较,未设置主键的值:{entityString} - - - + - 使用 FreeSql FluentApi 方法,当 EFCore FluentApi 方法无法表示的时候使用 + FreeSql.Repository Insert 失败,因为设置了过滤器 {filterKey}: {filterValueExpression},插入的数据不符合 {entityString} - - + - 使用 Repository + EnableCascadeSave + NoneParameter 方式插入种子数据 + ISelect.AsType 参数不支持指定为 object - - - + - - String resources used in FreeSql exceptions, etc. - - - These strings are exposed publicly for use by database providers and extensions. - It is unusual for application code to need these strings. - + {tableTypeFullName} 不存在属性 {propertyName} - + - 重写当前线程的 CurrentUICulture 属性,对 - 使用此强类型资源类的所有资源查找执行重写。 + 找不到方法 DbSet&lt;&gt;.StatesRemoveByObjects - + - AddFreeDbContext 发生错误,请检查 {dbContextTypeName} 的构造参数都已正确注入 + 参数 data 类型错误 {entityTypeFullName} - + - 不可添加,已存在于状态管理:{entityString} + 参数错误 {param} - + - 不可添加,实体没有主键:{entityString} + 参数错误 {param} 不能为 null - + - 不可添加,未设置主键的值:{entityString} + 参数错误 {many} 不是集合属性 - + - 不可添加,自增属性有值:{entityString} + 参数错误 {many} 集合属性不存在 - + - 不可附加,实体没有主键:{entityString} + 参数错误 {one} 属性不存在 - + - 不可附加,未设置主键的值:{entityString} + Propagation_Mandatory: 使用当前事务,如果没有当前事务,就抛出异常 - + - 不可删除,数据未被跟踪,应该先查询:{entityString} + Propagation_Never: 以非事务方式执行操作,如果当前事务存在则抛出异常 - + - 不可删除,实体没有主键:{entityString} + {tableTypeFullName} 类型的属性 {propertyName} 不是 OneToMany 或 ManyToMany 特性 - + - 不可删除,未设置主键的值:{entityString} + 特别错误:批量添加失败,{dataType} 的返回数据,与添加的数目不匹配 - + - 不可进行编辑,实体没有主键:{entityString} + 特别错误:更新失败,数据未被跟踪:{entityString} - + - 不可更新,数据未被跟踪,应该先查询 或者 Attach:{entityString} + 已开启事务,不能禁用工作单元 - + - 不可更新,实体没有主键:{entityString} + {tableTypeFullName} 类型已设置属性 {propertyName} 忽略特性 - + - 不可更新,未设置主键的值:{entityString} + {unitOfWorkManager} 构造参数 {fsql} 不能为 null - + - 不可更新,数据库不存在该记录:{entityString} + FreeSql.Repository Update 失败,因为设置了过滤器 {filterKey}: {filterValueExpression},更新的数据不符合{entityString} - + - 请在 OnConfiguring 或 AddFreeDbContext 中配置 UseFreeSql + 是否开启 一对一(OneToOne)、一对多(OneToMany)、多对多(ManyToMany) 级联保存功能 + + 【一对一】模型下,保存时级联保存 OneToOne 属性。 + + 【一对多】模型下,保存时级联保存 OneToMany 集合属性。出于安全考虑我们没做完整对比,只针对实体属性集合的添加或更新操作,因此不会删除数据库表已有的数据。 + 完整对比的功能使用起来太危险,试想下面的场景: + - 保存的时候,实体的属性集合为空时(!=null),表记录全部删除? + - 保存的时候,由于数据库子表的记录很多,只想保存子表的部分数据,又或者只需要添加,如何操作? + + 【多对多】模型下,对中间表的保存是完整对比操作,对外部实体的只作新增操作(*注意不会更新) + - 属性集合为空时(!=null),删除他们的所有关联数据(中间表) + - 属性集合不为空时,与数据库存在的关联数据(中间表)完全对比,计算出应该删除和添加的记录 - + - DbSet.AsType 参数错误,请传入正确的实体类型 + 使用无参数化设置(对应 IInsert/IUpdate) - + - 实体类型 {EntityTypeName} 无法转换为 {name},无法使用该方法 + 是否开启 IFreeSql GlobalFilter 功能(默认:true) - + - 实体类型 {EntityTypeName} 主键类型不为 {fullName},无法使用该方法 + 实体变化事件 - + - 实体类型 {EntityTypeName} 主键数量不为 1,无法使用该方法 + DbContext/Repository 审计值,适合 Scoped IOC 中获取登陆信息 - + - FreeSql.Repository 设置过滤器失败,原因是对象不属于 IRepository + 类型 - + - 不可比较,实体没有主键:{entityString} + 类型 - + - 不可比较,未设置主键的值:{entityString} + 实体对象 - + - FreeSql.Repository Insert 失败,因为设置了过滤器 {filterKey}: {filterValueExpression},插入的数据不符合 {entityString} + 动态Type,在使用 DbSet<object> 后使用本方法,指定实体类型 + + - + - ISelect.AsType 参数不支持指定为 object + 附加实体,可用于不查询就更新或删除 + - + - {tableTypeFullName} 不存在属性 {propertyName} + 附加实体,并且只附加主键值,可用于不更新属性值为null或默认值的字段 + - + - 找不到方法 DbSet<>.StatesRemoveByObjects + 比较实体,计算出值发生变化的属性,以及属性变化的前后值 + 最新的实体对象,它将与附加实体的状态对比 + key: 属性名, value: [旧值, 新值] - + - 参数 data 类型错误 {entityTypeFullName} + 清空状态数据 - + - 参数错误 {param} + 添加 + - + - 参数错误 {param} 不能为 null + 更新 + - + - 参数错误 {many} 不是集合属性 + 删除 + - + - 参数错误 {many} 集合属性不存在 + 根据 lambda 条件删除数据 + + - + - 参数错误 {one} 属性不存在 + 添加或更新 + - + - Propagation_Mandatory: 使用当前事务,如果没有当前事务,就抛出异常 + 开始编辑数据,然后调用方法 EndEdit 分析出添加、修改、删除 SQL 语句进行执行 + 场景:winform 加载表数据后,一顿添加、修改、删除操作之后,最后才点击【保存】 + 示例:https://github.com/dotnetcore/FreeSql/issues/397 + 注意:* 本方法只支持单表操作,不支持导航属性级联保存 + - + - Propagation_Never: 以非事务方式执行操作,如果当前事务存在则抛出异常 + 完成编辑数据,进行保存动作 + 该方法根据 BeginEdit 传入的数据状态分析出添加、修改、删除 SQL 语句 + 注意:* 本方法只支持单表操作,不支持导航属性级联保存 + 可选参数:手工传递最终的 data 值进行对比默认:如果不传递,则使用 BeginEdit 传入的 data 引用进行对比 + - + - {tableTypeFullName} 类型的属性 {propertyName} 不是 OneToMany 或 ManyToMany 特性 + 根据设置的 OneToOne/OneToMany/ManyToMany 导航属性,级联查询所有的数据库记录,删除并返回它们 + + - + - 特别错误:批量添加失败,{dataType} 的返回数据,与添加的数目不匹配 + 保存实体的指定 ManyToMany/OneToMany 导航属性(完整对比) + 场景:在关闭级联保存功能之后,手工使用本方法 + 例子:保存商品的 OneToMany 集合属性,SaveMany(goods, "Skus") + 当 goods.Skus 为空(非null)时,会删除表中已存在的所有数据 + 当 goods.Skus 不为空(非null)时,添加/更新后,删除表中不存在 Skus 集合属性的所有记录 + 实体对象 + 属性名 - + - 特别错误:更新失败,数据未被跟踪:{entityString} + 使用 FreeSql FluentApi 方法,当 EFCore FluentApi 方法无法表示的时候使用 + - + - 已开启事务,不能禁用工作单元 + 使用 FreeSql FluentApi 方法,当 EFCore FluentApi 方法无法表示的时候使用 + - + - {tableTypeFullName} 类型已设置属性 {propertyName} 忽略特性 + 使用 Repository + EnableCascadeSave + NoneParameter 方式插入种子数据 + + - + - {unitOfWorkManager} 构造参数 {fsql} 不能为 null + 使用 FreeSql FluentApi 方法,当 EFCore FluentApi 方法无法表示的时候使用 + - + - FreeSql.Repository Update 失败,因为设置了过滤器 {filterKey}: {filterValueExpression},更新的数据不符合{entityString} + 使用 Repository + EnableCascadeSave + NoneParameter 方式插入种子数据 + + diff --git a/FreeSql.DbContext/Properties/DbContextStrings.Designer.cs b/FreeSql.DbContext/Properties/DbContextStrings.Designer.cs deleted file mode 100644 index ff2b54c48..000000000 --- a/FreeSql.DbContext/Properties/DbContextStrings.Designer.cs +++ /dev/null @@ -1,375 +0,0 @@ - -// - -using System; -using System.Reflection; -using System.Resources; -using System.Globalization; -using System.Threading; - -namespace FreeSql -{ - /// - /// - /// String resources used in FreeSql exceptions, etc. - /// - /// - /// These strings are exposed publicly for use by database providers and extensions. - /// It is unusual for application code to need these strings. - /// - /// - public static class DbContextStrings - { - private static readonly ResourceManager _resourceManager = new ResourceManager("FreeSql.DbContext.Properties.DbContextStrings", typeof(DbContextStrings).Assembly); - - private static CultureInfo _resourceCulture; - - /// - /// 重写当前线程的 CurrentUICulture 属性,对 - /// 使用此强类型资源类的所有资源查找执行重写。 - /// - public static CultureInfo Culture - { - get - { - return _resourceCulture; - } - set - { - _resourceCulture = value; - } - } - - /// - /// AddFreeDbContext 发生错误,请检查 {dbContextTypeName} 的构造参数都已正确注入 - /// - public static string AddFreeDbContextError_CheckConstruction(object dbContextTypeName) - => string.Format( - GetString("AddFreeDbContextError_CheckConstruction", nameof(dbContextTypeName)), - dbContextTypeName); - - /// - /// 不可添加,已存在于状态管理:{entityString} - /// - public static string CannotAdd_AlreadyExistsInStateManagement(object entityString) - => string.Format( - GetString("CannotAdd_AlreadyExistsInStateManagement", nameof(entityString)), - entityString); - - /// - /// 不可添加,实体没有主键:{entityString} - /// - public static string CannotAdd_EntityHasNo_PrimaryKey(object entityString) - => string.Format( - GetString("CannotAdd_EntityHasNo_PrimaryKey", nameof(entityString)), - entityString); - - /// - /// 不可添加,未设置主键的值:{entityString} - /// - public static string CannotAdd_PrimaryKey_NotSet(object entityString) - => string.Format( - GetString("CannotAdd_PrimaryKey_NotSet", nameof(entityString)), - entityString); - - /// - /// 不可添加,自增属性有值:{entityString} - /// - public static string CannotAdd_SelfIncreasingHasValue(object entityString) - => string.Format( - GetString("CannotAdd_SelfIncreasingHasValue", nameof(entityString)), - entityString); - - /// - /// 不可附加,实体没有主键:{entityString} - /// - public static string CannotAttach_EntityHasNo_PrimaryKey(object entityString) - => string.Format( - GetString("CannotAttach_EntityHasNo_PrimaryKey", nameof(entityString)), - entityString); - - /// - /// 不可附加,未设置主键的值:{entityString} - /// - public static string CannotAttach_PrimaryKey_NotSet(object entityString) - => string.Format( - GetString("CannotAttach_PrimaryKey_NotSet", nameof(entityString)), - entityString); - - /// - /// 不可删除,数据未被跟踪,应该先查询:{entityString} - /// - public static string CannotDelete_DataNotTracked_ShouldQuery(object entityString) - => string.Format( - GetString("CannotDelete_DataNotTracked_ShouldQuery", nameof(entityString)), - entityString); - - /// - /// 不可删除,实体没有主键:{entityString} - /// - public static string CannotDelete_EntityHasNo_PrimaryKey(object entityString) - => string.Format( - GetString("CannotDelete_EntityHasNo_PrimaryKey", nameof(entityString)), - entityString); - - /// - /// 不可删除,未设置主键的值:{entityString} - /// - public static string CannotDelete_PrimaryKey_NotSet(object entityString) - => string.Format( - GetString("CannotDelete_PrimaryKey_NotSet", nameof(entityString)), - entityString); - - /// - /// 不可进行编辑,实体没有主键:{entityString} - /// - public static string CannotEdit_EntityHasNo_PrimaryKey(object entityString) - => string.Format( - GetString("CannotEdit_EntityHasNo_PrimaryKey", nameof(entityString)), - entityString); - - /// - /// 不可更新,数据未被跟踪,应该先查询 或者 Attach:{entityString} - /// - public static string CannotUpdate_DataShouldQueryOrAttach(object entityString) - => string.Format( - GetString("CannotUpdate_DataShouldQueryOrAttach", nameof(entityString)), - entityString); - - /// - /// 不可更新,实体没有主键:{entityString} - /// - public static string CannotUpdate_EntityHasNo_PrimaryKey(object entityString) - => string.Format( - GetString("CannotUpdate_EntityHasNo_PrimaryKey", nameof(entityString)), - entityString); - - /// - /// 不可更新,未设置主键的值:{entityString} - /// - public static string CannotUpdate_PrimaryKey_NotSet(object entityString) - => string.Format( - GetString("CannotUpdate_PrimaryKey_NotSet", nameof(entityString)), - entityString); - - /// - /// 不可更新,数据库不存在该记录:{entityString} - /// - public static string CannotUpdate_RecordDoesNotExist(object entityString) - => string.Format( - GetString("CannotUpdate_RecordDoesNotExist", nameof(entityString)), - entityString); - - /// - /// 请在 OnConfiguring 或 AddFreeDbContext 中配置 UseFreeSql - /// - public static string ConfigureUseFreeSql - => GetString("ConfigureUseFreeSql"); - - /// - /// DbSet.AsType 参数错误,请传入正确的实体类型 - /// - public static string DbSetAsType_NotSupport_Object - => GetString("DbSetAsType_NotSupport_Object"); - - /// - /// 实体类型 {EntityTypeName} 无法转换为 {name},无法使用该方法 - /// - public static string EntityType_CannotConvert(object EntityTypeName, object name) - => string.Format( - GetString("EntityType_CannotConvert", nameof(EntityTypeName), nameof(name)), - EntityTypeName, name); - - /// - /// 实体类型 {EntityTypeName} 主键类型不为 {fullName},无法使用该方法 - /// - public static string EntityType_PrimaryKeyError(object EntityTypeName, object fullName) - => string.Format( - GetString("EntityType_PrimaryKeyError", nameof(EntityTypeName), nameof(fullName)), - EntityTypeName, fullName); - - /// - /// 实体类型 {EntityTypeName} 主键数量不为 1,无法使用该方法 - /// - public static string EntityType_PrimaryKeyIsNotOne(object EntityTypeName) - => string.Format( - GetString("EntityType_PrimaryKeyIsNotOne", nameof(EntityTypeName)), - EntityTypeName); - - /// - /// FreeSql.Repository 设置过滤器失败,原因是对象不属于 IRepository - /// - public static string FailedSetFilter_NotBelongIRpository - => GetString("FailedSetFilter_NotBelongIRpository"); - - /// - /// 不可比较,实体没有主键:{entityString} - /// - public static string Incomparable_EntityHasNo_PrimaryKey(object entityString) - => string.Format( - GetString("Incomparable_EntityHasNo_PrimaryKey", nameof(entityString)), - entityString); - - /// - /// 不可比较,未设置主键的值:{entityString} - /// - public static string Incomparable_PrimaryKey_NotSet(object entityString) - => string.Format( - GetString("Incomparable_PrimaryKey_NotSet", nameof(entityString)), - entityString); - - /// - /// FreeSql.Repository Insert 失败,因为设置了过滤器 {filterKey}: {filterValueExpression},插入的数据不符合 {entityString} - /// - public static string InsertError_Filter(object filterKey, object filterValueExpression, object entityString) - => string.Format( - GetString("InsertError_Filter", nameof(filterKey), nameof(filterValueExpression), nameof(entityString)), - filterKey, filterValueExpression, entityString); - - /// - /// ISelect.AsType 参数不支持指定为 object - /// - public static string ISelectAsType_ParameterError - => GetString("ISelectAsType_ParameterError"); - - /// - /// {tableTypeFullName} 不存在属性 {propertyName} - /// - public static string NotFound_Property(object tableTypeFullName, object propertyName) - => string.Format( - GetString("NotFound_Property", nameof(tableTypeFullName), nameof(propertyName)), - tableTypeFullName, propertyName); - - /// - /// 找不到方法 DbSet<>.StatesRemoveByObjects - /// - public static string NotFoundMethod_StatesRemoveByObjects - => GetString("NotFoundMethod_StatesRemoveByObjects"); - - /// - /// 参数 data 类型错误 {entityTypeFullName} - /// - public static string ParameterDataTypeError(object entityTypeFullName) - => string.Format( - GetString("ParameterDataTypeError", nameof(entityTypeFullName)), - entityTypeFullName); - - /// - /// 参数错误 {param} - /// - public static string ParameterError(object param) - => string.Format( - GetString("ParameterError", nameof(param)), - param); - - /// - /// 参数错误 {param} 不能为 null - /// - public static string ParameterError_CannotBeNull(object param) - => string.Format( - GetString("ParameterError_CannotBeNull", nameof(param)), - param); - - /// - /// 参数错误 {many} 不是集合属性 - /// - public static string ParameterError_IsNot_CollectionProperties(object many) - => string.Format( - GetString("ParameterError_IsNot_CollectionProperties", nameof(many)), - many); - - /// - /// 参数错误 {many} 集合属性不存在 - /// - public static string ParameterError_NotFound_CollectionProperties(object many) - => string.Format( - GetString("ParameterError_NotFound_CollectionProperties", nameof(many)), - many); - - /// - /// 参数错误 {one} 属性不存在 - /// - public static string ParameterError_NotFound_Property(object one) - => string.Format( - GetString("ParameterError_NotFound_Property", nameof(one)), - one); - - /// - /// Propagation_Mandatory: 使用当前事务,如果没有当前事务,就抛出异常 - /// - public static string Propagation_Mandatory - => GetString("Propagation_Mandatory"); - - /// - /// Propagation_Never: 以非事务方式执行操作,如果当前事务存在则抛出异常 - /// - public static string Propagation_Never - => GetString("Propagation_Never"); - - /// - /// {tableTypeFullName} 类型的属性 {propertyName} 不是 OneToMany 或 ManyToMany 特性 - /// - public static string PropertyOfType_IsNot_OneToManyOrManyToMany(object tableTypeFullName, object propertyName) - => string.Format( - GetString("PropertyOfType_IsNot_OneToManyOrManyToMany", nameof(tableTypeFullName), nameof(propertyName)), - tableTypeFullName, propertyName); - - /// - /// 特别错误:批量添加失败,{dataType} 的返回数据,与添加的数目不匹配 - /// - public static string SpecialError_BatchAdditionFailed(object dataType) - => string.Format( - GetString("SpecialError_BatchAdditionFailed", nameof(dataType)), - dataType); - - /// - /// 特别错误:更新失败,数据未被跟踪:{entityString} - /// - public static string SpecialError_UpdateFailedDataNotTracked(object entityString) - => string.Format( - GetString("SpecialError_UpdateFailedDataNotTracked", nameof(entityString)), - entityString); - - /// - /// 已开启事务,不能禁用工作单元 - /// - public static string TransactionHasBeenStarted - => GetString("TransactionHasBeenStarted"); - - /// - /// {tableTypeFullName} 类型已设置属性 {propertyName} 忽略特性 - /// - public static string TypeHasSetProperty_IgnoreAttribute(object tableTypeFullName, object propertyName) - => string.Format( - GetString("TypeHasSetProperty_IgnoreAttribute", nameof(tableTypeFullName), nameof(propertyName)), - tableTypeFullName, propertyName); - - /// - /// {unitOfWorkManager} 构造参数 {fsql} 不能为 null - /// - public static string UnitOfWorkManager_Construction_CannotBeNull(object unitOfWorkManager, object fsql) - => string.Format( - GetString("UnitOfWorkManager_Construction_CannotBeNull", nameof(unitOfWorkManager), nameof(fsql)), - unitOfWorkManager, fsql); - - /// - /// FreeSql.Repository Update 失败,因为设置了过滤器 {filterKey}: {filterValueExpression},更新的数据不符合{entityString} - /// - public static string UpdateError_Filter(object filterKey, object filterValueExpression, object entityString) - => string.Format( - GetString("UpdateError_Filter", nameof(filterKey), nameof(filterValueExpression), nameof(entityString)), - filterKey, filterValueExpression, entityString); - - private static string GetString(string name, params string[] formatterNames) - { - var value = _resourceManager.GetString(name,_resourceCulture); - for (var i = 0; i < formatterNames.Length; i++) - { - value = value.Replace("{" + formatterNames[i] + "}", "{" + i + "}"); - } - - return value; - } - } -} - diff --git a/FreeSql.DbContext/Properties/DbContextStrings.Designer.tt b/FreeSql.DbContext/Properties/DbContextStrings.Designer.tt deleted file mode 100644 index b8b9d8ad8..000000000 --- a/FreeSql.DbContext/Properties/DbContextStrings.Designer.tt +++ /dev/null @@ -1,5 +0,0 @@ -<# - Session["ResourceFile"] = "DbContextStrings.resx"; - Session["AccessModifier"] = "public"; -#> -<#@ include file="../../FreeSql/Properties/Resources.tt" #> \ No newline at end of file diff --git a/FreeSql.DbContext/Properties/DbContextStrings.resx b/FreeSql.DbContext/Properties/DbContextStrings.resx deleted file mode 100644 index 031a63af4..000000000 --- a/FreeSql.DbContext/Properties/DbContextStrings.resx +++ /dev/null @@ -1,246 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - FreeSql: An error occurred in AddFreeDbContext, check that the construction parameters of {dbContextTypeName} have been injected correctly - - - FreeSql: Not addable, already exists in state management: {entityString} - - - FreeSql: Not addable, entity has no primary key: {entityString} - - - FreeSql: Not addable, no value for primary key set: {entityString} - - - FreeSql: Not addable, self-increasing attribute has value: {entityString} - - - FreeSql: Not attachable, entity has no primary key: {entityString} - - - FreeSql: Not attachable, no value for primary key set: {entityString} - - - FreeSql: Not deletable, data not tracked, should query first: {entityString} - - - FreeSql: Not deletable, entity has no primary key: {entityString} - - - FreeSql: Not deletable, no value for primary key set: {entityString} - - - FreeSql: Not editable, entity has no primary key: {entityString} - - - FreeSql: Not updatable, data not tracked, should be queried first or Attach:{entityString} - - - FreeSql: Not updatable, entity has no primary key: {entityString} - - - FreeSql: Not updatable, no value for primary key set: {entityString} - - - FreeSql: Not updatable, the record does not exist in the database: {entityString} - - - FreeSql: Please configure UseFreeSql in OnConfiguring or AddFreeDbContext - - - FreeSql: DbSet. AsType parameter error, please pass in the correct entity type - - - FreeSql: Entity type {EntityTypeName} cannot be converted to {name} and cannot use this method - - - FreeSql: Entity type {EntityTypeName} Primary key type is not {fullName} and cannot be used with this method - - - FreeSql: Entity type {EntityTypeName} Primary key number is not 1 and cannot be used with this method - - - FreeSql: FreeSql. Repository failed to set filter because object does not belong to IRepository - - - FreeSql: Not comparable, entity has no primary key: {entityString} - - - FreeSql: Non-comparable, no value for primary key set: {entityString} - - - FreeSql: FreeSql.Repository Insert failed because the filter {filterKey}: {filterValueExpression} was set and the inserted data does not conform to {entityString} - - - FreeSql: ISelect. AsType parameter does not support specifying as object - - - FreeSql: Property {propertyName} does not exist for {tableTypeFullName} - - - FreeSql: Method DbSet<> not found. StatesRemoveByObjects - - - FreeSql: Parameter data type error {entityTypeFullName} - - - FreeSql: Parameter error {param} - - - FreeSql: Parameter error {param} cannot be null - - - FreeSql: Parameter error {many} is not a collection property - - - FreeSql: Parameter error {many} Collection property does not exist - - - FreeSql: Parameter error {one} attribute does not exist - - - FreeSql: Propagation_ Mandatory: With the current transaction, throw an exception if there is no current transaction - - - FreeSql: Propagation_ Never: Perform the operation non-transactionally and throw an exception if the current transaction exists - - - FreeSql: Property {propertyName} of type {tableTypeFullName} is not OneToMany or ManyToMany attribute - - - FreeSql: Special error: Bulk add failed, {dataType} returned data, does not match the number added - - - FreeSql: Special error: Update failed, data not tracked: {entityString} - - - FreeSql: Transaction opened, unit of work cannot be disabled - - - FreeSql: The {tableTypeFullName} type has set the property {propertyName} Ignore the attribute - - - FreeSql: The {unitOfWorkManager} constructor parameter {fsql} cannot be null - - - FreeSql: FreeSql.Repository Update failed because the filter {filterKey}: {filterValueExpression} is set and the updated data does not conform to {entityString} - - \ No newline at end of file diff --git a/FreeSql.DbContext/Properties/DbContextStrings.zh-Hans.resx b/FreeSql.DbContext/Properties/DbContextStrings.zh-Hans.resx deleted file mode 100644 index ce01210d9..000000000 --- a/FreeSql.DbContext/Properties/DbContextStrings.zh-Hans.resx +++ /dev/null @@ -1,246 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - AddFreeDbContext 发生错误,请检查 {dbContextTypeName} 的构造参数都已正确注入 - - - 不可添加,已存在于状态管理:{entityString} - - - 不可添加,实体没有主键:{entityString} - - - 不可添加,未设置主键的值:{entityString} - - - 不可添加,自增属性有值:{entityString} - - - 不可附加,实体没有主键:{entityString} - - - 不可附加,未设置主键的值:{entityString} - - - 不可删除,数据未被跟踪,应该先查询:{entityString} - - - 不可删除,实体没有主键:{entityString} - - - 不可删除,未设置主键的值:{entityString} - - - 不可进行编辑,实体没有主键:{entityString} - - - 不可更新,数据未被跟踪,应该先查询 或者 Attach:{entityString} - - - 不可更新,实体没有主键:{entityString} - - - 不可更新,未设置主键的值:{entityString} - - - 不可更新,数据库不存在该记录:{entityString} - - - 请在 OnConfiguring 或 AddFreeDbContext 中配置 UseFreeSql - - - DbSet.AsType 参数错误,请传入正确的实体类型 - - - 实体类型 {EntityTypeName} 无法转换为 {name},无法使用该方法 - - - 实体类型 {EntityTypeName} 主键类型不为 {fullName},无法使用该方法 - - - 实体类型 {EntityTypeName} 主键数量不为 1,无法使用该方法 - - - FreeSql.Repository 设置过滤器失败,原因是对象不属于 IRepository - - - 不可比较,实体没有主键:{entityString} - - - 不可比较,未设置主键的值:{entityString} - - - FreeSql.Repository Insert 失败,因为设置了过滤器 {filterKey}: {filterValueExpression},插入的数据不符合 {entityString} - - - ISelect.AsType 参数不支持指定为 object - - - {tableTypeFullName} 不存在属性 {propertyName} - - - 找不到方法 DbSet<>.StatesRemoveByObjects - - - 参数 data 类型错误 {entityTypeFullName} - - - 参数错误 {param} - - - 参数错误 {param} 不能为 null - - - 参数错误 {many} 不是集合属性 - - - 参数错误 {many} 集合属性不存在 - - - 参数错误 {one} 属性不存在 - - - Propagation_Mandatory: 使用当前事务,如果没有当前事务,就抛出异常 - - - Propagation_Never: 以非事务方式执行操作,如果当前事务存在则抛出异常 - - - {tableTypeFullName} 类型的属性 {propertyName} 不是 OneToMany 或 ManyToMany 特性 - - - 特别错误:批量添加失败,{dataType} 的返回数据,与添加的数目不匹配 - - - 特别错误:更新失败,数据未被跟踪:{entityString} - - - 已开启事务,不能禁用工作单元 - - - {tableTypeFullName} 类型已设置属性 {propertyName} 忽略特性 - - - {unitOfWorkManager} 构造参数 {fsql} 不能为 null - - - FreeSql.Repository Update 失败,因为设置了过滤器 {filterKey}: {filterValueExpression},更新的数据不符合{entityString} - - \ No newline at end of file diff --git a/FreeSql.DbContext/Repository/Repository/BaseRepository.cs b/FreeSql.DbContext/Repository/Repository/BaseRepository.cs index c22418f93..6a9e81f56 100644 --- a/FreeSql.DbContext/Repository/Repository/BaseRepository.cs +++ b/FreeSql.DbContext/Repository/Repository/BaseRepository.cs @@ -197,12 +197,12 @@ public BaseRepository(IFreeSql fsql) : base(fsql) { } TEntity CheckTKeyAndReturnIdEntity(TKey id) { var tb = _db.OrmOriginal.CodeFirst.GetTableByEntity(EntityType); - if (tb.Primarys.Length != 1) throw new Exception(DbContextStrings.EntityType_PrimaryKeyIsNotOne(EntityType.Name)); - if (tb.Primarys[0].CsType.NullableTypeOrThis() != typeof(TKey).NullableTypeOrThis()) throw new Exception(DbContextStrings.EntityType_PrimaryKeyError(EntityType.Name, typeof(TKey).FullName)); + if (tb.Primarys.Length != 1) throw new Exception(DbContextErrorStrings.EntityType_PrimaryKeyIsNotOne(EntityType.Name)); + if (tb.Primarys[0].CsType.NullableTypeOrThis() != typeof(TKey).NullableTypeOrThis()) throw new Exception(DbContextErrorStrings.EntityType_PrimaryKeyError(EntityType.Name, typeof(TKey).FullName)); var obj = tb.Type.CreateInstanceGetDefaultValue(); _db.OrmOriginal.SetEntityValueWithPropertyName(tb.Type, obj, tb.Primarys[0].CsName, id); var ret = obj as TEntity; - if (ret == null) throw new Exception(DbContextStrings.EntityType_CannotConvert(EntityType.Name, typeof(TEntity).Name)); + if (ret == null) throw new Exception(DbContextErrorStrings.EntityType_CannotConvert(EntityType.Name, typeof(TEntity).Name)); return ret; } diff --git a/FreeSql.DbContext/UnitOfWork/UnitOfWork.cs b/FreeSql.DbContext/UnitOfWork/UnitOfWork.cs index 88057afe0..d75c8d04e 100644 --- a/FreeSql.DbContext/UnitOfWork/UnitOfWork.cs +++ b/FreeSql.DbContext/UnitOfWork/UnitOfWork.cs @@ -55,7 +55,7 @@ void ReturnObject() public void Close() { if (_tran != null) - throw new Exception(DbContextStrings.TransactionHasBeenStarted); + throw new Exception(DbContextErrorStrings.TransactionHasBeenStarted); Enable = false; } diff --git a/FreeSql.DbContext/UnitOfWork/UnitOfWorkManager.cs b/FreeSql.DbContext/UnitOfWork/UnitOfWorkManager.cs index dd5a16aa9..258b537f3 100644 --- a/FreeSql.DbContext/UnitOfWork/UnitOfWorkManager.cs +++ b/FreeSql.DbContext/UnitOfWork/UnitOfWorkManager.cs @@ -22,7 +22,7 @@ public class UnitOfWorkManager : IDisposable public UnitOfWorkManager(IFreeSql fsql) { - if (fsql == null) throw new ArgumentNullException(DbContextStrings.UnitOfWorkManager_Construction_CannotBeNull(nameof(UnitOfWorkManager), nameof(fsql))); + if (fsql == null) throw new ArgumentNullException(DbContextErrorStrings.UnitOfWorkManager_Construction_CannotBeNull(nameof(UnitOfWorkManager), nameof(fsql))); _ormScoped = DbContextScopedFreeSql.Create(fsql, null, () => this.Current); } @@ -93,7 +93,7 @@ public IUnitOfWork Begin(Propagation propagation = Propagation.Required, Isolati { case Propagation.Required: return FindedUowCreateVirtual() ?? CreateUow(isolationLevel); case Propagation.Supports: return FindedUowCreateVirtual() ?? CreateUowNothing(_allUows.LastOrDefault()?.IsNotSupported ?? false); - case Propagation.Mandatory: return FindedUowCreateVirtual() ?? throw new Exception(DbContextStrings.Propagation_Mandatory); + case Propagation.Mandatory: return FindedUowCreateVirtual() ?? throw new Exception(DbContextErrorStrings.Propagation_Mandatory); case Propagation.NotSupported: return CreateUowNothing(true); case Propagation.Never: var isNotSupported = _allUows.LastOrDefault()?.IsNotSupported ?? false; @@ -101,7 +101,7 @@ public IUnitOfWork Begin(Propagation propagation = Propagation.Required, Isolati { for (var a = _rawUows.Count - 1; a >= 0; a--) if (_rawUows[a].Uow.GetOrBeginTransaction(false) != null) - throw new Exception(DbContextStrings.Propagation_Never); + throw new Exception(DbContextErrorStrings.Propagation_Never); } return CreateUowNothing(isNotSupported); case Propagation.Nested: return CreateUow(isolationLevel); diff --git a/FreeSql/DataAnnotations/TableAttribute.cs b/FreeSql/DataAnnotations/TableAttribute.cs index 683e48dcd..ab7882f55 100644 --- a/FreeSql/DataAnnotations/TableAttribute.cs +++ b/FreeSql/DataAnnotations/TableAttribute.cs @@ -47,14 +47,14 @@ internal void ParseAsTable(TableInfo tb) { var atm = Regex.Match(AsTable, @"([\w_\d]+)\s*=\s*(\d\d\d\d)\s*\-\s*(\d\d?)\s*\-\s*(\d\d?)\s*( [\d:]+)?\(([\d,]+)\s*(year|month|day|hour)\)", RegexOptions.IgnoreCase); if (atm.Success == false) - throw new Exception(CoreStrings.AsTable_PropertyName_FormatError(AsTable)); + throw new Exception(CoreErrorStrings.AsTable_PropertyName_FormatError(AsTable)); tb.AsTableColumn = tb.Columns.TryGetValue(atm.Groups[1].Value, out var trycol) ? trycol : - tb.ColumnsByCs.TryGetValue(atm.Groups[1].Value, out trycol) ? trycol : throw new Exception(CoreStrings.NotFound_Table_Property_AsTable(atm.Groups[1].Value)); + tb.ColumnsByCs.TryGetValue(atm.Groups[1].Value, out trycol) ? trycol : throw new Exception(CoreErrorStrings.NotFound_Table_Property_AsTable(atm.Groups[1].Value)); if (tb.AsTableColumn.Attribute.MapType.NullableTypeOrThis() != typeof(DateTime)) { tb.AsTableColumn = null; - throw new Exception(CoreStrings.AsTable_PropertyName_NotDateTime(atm.Groups[1].Value)); + throw new Exception(CoreErrorStrings.AsTable_PropertyName_NotDateTime(atm.Groups[1].Value)); } var beginTime = $"{atm.Groups[2].Value}-{atm.Groups[3].Value}-{atm.Groups[4].Value}"; var atm5 = atm.Groups[5].Value; @@ -77,7 +77,7 @@ internal void ParseAsTable(TableInfo tb) case "day": return dt.AddDays(atm6); case "hour": return dt.AddHours(atm6); } - throw new NotImplementedException(CoreStrings.Functions_AsTable_NotImplemented(AsTable)); + throw new NotImplementedException(CoreErrorStrings.Functions_AsTable_NotImplemented(AsTable)); }); } } @@ -118,13 +118,13 @@ class DateTimeAsTableImpl : IAsTable public DateTimeAsTableImpl(string tableName, DateTime beginTime, Func nextTimeFunc) { - if (nextTimeFunc == null) throw new ArgumentException(CoreStrings.Cannot_Be_NULL_Name("nextTimeFunc")); + if (nextTimeFunc == null) throw new ArgumentException(CoreErrorStrings.Cannot_Be_NULL_Name("nextTimeFunc")); //beginTime = beginTime.Date; //日期部分作为开始 _beginTime = beginTime; _nextTimeFunc = nextTimeFunc; _tableName = tableName; _tableNameFormat = _regTableNameFormat.Match(tableName); - if (string.IsNullOrEmpty(_tableNameFormat.Groups[1].Value)) throw new ArgumentException(CoreStrings.TableName_Format_Error("yyyyMMdd")); + if (string.IsNullOrEmpty(_tableNameFormat.Groups[1].Value)) throw new ArgumentException(CoreErrorStrings.TableName_Format_Error("yyyyMMdd")); ExpandTable(beginTime, DateTime.Now); } @@ -139,7 +139,7 @@ void ExpandTable(DateTime beginTime, DateTime endTime) { var dtstr = beginTime.ToString(_tableNameFormat.Groups[1].Value); var name = _tableName.Replace(_tableNameFormat.Groups[0].Value, dtstr); - if (_allTables.Contains(name)) throw new ArgumentException(CoreStrings.Generated_Same_SubTable(_tableName)); + if (_allTables.Contains(name)) throw new ArgumentException(CoreErrorStrings.Generated_Same_SubTable(_tableName)); _allTables.Insert(0, name); _allTablesTime.Insert(0, beginTime); _lastTime = _nextTimeFunc(beginTime, index++); @@ -160,26 +160,26 @@ public NativeTuple GetRangeByTableName(string tableName) } DateTime ParseColumnValue(object columnValue) { - if (columnValue == null) throw new Exception(CoreStrings.SubTableFieldValue_IsNotNull); + if (columnValue == null) throw new Exception(CoreErrorStrings.SubTableFieldValue_IsNotNull); DateTime dt; if (columnValue is DateTime || columnValue is DateTime?) dt = (DateTime)columnValue; else if (columnValue is string) { - if (DateTime.TryParse(string.Concat(columnValue), out dt) == false) throw new Exception(CoreStrings.SubTableFieldValue_NotConvertDateTime(columnValue)); + if (DateTime.TryParse(string.Concat(columnValue), out dt) == false) throw new Exception(CoreErrorStrings.SubTableFieldValue_NotConvertDateTime(columnValue)); } else if (columnValue is int || columnValue is long) { dt = new DateTime(1970, 1, 1).AddSeconds((double)columnValue); } - else throw new Exception(CoreStrings.SubTableFieldValue_NotConvertDateTime(columnValue)); + else throw new Exception(CoreErrorStrings.SubTableFieldValue_NotConvertDateTime(columnValue)); return dt; } public string GetTableNameByColumnValue(object columnValue, bool autoExpand = false) { var dt = ParseColumnValue(columnValue); - if (dt < _beginTime) throw new Exception(CoreStrings.SubTableFieldValue_CannotLessThen(dt.ToString("yyyy-MM-dd HH:mm:ss"), _beginTime.ToString("yyyy-MM-dd HH:mm:ss"))); + if (dt < _beginTime) throw new Exception(CoreErrorStrings.SubTableFieldValue_CannotLessThen(dt.ToString("yyyy-MM-dd HH:mm:ss"), _beginTime.ToString("yyyy-MM-dd HH:mm:ss"))); if (dt >= _lastTime && autoExpand) { // 扩容分表 @@ -192,7 +192,7 @@ public string GetTableNameByColumnValue(object columnValue, bool autoExpand = fa if (dt >= _allTablesTime[a]) return _allTables[a]; } - throw new Exception(CoreStrings.SubTableFieldValue_NotMatchTable(dt.ToString("yyyy-MM-dd HH:mm:ss"))); + throw new Exception(CoreErrorStrings.SubTableFieldValue_NotMatchTable(dt.ToString("yyyy-MM-dd HH:mm:ss"))); } public string[] GetTableNamesByColumnValueRange(object columnValue1, object columnValue2) { @@ -312,7 +312,7 @@ public IAsTableTableNameRangeResult GetTableNamesBySqlWhere(string sqlWhere, Lis { var val1 = LocalGetParamValue(m.Groups[1].Value); var val2 = LocalGetParamValue(m.Groups[2].Value); - if (val1 == null || val2 == null) throw new Exception(CoreStrings.Failed_SubTable_FieldValue(sqlWhere)); + if (val1 == null || val2 == null) throw new Exception(CoreErrorStrings.Failed_SubTable_FieldValue(sqlWhere)); return new IAsTableTableNameRangeResult(GetTableNamesByColumnValueRange(val1, val2), ParseColumnValue(val1), ParseColumnValue(val2)); } m = regs[8].Match(newSqlWhere); @@ -320,14 +320,14 @@ public IAsTableTableNameRangeResult GetTableNamesBySqlWhere(string sqlWhere, Lis { var val1 = LocalGetParamValue(m.Groups[2].Value); var val2 = LocalGetParamValue(m.Groups[4].Value); - if (val1 == null || val2 == null) throw new Exception(CoreStrings.Failed_SubTable_FieldValue(sqlWhere)); + if (val1 == null || val2 == null) throw new Exception(CoreErrorStrings.Failed_SubTable_FieldValue(sqlWhere)); return LocalGetTables(m.Groups[1].Value, m.Groups[3].Value, ParseColumnValue(val1), ParseColumnValue(val2)); } m = regs[10].Match(newSqlWhere); if (m.Success) { var val1 = LocalGetParamValue(m.Groups[2].Value); - if (val1 == null) throw new Exception(CoreStrings.Failed_SubTable_FieldValue(sqlWhere)); + if (val1 == null) throw new Exception(CoreErrorStrings.Failed_SubTable_FieldValue(sqlWhere)); return LocalGetTables2(m.Groups[1].Value, ParseColumnValue(val1)); } return new IAsTableTableNameRangeResult(_GetDefaultAllTables?.Invoke(AllTables) ?? AllTables, _beginTime, _lastTime); diff --git a/FreeSql/DataAnnotations/TableFluent.cs b/FreeSql/DataAnnotations/TableFluent.cs index 063e82afc..aff9f944b 100644 --- a/FreeSql/DataAnnotations/TableFluent.cs +++ b/FreeSql/DataAnnotations/TableFluent.cs @@ -60,7 +60,7 @@ public TableFluent AsTable(string value) public ColumnFluent Property(string proto) { - if (_properties.TryGetValue(proto, out var tryProto) == false) throw new KeyNotFoundException(CoreStrings.NotFound_PropertyName(proto)); + if (_properties.TryGetValue(proto, out var tryProto) == false) throw new KeyNotFoundException(CoreErrorStrings.NotFound_PropertyName(proto)); var col = _table._columns.GetOrAdd(tryProto.Name, name => new ColumnAttribute { }); return new ColumnFluent(col, tryProto, _entityType); } @@ -76,7 +76,7 @@ public ColumnFluent Property(string proto) public TableFluent Navigate(string proto, string bind, string tempPrimary) => NavigateInternal(proto, bind, tempPrimary, null); TableFluent NavigateInternal(string proto, string bind, string tempPrimary, Type manyToMany) { - if (_properties.TryGetValue(proto, out var tryProto) == false) throw new KeyNotFoundException(CoreStrings.NotFound_Property(proto)); + if (_properties.TryGetValue(proto, out var tryProto) == false) throw new KeyNotFoundException(CoreErrorStrings.NotFound_Property(proto)); var nav = new NavigateAttribute { Bind = bind, TempPrimary = tempPrimary, ManyToMany = manyToMany }; _table._navigates.AddOrUpdate(tryProto.Name, nav, (name, old) => nav); return this; @@ -156,12 +156,12 @@ public ColumnFluent Property(Expression> column) var exp = column?.Body; if (exp?.NodeType == ExpressionType.Convert) exp = (exp as UnaryExpression)?.Operand; var proto = (exp as MemberExpression)?.Member; - if (proto == null) throw new FormatException(CoreStrings.Bad_Expression_Format(column)); + if (proto == null) throw new FormatException(CoreErrorStrings.Bad_Expression_Format(column)); return Property(proto.Name); } public ColumnFluent Property(string proto) { - if (_properties.TryGetValue(proto, out var tryProto) == false) throw new KeyNotFoundException(CoreStrings.NotFound_PropertyName(proto)); + if (_properties.TryGetValue(proto, out var tryProto) == false) throw new KeyNotFoundException(CoreErrorStrings.NotFound_PropertyName(proto)); var col = _table._columns.GetOrAdd(tryProto.Name, name => new ColumnAttribute { }); return new ColumnFluent(col, tryProto, typeof(T)); } @@ -181,14 +181,14 @@ TableFluent NavigateInternal(Expression> proto, strin var exp = proto?.Body; if (exp.NodeType == ExpressionType.Convert) exp = (exp as UnaryExpression)?.Operand; var member = (exp as MemberExpression)?.Member; - if (member == null) throw new FormatException(CoreStrings.Bad_Expression_Format(proto)); + if (member == null) throw new FormatException(CoreErrorStrings.Bad_Expression_Format(proto)); return NavigateInternal(member.Name, bind, tempPrimary, manyToMany); } public TableFluent Navigate(string proto, string bind, Type manyToMany = null) => NavigateInternal(proto, bind, null, manyToMany); public TableFluent Navigate(string proto, string bind, string tempPrimary) => NavigateInternal(proto, bind, tempPrimary, null); TableFluent NavigateInternal(string proto, string bind, string tempPrimary, Type manyToMany) { - if (_properties.TryGetValue(proto, out var tryProto) == false) throw new KeyNotFoundException(CoreStrings.NotFound_PropertyName(proto)); + if (_properties.TryGetValue(proto, out var tryProto) == false) throw new KeyNotFoundException(CoreErrorStrings.NotFound_PropertyName(proto)); var nav = new NavigateAttribute { Bind = bind, TempPrimary = tempPrimary, ManyToMany = manyToMany }; _table._navigates.AddOrUpdate(tryProto.Name, nav, (name, old) => nav); return this; diff --git a/FreeSql/Extensions/AdoNetExtensions.cs b/FreeSql/Extensions/AdoNetExtensions.cs index d38f3522c..28908754d 100644 --- a/FreeSql/Extensions/AdoNetExtensions.cs +++ b/FreeSql/Extensions/AdoNetExtensions.cs @@ -13,8 +13,8 @@ public static class AdoNetExtensions static object _dicCurdLock = new object(); static IFreeSql GetCrud(IDbConnection dbconn) { - if (dbconn == null) throw new ArgumentNullException($"{nameof(dbconn)} {CoreStrings.Cannot_Be_NULL}"); - if (dbconn.ConnectionString == null) throw new ArgumentNullException($"{nameof(dbconn)}.ConnectionString {CoreStrings.Cannot_Be_NULL}"); + if (dbconn == null) throw new ArgumentNullException($"{nameof(dbconn)} {CoreErrorStrings.Cannot_Be_NULL}"); + if (dbconn.ConnectionString == null) throw new ArgumentNullException($"{nameof(dbconn)}.ConnectionString {CoreErrorStrings.Cannot_Be_NULL}"); Type dbconType = dbconn.GetType(); var connType = dbconType.UnderlyingSystemType; if (_dicCurd.TryGetValue(dbconn.ConnectionString, out var fsql)) return fsql; @@ -25,49 +25,49 @@ static IFreeSql GetCrud(IDbConnection dbconn) case "MySqlConnection": providerType = Type.GetType("FreeSql.MySql.MySqlProvider`1,FreeSql.Provider.MySql")?.MakeGenericType(connType); if (providerType == null) providerType = Type.GetType("FreeSql.MySql.MySqlProvider`1,FreeSql.Provider.MySqlConnector")?.MakeGenericType(connType); - if (providerType == null) throw new Exception(CoreStrings.Missing_FreeSqlProvider_Package("MySql")); + if (providerType == null) throw new Exception(CoreErrorStrings.Missing_FreeSqlProvider_Package("MySql")); break; case "SqlConnection": providerType = Type.GetType("FreeSql.SqlServer.SqlServerProvider`1,FreeSql.Provider.SqlServer")?.MakeGenericType(connType); if (providerType == null) providerType = Type.GetType("FreeSql.SqlServer.SqlServerProvider`1,FreeSql.Provider.SqlServerForSystem")?.MakeGenericType(connType); - if (providerType == null) throw new Exception(CoreStrings.Missing_FreeSqlProvider_Package("SqlServer/SqlServerForSystem")); + if (providerType == null) throw new Exception(CoreErrorStrings.Missing_FreeSqlProvider_Package("SqlServer/SqlServerForSystem")); break; case "NpgsqlConnection": providerType = Type.GetType("FreeSql.PostgreSQL.PostgreSQLProvider`1,FreeSql.Provider.PostgreSQL")?.MakeGenericType(connType); - if (providerType == null) throw new Exception(CoreStrings.Missing_FreeSqlProvider_Package("PostgreSQL")); + if (providerType == null) throw new Exception(CoreErrorStrings.Missing_FreeSqlProvider_Package("PostgreSQL")); break; case "OracleConnection": providerType = Type.GetType("FreeSql.Oracle.OracleProvider`1,FreeSql.Provider.Oracle")?.MakeGenericType(connType); - if (providerType == null) throw new Exception(CoreStrings.Missing_FreeSqlProvider_Package("Oracle")); + if (providerType == null) throw new Exception(CoreErrorStrings.Missing_FreeSqlProvider_Package("Oracle")); break; case "SQLiteConnection": case "SqliteConnection": providerType = Type.GetType("FreeSql.Sqlite.SqliteProvider`1,FreeSql.Provider.Sqlite")?.MakeGenericType(connType); if (providerType == null) providerType = Type.GetType("FreeSql.Sqlite.SqliteProvider`1,FreeSql.Provider.SqliteCore")?.MakeGenericType(connType); //Microsoft.Data.Sqlite.Core.dll - if (providerType == null) throw new Exception(CoreStrings.Missing_FreeSqlProvider_Package("Sqlite/SqliteCore")); + if (providerType == null) throw new Exception(CoreErrorStrings.Missing_FreeSqlProvider_Package("Sqlite/SqliteCore")); break; case "DmConnection": providerType = Type.GetType("FreeSql.Dameng.DamengProvider`1,FreeSql.Provider.Dameng")?.MakeGenericType(connType); - if (providerType == null) throw new Exception(CoreStrings.Missing_FreeSqlProvider_Package("Dameng")); + if (providerType == null) throw new Exception(CoreErrorStrings.Missing_FreeSqlProvider_Package("Dameng")); break; case "OscarConnection": providerType = Type.GetType("FreeSql.ShenTong.ShenTongProvider`1,FreeSql.Provider.ShenTong")?.MakeGenericType(connType); - if (providerType == null) throw new Exception(CoreStrings.Missing_FreeSqlProvider_Package("ShenTong")); + if (providerType == null) throw new Exception(CoreErrorStrings.Missing_FreeSqlProvider_Package("ShenTong")); break; case "KdbndpConnection": providerType = Type.GetType("FreeSql.KingbaseES.KingbaseESProvider`1,FreeSql.Provider.KingbaseES")?.MakeGenericType(connType); - if (providerType == null) throw new Exception(CoreStrings.Missing_FreeSqlProvider_Package("KingbaseES")); + if (providerType == null) throw new Exception(CoreErrorStrings.Missing_FreeSqlProvider_Package("KingbaseES")); break; case "FbConnection": providerType = Type.GetType("FreeSql.Firebird.FirebirdProvider`1,FreeSql.Provider.Firebird")?.MakeGenericType(connType); - if (providerType == null) throw new Exception(CoreStrings.Missing_FreeSqlProvider_Package("Firebird")); + if (providerType == null) throw new Exception(CoreErrorStrings.Missing_FreeSqlProvider_Package("Firebird")); break; case "ClickHouseConnection": providerType = Type.GetType("FreeSql.ClickHouse.ClickHouseProvider`1,FreeSql.Provider.ClickHouse")?.MakeGenericType(connType); - if (providerType == null) throw new Exception(CoreStrings.Missing_FreeSqlProvider_Package("ClickHouse")); + if (providerType == null) throw new Exception(CoreErrorStrings.Missing_FreeSqlProvider_Package("ClickHouse")); break; default: - throw new Exception(CoreStrings.Not_Implemented); + throw new Exception(CoreErrorStrings.Not_Implemented); } lock (_dicCurdLock) { @@ -79,7 +79,7 @@ static IFreeSql GetCrud(IDbConnection dbconn) } static IFreeSql GetCrud(IDbTransaction dbtran) { - if (dbtran == null) throw new ArgumentNullException($"{nameof(dbtran)} {CoreStrings.Cannot_Be_NULL}"); + if (dbtran == null) throw new ArgumentNullException($"{nameof(dbtran)} {CoreErrorStrings.Cannot_Be_NULL}"); return GetCrud(dbtran.Connection); } diff --git a/FreeSql/Extensions/FreeSqlGlobalExpressionCallExtensions.cs b/FreeSql/Extensions/FreeSqlGlobalExpressionCallExtensions.cs index 6ce95002e..e9ac61184 100644 --- a/FreeSql/Extensions/FreeSqlGlobalExpressionCallExtensions.cs +++ b/FreeSql/Extensions/FreeSqlGlobalExpressionCallExtensions.cs @@ -573,7 +573,7 @@ public static string StringJoinGBaseWmConcatText(object column, object delimiter if (expContext.ParsedContent["delimiter"] == "','") expContext.Result = $"wm_concat_text({expContext.ParsedContent["column"]})"; else - throw new NotImplementedException(CoreStrings.GBase_NotSupport_OtherThanCommas); + throw new NotImplementedException(CoreErrorStrings.GBase_NotSupport_OtherThanCommas); //expContext.Result = $"replace(wm_concat_text({expContext.ParsedContent["column"]}), ',', {expContext.ParsedContent["delimiter"]})"; return null; } diff --git a/FreeSql/Extensions/FreeSqlGlobalExtensions.cs b/FreeSql/Extensions/FreeSqlGlobalExtensions.cs index 22c0973ab..77421e705 100644 --- a/FreeSql/Extensions/FreeSqlGlobalExtensions.cs +++ b/FreeSql/Extensions/FreeSqlGlobalExtensions.cs @@ -193,7 +193,7 @@ internal static ConstructorInfo InternalGetTypeConstructor0OrFirst(this Type tha .OrderBy(a => a.IsPublic ? 0 : 1) .FirstOrDefault(); })); - if (ret.Value == null && isThrow) throw new ArgumentException(CoreStrings.Type_Cannot_Access_Constructor(that.FullName)); + if (ret.Value == null && isThrow) throw new ArgumentException(CoreErrorStrings.Type_Cannot_Access_Constructor(that.FullName)); return ret.Value; } @@ -416,7 +416,7 @@ async Task> var t1sel = orm.Select().AsType(entityType) as Select1Provider; var t1expFul = t1sel.ConvertStringPropertyToExpression(property, true); var t1exp = props.Length == 1 ? t1expFul : t1sel.ConvertStringPropertyToExpression(props[0], true); - if (t1expFul == null) throw new ArgumentException(CoreStrings.Cannot_Resolve_ExpressionTree(nameof(property))); + if (t1expFul == null) throw new ArgumentException(CoreErrorStrings.Cannot_Resolve_ExpressionTree(nameof(property))); var propElementType = t1expFul.Type.GetGenericArguments().FirstOrDefault() ?? t1expFul.Type.GetElementType(); if (propElementType != null) //IncludeMany { @@ -432,7 +432,7 @@ async Task> return list; } var tbtr = t1tb.GetTableRef(props[0], true, true); - if (tbtr == null) throw new ArgumentException(CoreStrings.ParameterError_NotValid_Navigation(nameof(property))); + if (tbtr == null) throw new ArgumentException(CoreErrorStrings.ParameterError_NotValid_Navigation(nameof(property))); var reftb = orm.CodeFirst.GetTableByEntity(t1exp.Type); var refsel = orm.Select().AsType(t1exp.Type) as Select1Provider; if (props.Length > 1) @@ -479,14 +479,14 @@ static Select1Provider IncludeManyByPropertyNameCommonGetSelect(IFreeSql } var sel = orm.Select().AsType(entityType) as Select1Provider; var exp = sel.ConvertStringPropertyToExpression(property, true); - if (exp == null) throw new ArgumentException(CoreStrings.Cannot_Resolve_ExpressionTree(nameof(property))); + if (exp == null) throw new ArgumentException(CoreErrorStrings.Cannot_Resolve_ExpressionTree(nameof(property))); var memExp = exp as MemberExpression; - if (memExp == null) throw new ArgumentException($"{CoreStrings.Cannot_Resolve_ExpressionTree(nameof(property))}2"); + if (memExp == null) throw new ArgumentException($"{CoreErrorStrings.Cannot_Resolve_ExpressionTree(nameof(property))}2"); var parTb = orm.CodeFirst.GetTableByEntity(memExp.Expression.Type); - if (parTb == null) throw new ArgumentException($"{CoreStrings.Cannot_Resolve_ExpressionTree(nameof(property))}3"); + if (parTb == null) throw new ArgumentException($"{CoreErrorStrings.Cannot_Resolve_ExpressionTree(nameof(property))}3"); var propElementType = exp.Type.GetGenericArguments().FirstOrDefault() ?? exp.Type.GetElementType(); var reftb = orm.CodeFirst.GetTableByEntity(propElementType); - if (reftb == null) throw new ArgumentException(CoreStrings.ParameterError_NotValid_Collection(nameof(property))); + if (reftb == null) throw new ArgumentException(CoreErrorStrings.ParameterError_NotValid_Collection(nameof(property))); if (string.IsNullOrWhiteSpace(where) == false) { @@ -499,12 +499,12 @@ static Select1Provider IncludeManyByPropertyNameCommonGetSelect(IFreeSql for (var a = 0; a < whereSplit.Length; a++) { var keyval = whereSplit[a].Split('=').Select(x => x.Trim()).Where(x => string.IsNullOrWhiteSpace(x) == false).ToArray(); - if (keyval.Length != 2) throw new ArgumentException(CoreStrings.ParameterError_NotValid_UseCommas(nameof(where))); + if (keyval.Length != 2) throw new ArgumentException(CoreErrorStrings.ParameterError_NotValid_UseCommas(nameof(where))); if (reftb.ColumnsByCs.TryGetValue(keyval[0], out var keycol) == false) - throw new ArgumentException(CoreStrings.ParameterError_NotValid_PropertyName(nameof(where), keyval[0], reftb.Type.DisplayCsharp())); + throw new ArgumentException(CoreErrorStrings.ParameterError_NotValid_PropertyName(nameof(where), keyval[0], reftb.Type.DisplayCsharp())); if (parTb.ColumnsByCs.TryGetValue(keyval[1], out var valcol) == false) - throw new ArgumentException(CoreStrings.ParameterError_NotValid_PropertyName(nameof(where), keyval[1], parTb.Type.DisplayCsharp())); + throw new ArgumentException(CoreErrorStrings.ParameterError_NotValid_PropertyName(nameof(where), keyval[1], parTb.Type.DisplayCsharp())); var tmpExp = Expression.Equal( Expression.Convert(Expression.MakeMemberAccess(refparamExp, reftb.Properties[keyval[0]]), valcol.CsType), @@ -530,7 +530,7 @@ static Select1Provider IncludeManyByPropertyNameCommonGetSelect(IFreeSql select.Split(',').Select(x => x.Trim()).Where(x => string.IsNullOrWhiteSpace(x) == false).Select(a => { if (reftb.ColumnsByCs.TryGetValue(a, out var col) == false) - throw new ArgumentException(CoreStrings.ParameterError_NotValid_PropertyName(nameof(select), a, reftb.Type.DisplayCsharp())); + throw new ArgumentException(CoreErrorStrings.ParameterError_NotValid_PropertyName(nameof(select), a, reftb.Type.DisplayCsharp())); return Expression.Bind(reftb.Properties[col.CsName], Expression.MakeMemberAccess(refparamExp, reftb.Properties[col.CsName])); }).ToArray()); @@ -555,7 +555,7 @@ static Select1Provider IncludeManyByPropertyNameCommonGetSelect(IFreeSql } var navigateSelector = Expression.Lambda(funcType, exp, sel._tables[0].Parameter); var incMethod = sel.GetType().GetMethod("IncludeMany"); - if (incMethod == null) throw new Exception(CoreStrings.RunTimeError_Reflection_IncludeMany); + if (incMethod == null) throw new Exception(CoreErrorStrings.RunTimeError_Reflection_IncludeMany); incMethod.MakeGenericMethod(reftb.Type).Invoke(sel, new object[] { navigateSelector, newthen }); return sel; } @@ -639,7 +639,7 @@ public static ISelect AsTreeCte(this ISelect that, var navs = tb.GetAllTableRef().Where(a => a.Value.Exception == null).Select(a => a.Value) .Where(a => a.RefType == FreeSql.Internal.Model.TableRefType.OneToMany && a.RefEntityType == tb.Type).ToArray(); - if (navs.Length != 1) throw new ArgumentException(CoreStrings.Entity_NotParentChild_Relationship(tb.Type.FullName)); + if (navs.Length != 1) throw new ArgumentException(CoreErrorStrings.Entity_NotParentChild_Relationship(tb.Type.FullName)); var tbref = navs[0]; var cteName = "as_tree_cte"; @@ -693,7 +693,7 @@ public static ISelect AsTreeCte(this ISelect that, } if (int.TryParse((mysqlVersion ?? "").Split('.')[0], out var mysqlVersionFirst) && mysqlVersionFirst < 8) { - if (tbref.Columns.Count > 1) throw new ArgumentException(CoreStrings.Entity_MySQL_VersionsBelow8_NotSupport_Multiple_PrimaryKeys(tb.Type.FullName)); + if (tbref.Columns.Count > 1) throw new ArgumentException(CoreErrorStrings.Entity_MySQL_VersionsBelow8_NotSupport_Multiple_PrimaryKeys(tb.Type.FullName)); var mysql56Sql = ""; if (up == false) { @@ -913,7 +913,7 @@ public static TSelect OrderByRandom(this ISelect0 that case DataType.Firebird: return that.OrderBy("rand()"); } - throw new NotSupportedException($"{CoreStrings.Not_Support_OrderByRandom(s0p._orm.Ado.DataType)}"); + throw new NotSupportedException($"{CoreErrorStrings.Not_Support_OrderByRandom(s0p._orm.Ado.DataType)}"); } #endregion @@ -1083,9 +1083,9 @@ public InsertDictImpl CommandTimeout(int timeout) public long ExecuteIdentity(string identityColumn) { if (string.IsNullOrEmpty(identityColumn)) - throw new Exception(CoreStrings.Cannot_Be_NULL_Name(nameof(identityColumn))); + throw new Exception(CoreErrorStrings.Cannot_Be_NULL_Name(nameof(identityColumn))); if (_insertProvider._table.ColumnsByCs.TryGetValue(identityColumn, out var col) == false) - throw new Exception(CoreStrings.GetPrimarys_ParameterError_IsNotDictKey(identityColumn).Replace(nameof(ExecuteIdentity), "")); + throw new Exception(CoreErrorStrings.GetPrimarys_ParameterError_IsNotDictKey(identityColumn).Replace(nameof(ExecuteIdentity), "")); col.Attribute.IsIdentity = true; return _insertProvider.ExecuteIdentity(); } @@ -1098,9 +1098,9 @@ public long ExecuteIdentity(string identityColumn) public Task ExecuteIdentityAsync(string identityColumn, CancellationToken cancellationToken = default) { if (string.IsNullOrEmpty(identityColumn)) - throw new Exception(CoreStrings.Cannot_Be_NULL_Name(nameof(identityColumn))); + throw new Exception(CoreErrorStrings.Cannot_Be_NULL_Name(nameof(identityColumn))); if (_insertProvider._table.ColumnsByCs.TryGetValue(identityColumn, out var col) == false) - throw new Exception(CoreStrings.GetPrimarys_ParameterError_IsNotDictKey(identityColumn).Replace(nameof(ExecuteIdentity), "")); + throw new Exception(CoreErrorStrings.GetPrimarys_ParameterError_IsNotDictKey(identityColumn).Replace(nameof(ExecuteIdentity), "")); col.Attribute.IsIdentity = true; return _insertProvider.ExecuteIdentityAsync(cancellationToken); } @@ -1163,7 +1163,7 @@ public static ColumnInfo[] GetPrimarys(TableInfo table, params string[] primarys foreach (var primary in primarys) { if (table.ColumnsByCs.TryGetValue(string.Concat(primary), out var col)) pks.Add(col); - else throw new Exception(CoreStrings.GetPrimarys_ParameterError_IsNotDictKey(primary)); + else throw new Exception(CoreErrorStrings.GetPrimarys_ParameterError_IsNotDictKey(primary)); } return pks.ToArray(); } @@ -1182,17 +1182,17 @@ public static void SetTablePrimary(TableInfo table, bool isIdenity, params strin col.Attribute.IsIdentity = true; } } - else throw new Exception(CoreStrings.GetPrimarys_ParameterError_IsNotDictKey(primary)); + else throw new Exception(CoreErrorStrings.GetPrimarys_ParameterError_IsNotDictKey(primary)); } table.Primarys = table.Columns.Where(a => a.Value.Attribute.IsPrimary).Select(a => a.Value).ToArray(); } public UpdateDictImpl IsVersion(string version) { if (_updateProvider._table.ColumnsByCs.TryGetValue(version, out var col) == false) - throw new Exception(CoreStrings.GetPrimarys_ParameterError_IsNotDictKey(version).Replace(nameof(GetPrimarys), "")); + throw new Exception(CoreErrorStrings.GetPrimarys_ParameterError_IsNotDictKey(version).Replace(nameof(GetPrimarys), "")); //if (col.Attribute.MapType.IsNullableType() || // col.Attribute.MapType.IsNumberType() == false && !new[] { typeof(byte[]), typeof(string) }.Contains(col.Attribute.MapType)) - // throw new Exception(CoreStrings.Properties_AsRowLock_Must_Numeric_Byte(col.CsName)); + // throw new Exception(CoreErrorStrings.Properties_AsRowLock_Must_Numeric_Byte(col.CsName)); col.Attribute.IsVersion = true; _updateProvider._table.VersionColumn = col; _updateProvider._versionColumn = col; diff --git a/FreeSql/FreeSql.csproj b/FreeSql/FreeSql.csproj index bc6b6a176..152ebeec5 100644 --- a/FreeSql/FreeSql.csproj +++ b/FreeSql/FreeSql.csproj @@ -25,12 +25,6 @@ - - - - - - @@ -42,11 +36,6 @@ True True - - True - True - CoreStrings.Designer.tt - @@ -58,13 +47,6 @@ TextTemplatingFileGenerator Select1Provider2`16.cs - - TextTemplatingFileGenerator - CoreStrings.Designer.cs - - - FreeSql - diff --git a/FreeSql/FreeSql.xml b/FreeSql/FreeSql.xml index c2fac3dd8..949513256 100644 --- a/FreeSql/FreeSql.xml +++ b/FreeSql/FreeSql.xml @@ -5092,826 +5092,809 @@ 用于解决多实例情况下的静态集合缓存问题 - - - - String resources used in FreeSql exceptions, etc. - - - These strings are exposed publicly for use by database providers and extensions. - It is unusual for application code to need these strings. - - - - - - 重写当前线程的 CurrentUICulture 属性,对 - 使用此强类型资源类的所有资源查找执行重写。 - - - + [Table(AsTable = "{asTable}")] 特性值格式错误 - + [Table(AsTable = xx)] 设置的属性名 {atmGroupsValue} 不是 DateTime 类型 - + {name}: Failed to get resource {statistics} - + {name}: An exception needs to be thrown - + 错误的表达式格式 {column} - + Chunk 功能之前不可使用 Select - + 安全起见,请务必在事务开启之后,再使用 ForUpdate - + 不能为 null - + {name} 不能为 null - + 无法匹配 {property} - + {property} 无法解析为表达式树 - + 参数 masterConnectionString 不可为空,请检查 UseConnectionString - + 提交 - + 连接失败,准备切换其他可用服务器 - + - 自定义表达式解析错误:类型 {exp3MethodDeclaringType} 需要定义 static ThreadLocal<ExpressionCallContext> 字段、字段、字段(重要三次提醒) + 自定义表达式解析错误:类型 {exp3MethodDeclaringType} 需要定义 static ThreadLocal&lt;ExpressionCallContext&gt; 字段、字段、字段(重要三次提醒) - + Custom { 反射信息 }不能为空,格式:{ 静态方法名 }{ 空格 }{ 反射信息 } - + Custom { 静态方法名 }不能为空,格式:{ 静态方法名 }{ 空格 }{ 反射信息 } - + Custom 对应的{{ 静态方法名 }}:{fiValueCustomArray} 未设置 [DynamicFilterCustomAttribute] 特性 - + Custom 要求 Field 应该空格分割,并且长度为 2,格式:{ 静态方法名 }{ 空格 }{ 反射信息 } - + 操作的数据类型({dataDisplayCsharp}) 与 AsType({tableTypeDisplayCsharp}) 不一致,请检查。 - + DateRange 要求 Value 应该逗号分割,并且长度为 2 - + DateRange 要求 Value[1] 格式必须为:yyyy、yyyy-MM、yyyy-MM-dd、yyyy-MM-dd HH、yyyy、yyyy-MM-dd HH:mm - + 记录可能不存在,或者【行级乐观锁】版本过旧,更新数量{sourceCount},影响的行数{affrows}。 - + SlaveConnectionString 数量与 SlaveWeights 不相同 - + ColumnAttribute.Name {colattrName} 重复存在,请检查(注意:不区分大小写) - + 属性名 {pName} 重复存在,请检查(注意:不区分大小写) - + {function} 功能要求实体类 {tableCsName} 必须有主键 - + {tbTypeFullName} 是父子关系,但是 MySql 8.0 以下版本中不支持组合多主键 - + {tbTypeFullName} 不是父子关系,无法使用该功能 - + 这个特别的子查询不能解析 - + 表达式错误,它的顶级对象不是 ParameterExpression:{exp} - + 表达式错误,它不是连续的 MemberAccess 类型:{exp} - + ExpressionTree 转换类型错误,值({value}),类型({valueTypeFullName}),目标类型({typeFullName}),{exMessage} - + 未能解析分表字段值 {sqlWhere} - + AsTable 未实现的功能 {asTable} - + GBase 暂时不支持逗号以外的分割符 - + tableName:{tableName} 生成了相同的分表名 - + GetPrimarys 传递的参数 "{primary}" 不正确,它不属于字典数据的键名 - + 已经指定了 {first},不能再指定 {second} - + {tb2DbName}.{mp2MemberName} 被忽略,请检查 IsIgnore 设置,确认 get/set 为 public - + Include 参数类型错误 - + Include 参数类型错误,集合属性请使用 IncludeMany - + Include 参数类型错误,表达式类型应该为 MemberAccess - + IncludeMany 类型 {tbTypeDisplayCsharp} 的属性 {collMemMemberName} 不是有效的导航属性,提示:IsIgnore = true 不会成为导航属性 - + - IncludeMany {navigateSelector} 参数错误,Select 只可以使用一个参数的方法,正确格式:.Select(t =>new TNavigate {{}}) + IncludeMany {navigateSelector} 参数错误,Select 只可以使用一个参数的方法,正确格式:.Select(t =&gt;new TNavigate {{}}) - + IncludeMany {navigateSelector} 参数错误,Select lambda参数返回值必须和 {collMemElementType} 类型一致 - + IncludeMany 参数1 类型错误,表达式类型应该为 MemberAccess - + - IncludeMany {navigateSelector} 参数类型错误,正确格式: a.collections.Take(1).Where(c =>c.aid == a.id).Select(a=> new TNavigate{{}}) + IncludeMany {navigateSelector} 参数类型错误,正确格式: a.collections.Take(1).Where(c =&gt;c.aid == a.id).Select(a=&gt; new TNavigate{{}}) - + ISelect.InsertInto() 未选择属性: {displayCsharp} - + ISelect.InsertInto() 类型错误: {displayCsharp} - + InsertOrUpdate 功能执行 merge into 要求实体类 {CsName} 必须有主键 - + - InsertOrUpdate<>的泛型参数 不支持 {typeofT1},请传递您的实体类 + InsertOrUpdate&lt;&gt;的泛型参数 不支持 {typeofT1},请传递您的实体类 - + 【延时加载】功能需要安装 FreeSql.Extensions.LazyLoading.dll,可前往 nuget 下载 - + - 【延时加载】{trytbTypeName} 编译错误:{exMessage}\r\n\r\n{cscode} + 【延时加载】{trytbTypeName} 编译错误:{exMessage} - + 【延时加载】实体类型 {trytbTypeName} 必须声明为 public - + ManyToMany 导航属性 .AsSelect() 暂时不可用于 Sum/Avg/Max/Min/First/ToOne/ToList 方法 - + 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 在 {tbmidCsName} 中没有找到对应的字段,如:{midTypePropsTrytbName}{findtrytbPkCsName}、{midTypePropsTrytbName}_{findtrytbPkCsName} - + 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,实体类型 {tbrefTypeName} 缺少主键标识,[Column(IsPrimary = true)] - + 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,实体类型 {tbrefTypeName} 必须存在对应的 [Navigate(ManyToMany = x)] 集合属性 - + 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,{tbmidCsName}.{trycolCsName} 和 {trytbCsName}.{trytbPrimarysCsName} 类型不一致 - + 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,中间类 {tbmidCsName}.{midTypePropsTrytbName} 错误:{exMessage} - + 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,中间类 {tbmidCsName}.{midTypePropsTrytbName} 导航属性不是【ManyToOne】或【OneToOne】 - + 映射异常:{name} 没有一个属性名相同 - + Ado.MasterPool 值为 null,该操作无法自启用事务,请显式传递【事务对象】解决 - + 缺少 FreeSql 数据库实现包:FreeSql.Provider.{Provider}.dll,可前往 nuget 下载 - + 缺少 FreeSql 数据库实现包:{dll},可前往 nuget 下载;如果存在 {dll} 依然报错(原因是环境问题导致反射不到类型),请在 UseConnectionString/UseConnectionFactory 第三个参数手工传入 typeof({providerType}) - + 导航属性 {trytbTypeName}.{pnvName} 特性 [Navigate] Bind 数目({bindColumnsCount}) 与 外部主键数目({tbrefPrimarysLength}) 不相同 - + - {tb2DbName}.{mp2MemberName} 导航属性集合忘了 .AsSelect() 吗?如果在 ToList(a => a.{mp2MemberName}) 中使用,请移步参考 IncludeMany 文档。 + {tb2DbName}.{mp2MemberName} 导航属性集合忘了 .AsSelect() 吗?如果在 ToList(a =&gt; a.{mp2MemberName}) 中使用,请移步参考 IncludeMany 文档。 - + 【导航属性】{trytbTypeDisplayCsharp}.{pName} 缺少 set 属性 - + 导航属性 {trytbTypeName}.{pnvName} 没有找到对应的字段,如:{pnvName}{findtbrefPkCsName}、{pnvName}_{findtbrefPkCsName}。或者使用 [Navigate] 特性指定关系映射。 - + 导航属性 {trytbTypeName}.{pnvName} 解析错误,实体类型 {trytcTypeName} 缺少主键标识,[Column(IsPrimary = true)] - + 导航属性 {trytbTypeName}.{pnvName} 解析错误,{trytbCsName}.{trycolCsName} 和 {tbrefCsName}.{tbrefPrimarysCsName} 类型不一致 - + 导航属性 {trytbTypeName}.{pnvName} 特性 [Navigate] 解析错误,在 {tbrefTypeName} 未找到属性:{bi} - + {tableTypeDisplayCsharp} 没有定义主键,无法使用 SetSource,请尝试 SetDto 或者 SetSource 指定临时主键 - + 没有定义属性 - + 未实现 - + 未实现函数表达式 {exp} 解析 - + 未实现函数表达式 {exp} 解析,参数 {expArguments} 必须为常量 - + 未实现函数表达式 {exp} 解析,如果正在操作导航属性集合,请使用 .AsSelect().{exp3MethodName}({exp3ArgumentsCount}) - + 未实现 MemberAccess 下的 Constant - + 未实现 {name} - + 不支持 - + {dataType} 不支持 OrderByRandom 随机排序 - + {property} 不是有效的导航属性 - + {dbName} 找不到列 {memberName} - + 找不到 {CsName} 对应的列 - + 找不到属性:{memberName} - + 找不到属性名 {proto} - + Custom 找不到对应的{{ 反射信息 }}:{fiValueCustomArray} - + Custom 找不到对应的{{ 静态方法名 }}:{fiValueCustomArray} - + [Table(AsTable = xx)] 设置的属性名 {atmGroupsValue} 不存在 - + 未指定 UseConnectionString 或者 UseConnectionFactory - + 【{policyName}】ObjectPool.{GetName}() timeout {totalSeconds} seconds, see: https://github.com/dotnetcore/FreeSql/discussions/1081 - + 【{policyName}】ObjectPool.GetAsync() The queue is too long. Policy.AsyncGetCapacity = {asyncGetCapacity} - + 【OneToMany】导航属性 {trytbTypeName}.{pnvName} 在 {tbrefCsName} 中没有找到对应的字段,如:{findtrytb}{findtrytbPkCsName}、{findtrytb}_{findtrytbPkCsName} - + 【OneToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,{trytbCsName}.{trytbPrimarysCsName} 和 {tbrefCsName}.{trycolCsName} 类型不一致 - + 、{refpropName}{findtrytbPkCsName}、{refpropName}_{findtrytbPkCsName}。或者使用 [Navigate] 特性指定关系映射。 - + 参数 field 未指定 - + - {property} 参数错误,它不是集合属性,必须为 IList<T> 或者 ICollection<T> + {property} 参数错误,它不是集合属性,必须为 IList&lt;T&gt; 或者 ICollection&lt;T&gt; - + {property} 参数错误,它不是有效的导航属性 - + {where} 参数错误,{keyval} 不是有效的属性名,在实体类 {reftbTypeDisplayCsharp} 无法找到 - + {property} 参数错误,格式 "TopicId=Id,多组使用逗号连接" - + 解析失败 {callExpMethodName} {message} - + 【{policyName}】The ObjectPool has been disposed, see: https://github.com/dotnetcore/FreeSql/discussions/1079 - + 【{policyName}】状态不可用,等待后台检查程序恢复方可使用。{UnavailableExceptionMessage} - + 属性{trytbVersionColumnCsName} 被标注为行锁(乐观锁)(IsVersion),但其必须为数字类型 或者 byte[] 或者 string,并且不可为 Nullable - + properties 参数不能为空 - + {property} 属性名无法找到 - + Range 要求 Value 应该逗号分割,并且长度为 2 - + 回滚 - + 运行时错误,反射获取 IncludeMany 方法失败 - + - 蛋疼的 Access 插入只能一条一条执行,不支持 values(..),(..) 也不支持 select .. UNION ALL select .. + {qoteSql} is NULL,除非设置特性 [Column(IsNullable = false)] - + - BaseEntity.Initialization 初始化错误,获取到 IFreeSql 是 null + 分表字段值 "{dt}" 不能小于 "{beginTime} " - + - 【{thisName}】Block access and wait for recovery: {exMessage} + 分表字段值不能为 null - + - 无法将 IQueryable<{typeofName}> 转换为 ISelect<{typeofName}>,因为他的实现不是 FreeSql.Extensions.Linq.QueryableProvider + 分表字段值 "{columnValue}" 不能转化成 DateTime - + - 连接字符串错误 + 分表字段值 "{dt}" 未匹配到分表名 - + - 【{thisName}】连接字符串错误,请检查。 + T2 类型错误 - + - 连接字符串错误,或者检查项目属性 > 生成 > 目标平台:x86 | x64,或者改用 FreeSql.Provider.SqliteCore 访问 arm 平台 + tableName 格式错误,示例:“log_{yyyyMMdd}” - + - 【{thisName}】连接字符串错误,请检查。或者检查项目属性 > 生成 > 目标平台:x86 | x64,或者改用 FreeSql.Provider.SqliteCore 访问 arm 平台 + {Type}.AsType 参数错误,请传入正确的实体类型 - + - FreeSql.Provider.CustomAdapter 无法使用 CreateCommand + {thatFullName} 类型无法访问构造函数 - + - FreeSql.Provider.CustomAdapter 仅支持 UseConnectionFactory 方式构建 IFreeSql + {name} 类型错误 - + - 达梦 CodeFirst 不支持代码创建 tablespace 与 schemas {tbname} + {Type}.AsType 参数不支持指定为 object - + - -DB 参数错误,未提供 ConnectionString + 类型 {typeofFullName} 错误,不能使用 IncludeMany - + - -DB 参数错误,格式为:MySql,ConnectionString + 无法解析表达式:{exp} - + - -DB 参数错误,不支持的类型:"{dbargs}" + 无法解析表达式方法 {exp3tmpCallMethodName} - + - {method} 是 FreeSql.Provider.{provider} 特有的功能 + 请使用 fsql.InsertDict(dict) 方法插入字典数据 - + - fsql.InsertOrUpdate Sqlite 无法完成 UpdateColumns 操作 + 找不到 {name} - + - 主库 + 从库 - + - MygisGeometry.Parse 未实现 "{wkt}" + 主库 - + - -NameOptions 参数错误,格式为:0,0,0,0 + 蛋疼的 Access 插入只能一条一条执行,不支持 values(..),(..) 也不支持 select .. UNION ALL select .. - + - 未实现该功能 + BaseEntity.Initialization 初始化错误,获取到 IFreeSql 是 null - + - 未实现错误,请反馈给作者 + 【{thisName}】Block access and wait for recovery: {exMessage} - + - 找不到 {name} + 无法将 IQueryable&lt;{typeofName}&gt; 转换为 ISelect&lt;{typeofName}&gt;,因为他的实现不是 FreeSql.Extensions.Linq.QueryableProvider - + - FreeSql.Provider.{providerName} 未实现 Skip/Offset 功能,如果需要分页请使用判断上一次 id + 连接字符串错误 - + - 对象池 + 【{thisName}】连接字符串错误,请检查。 - + - 旧表(OldName):{tboldname} 存在,数据库已存在 {tbname} 表,无法改名 + 连接字符串错误,或者检查项目属性 &gt; 生成 &gt; 目标平台:x86 | x64,或者改用 FreeSql.Provider.SqliteCore 访问 arm 平台 - + - OnConflictDoUpdate 功能要求实体类必须设置 IsPrimary 属性 + 【{thisName}】连接字符串错误,请检查。或者检查项目属性 &gt; 生成 &gt; 目标平台:x86 | x64,或者改用 FreeSql.Provider.SqliteCore 访问 arm 平台 - + - Oracle CodeFirst 不支持代码创建 tablespace 与 schemas {tbname} + FreeSql.Provider.CustomAdapter 无法使用 CreateCommand - + - 解析失败 {callExpMethodName} {message},提示:可以使用扩展方法 IQueryable.RestoreToSelect() 还原为 ISelect 再查询 + FreeSql.Provider.CustomAdapter 仅支持 UseConnectionFactory 方式构建 IFreeSql - + - fsql.InsertOrUpdate + IfExistsDoNothing + {providerName}要求实体类 {tableCsName} 必须有主键 + 达梦 CodeFirst 不支持代码创建 tablespace 与 schemas {tbname} - + - SelectMany 错误的类型:{typeFullName} + -DB 参数错误,未提供 ConnectionString - + - 从库 + -DB 参数错误,格式为:MySql,ConnectionString - + - 类型 {objentityTypeFullName} 不可迁移 + -DB 参数错误,不支持的类型:"{dbargs}" - + - 类型 {objentityTypeFullName} 不可迁移,可迁移属性0个 + {method} 是 FreeSql.Provider.{provider} 特有的功能 - + - 未实现 {columnDbTypeTextFull} 类型映射 + fsql.InsertOrUpdate Sqlite 无法完成 UpdateColumns 操作 - + - 错误的参数设置:{args} + MygisGeometry.Parse 未实现 "{wkt}" - + - {qoteSql} is NULL,除非设置特性 [Column(IsNullable = false)] + -NameOptions 参数错误,格式为:0,0,0,0 - + - 分表字段值 "{dt}" 不能小于 "{beginTime} " + 未实现该功能 - + - 分表字段值不能为 null + 未实现错误,请反馈给作者 - + - 分表字段值 "{columnValue}" 不能转化成 DateTime + FreeSql.Provider.{providerName} 未实现 Skip/Offset 功能,如果需要分页请使用判断上一次 id - + - 分表字段值 "{dt}" 未匹配到分表名 + 旧表(OldName):{tboldname} 存在,数据库已存在 {tbname} 表,无法改名 - + - T2 类型错误 + OnConflictDoUpdate 功能要求实体类必须设置 IsPrimary 属性 - + - tableName 格式错误,示例:“log_{yyyyMMdd}” + Oracle CodeFirst 不支持代码创建 tablespace 与 schemas {tbname} - + - {Type}.AsType 参数错误,请传入正确的实体类型 + 解析失败 {callExpMethodName} {message},提示:可以使用扩展方法 IQueryable.RestoreToSelect() 还原为 ISelect 再查询 - + - {thatFullName} 类型无法访问构造函数 + fsql.InsertOrUpdate + IfExistsDoNothing + {providerName}要求实体类 {tableCsName} 必须有主键 - + - {name} 类型错误 + SelectMany 错误的类型:{typeFullName} - + - {Type}.AsType 参数不支持指定为 object + 类型 {objentityTypeFullName} 不可迁移 - + - 类型 {typeofFullName} 错误,不能使用 IncludeMany + 类型 {objentityTypeFullName} 不可迁移,可迁移属性0个 - + - 无法解析表达式:{exp} + 未实现 {columnDbTypeTextFull} 类型映射 - + - 无法解析表达式方法 {exp3tmpCallMethodName} + 错误的参数设置:{args} - + - 请使用 fsql.InsertDict(dict) 方法插入字典数据 + 对象池 diff --git a/FreeSql/FreeSqlBuilder.cs b/FreeSql/FreeSqlBuilder.cs index 2be1d2e59..6f5afd90a 100644 --- a/FreeSql/FreeSqlBuilder.cs +++ b/FreeSql/FreeSqlBuilder.cs @@ -45,7 +45,7 @@ public partial class FreeSqlBuilder /// public FreeSqlBuilder UseConnectionString(DataType dataType, string connectionString, Type providerType = null) { - if (_connectionFactory != null) throw new Exception(CoreStrings.Has_Specified_Cannot_Specified_Second("UseConnectionFactory", "UseConnectionString")); + if (_connectionFactory != null) throw new Exception(CoreErrorStrings.Has_Specified_Cannot_Specified_Second("UseConnectionFactory", "UseConnectionString")); _dataType = dataType; _masterConnectionString = connectionString; _providerType = providerType; @@ -86,13 +86,13 @@ public FreeSqlBuilder UseAdoConnectionPool(bool value) /// public FreeSqlBuilder UseSlave(params string[] slaveConnectionString) { - if (_connectionFactory != null) throw new Exception(CoreStrings.Has_Specified_Cannot_Specified_Second("UseConnectionFactory", "UseSlave")); + if (_connectionFactory != null) throw new Exception(CoreErrorStrings.Has_Specified_Cannot_Specified_Second("UseConnectionFactory", "UseSlave")); _slaveConnectionString = slaveConnectionString; return this; } public FreeSqlBuilder UseSlaveWeight(params int[] slaveWeights) { - if (_slaveConnectionString?.Length != slaveWeights.Length) throw new Exception(CoreStrings.Different_Number_SlaveConnectionString_SlaveWeights); + if (_slaveConnectionString?.Length != slaveWeights.Length) throw new Exception(CoreErrorStrings.Different_Number_SlaveConnectionString_SlaveWeights); _slaveWeights = slaveWeights; return this; } @@ -105,8 +105,8 @@ public FreeSqlBuilder UseSlaveWeight(params int[] slaveWeights) /// public FreeSqlBuilder UseConnectionFactory(DataType dataType, Func connectionFactory, Type providerType = null) { - if (string.IsNullOrEmpty(_masterConnectionString) == false) throw new Exception(CoreStrings.Has_Specified_Cannot_Specified_Second("UseConnectionString", "UseConnectionFactory")); - if (_slaveConnectionString?.Any() == true) throw new Exception(CoreStrings.Has_Specified_Cannot_Specified_Second("UseSlave", "UseConnectionFactory")); + if (string.IsNullOrEmpty(_masterConnectionString) == false) throw new Exception(CoreErrorStrings.Has_Specified_Cannot_Specified_Second("UseConnectionString", "UseConnectionFactory")); + if (_slaveConnectionString?.Any() == true) throw new Exception(CoreErrorStrings.Has_Specified_Cannot_Specified_Second("UseSlave", "UseConnectionFactory")); _dataType = dataType; _connectionFactory = connectionFactory; _providerType = providerType; @@ -244,7 +244,7 @@ public FreeSqlBuilder UseExitAutoDisposePool(bool value) public IFreeSql Build() => Build(); public IFreeSql Build() { - if (string.IsNullOrEmpty(_masterConnectionString) && _connectionFactory == null) throw new Exception(CoreStrings.Check_UseConnectionString); + if (string.IsNullOrEmpty(_masterConnectionString) && _connectionFactory == null) throw new Exception(CoreErrorStrings.Check_UseConnectionString); IFreeSql ret = null; var type = _providerType; if (type != null) @@ -254,7 +254,7 @@ public IFreeSql Build() } else { - Action throwNotFind = (dll, providerType) => throw new Exception(CoreStrings.Missing_FreeSqlProvider_Package_Reason(dll, providerType)); + Action throwNotFind = (dll, providerType) => throw new Exception(CoreErrorStrings.Missing_FreeSqlProvider_Package_Reason(dll, providerType)); switch (_dataType) { case DataType.MySql: @@ -385,7 +385,7 @@ public IFreeSql Build() if (type == null) throwNotFind("FreeSql.Provider.Duckdb.dll", "FreeSql.Duckdb.DuckdbProvider<>"); break; - default: throw new Exception(CoreStrings.NotSpecified_UseConnectionString_UseConnectionFactory); + default: throw new Exception(CoreErrorStrings.NotSpecified_UseConnectionString_UseConnectionFactory); } } ret = Activator.CreateInstance(type, new object[] diff --git a/FreeSql/Internal/CommonExpression.cs b/FreeSql/Internal/CommonExpression.cs index 8181b067e..33774c440 100644 --- a/FreeSql/Internal/CommonExpression.cs +++ b/FreeSql/Internal/CommonExpression.cs @@ -436,7 +436,7 @@ void LocalSetFieldAlias(ref int localIndex, bool isdiymemexp) ReadAnonymousField(_tables, _tableRule, field, child, ref index, initAssignExp.Expression, select, diymemexp, whereGlobalFilter, findIncludeMany, findSubSelectMany, false); } } - if (parent.Childs.Any() == false) throw new Exception(CoreStrings.Mapping_Exception_HasNo_SamePropertyName(initExp.NewExpression.Type.Name)); + if (parent.Childs.Any() == false) throw new Exception(CoreErrorStrings.Mapping_Exception_HasNo_SamePropertyName(initExp.NewExpression.Type.Name)); return true; case ExpressionType.New: var newExp = exp as NewExpression; @@ -548,7 +548,7 @@ void LocalSetFieldAlias(ref int localIndex, bool isdiymemexp) } } } - if (parent.Childs.Any() == false) throw new Exception(CoreStrings.Mapping_Exception_HasNo_SamePropertyName(newExp.Type.Name)); + if (parent.Childs.Any() == false) throw new Exception(CoreErrorStrings.Mapping_Exception_HasNo_SamePropertyName(newExp.Type.Name)); return true; } parent.DbField = ExpressionLambdaToSql(exp, getTSC()); //解决 new { a = id + 1 } 翻译后 ((id+1)) 问题 @@ -676,7 +676,7 @@ public string[] ExpressionSelectColumns_MemberAccess_New_NewArrayInit(List(); foreach (var newArrExp in newArr.Expressions) newArrMembers.AddRange(ExpressionSelectColumns_MemberAccess_New_NewArrayInit(_tables, _tableRule, newArrExp, isQuoteName, diymemexp)); return newArrMembers.Distinct().Select(a => a.Trim('\'')).ToArray(); - default: throw new ArgumentException(CoreStrings.Unable_Parse_Expression(exp)); + default: throw new ArgumentException(CoreErrorStrings.Unable_Parse_Expression(exp)); } return new string[0]; } @@ -1126,7 +1126,7 @@ public string ExpressionLambdaToSql(Expression exp, ExpTSC tsc) var eccFields = _dicTypeExpressionCallClassContextFields.GetOrAdd(exp3.Method.DeclaringType, dttp => dttp.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.Static).Where(a => a.FieldType == typeof(ThreadLocal)).ToArray()); if (eccFields.Any() == false) - throw new Exception(CoreStrings.Custom_Expression_ParsingError(exp3.Method.DeclaringType)); + throw new Exception(CoreErrorStrings.Custom_Expression_ParsingError(exp3.Method.DeclaringType)); foreach (var eccField in eccFields) typeof(ThreadLocal).GetProperty("Value").SetValue(eccField.GetValue(null), ecc, null); try @@ -1150,7 +1150,7 @@ public string ExpressionLambdaToSql(Expression exp, ExpTSC tsc) case "System.String": other3Exp = ExpressionLambdaToSqlCallString(exp3, tsc); break; case "System.Math": other3Exp = ExpressionLambdaToSqlCallMath(exp3, tsc); break; case "System.DateTime": other3Exp = ExpressionLambdaToSqlCallDateTime(exp3, tsc); break; - case "System.TimeSpan": throw new Exception(CoreStrings.Unable_Parse_ExpressionMethod(callType.FullName)); + case "System.TimeSpan": throw new Exception(CoreErrorStrings.Unable_Parse_ExpressionMethod(callType.FullName)); case "System.Convert": other3Exp = ExpressionLambdaToSqlCallConvert(exp3, tsc); break; } if (string.IsNullOrEmpty(other3Exp) == false) return other3Exp; @@ -1315,7 +1315,7 @@ public string ExpressionLambdaToSql(Expression exp, ExpTSC tsc) fsql = Expression.Lambda(exp3tmpTestCall).Compile().DynamicInvoke(); var fsqlFindMethod = fsql.GetType().GetMethod(exp3tmpCall.Method.Name, exp3tmpCall.Arguments.Select(a => a.Type).ToArray()); if (fsqlFindMethod == null) - throw new Exception(CoreStrings.Unable_Parse_ExpressionMethod(exp3tmpCall.Method.Name)); + throw new Exception(CoreErrorStrings.Unable_Parse_ExpressionMethod(exp3tmpCall.Method.Name)); var exp3StackOld = exp3Stack; exp3Stack = new Stack(); exp3Stack.Push(Expression.Call(Expression.Constant(fsql), fsqlFindMethod, exp3tmpCall.Arguments)); @@ -1353,7 +1353,7 @@ public string ExpressionLambdaToSql(Expression exp, ExpTSC tsc) //fsqltables[0].Alias = $"{tsc._tables[0].Alias}_{fsqltables[0].Alias}"; if (fsqltables != tsc._tables) { - if (tsc._tables == null && tsc.diymemexp == null) throw new NotSupportedException(CoreStrings.EspeciallySubquery_Cannot_Parsing); //2020-12-11 IUpdate 条件不支持子查询 + if (tsc._tables == null && tsc.diymemexp == null) throw new NotSupportedException(CoreErrorStrings.EspeciallySubquery_Cannot_Parsing); //2020-12-11 IUpdate 条件不支持子查询 if (tsc._tables != null) //groupby is null { fsqltables.AddRange(tsc._tables.Select(a => new SelectTableInfo @@ -1655,7 +1655,7 @@ public string ExpressionLambdaToSql(Expression exp, ExpTSC tsc) var exp3Args0 = (exp3.Arguments[0] as UnaryExpression)?.Operand as LambdaExpression; manySubSelectAggMethod = _dicSelectMethodToSql.GetOrAdd(fsqlType, fsqlType2 => fsqlType2.GetMethods().Where(a => a.Name == "ToSql" && a.GetParameters().Length == 2 && a.GetParameters()[1].ParameterType == typeof(FieldAliasOptions) && a.GetGenericArguments().Length == 1).FirstOrDefault()); - if (manySubSelectAggMethod == null || exp3Args0 == null) throw new ArgumentException(CoreStrings.ManyToMany_AsSelect_NotSupport_Sum_Avg_etc); + if (manySubSelectAggMethod == null || exp3Args0 == null) throw new ArgumentException(CoreErrorStrings.ManyToMany_AsSelect_NotSupport_Sum_Avg_etc); manySubSelectAggMethod = manySubSelectAggMethod.MakeGenericMethod(exp3Args0.ReturnType); var fsqls0p = fsql as Select0Provider; var fsqls0pWhere = fsqls0p._where.ToString(); @@ -1821,8 +1821,8 @@ public string ExpressionLambdaToSql(Expression exp, ExpTSC tsc) other3Exp = ExpressionLambdaToSqlOther(exp3, tsc); if (string.IsNullOrEmpty(other3Exp) == false) return other3Exp; if (exp3.CanDynamicInvoke()) return formatSql(Expression.Lambda(exp3).Compile().DynamicInvoke(), tsc.mapType, tsc.mapColumnTmp, tsc.dbParams); - if (exp3.Method.DeclaringType == typeof(Enumerable)) throw new Exception(CoreStrings.Not_Implemented_Expression_UseAsSelect(exp3, exp3.Method.Name, (exp3.Arguments.Count > 1 ? "..." : ""))); - throw new Exception(CoreStrings.Not_Implemented_Expression(exp3)); + if (exp3.Method.DeclaringType == typeof(Enumerable)) throw new Exception(CoreErrorStrings.Not_Implemented_Expression_UseAsSelect(exp3, exp3.Method.Name, (exp3.Arguments.Count > 1 ? "..." : ""))); + throw new Exception(CoreErrorStrings.Not_Implemented_Expression(exp3)); case ExpressionType.Parameter: case ExpressionType.MemberAccess: var exp4 = exp as MemberExpression; @@ -1859,7 +1859,7 @@ exp4.Expression is MethodCallExpression exp4CallExp && case "TotalSeconds": return $"({left})"; } } - throw new Exception(CoreStrings.Unable_Parse_Expression(exp4)); + throw new Exception(CoreErrorStrings.Unable_Parse_Expression(exp4)); } if (string.IsNullOrEmpty(extRet) == false) return extRet; var other4Exp = ExpressionLambdaToSqlOther(exp4, tsc); @@ -1935,7 +1935,7 @@ exp4.Expression is MethodCallExpression exp4CallExp && } while (expStack.Any()) { - if (firstValue == null) throw new Exception(CoreStrings.Cannot_Be_NULL_Name(exp)); + if (firstValue == null) throw new Exception(CoreErrorStrings.Cannot_Be_NULL_Name(exp)); var expStackItem = expStack.Pop() as MemberExpression; if (expStackItem.Member.MemberType == MemberTypes.Property) firstValue = ((PropertyInfo)expStackItem.Member).GetValue(firstValue, null); @@ -1982,8 +1982,8 @@ exp4.Expression is MethodCallExpression exp4CallExp && if (tb.ColumnsByCs.ContainsKey(memberExp.Member.Name) == false) { if (tb.ColumnsByCsIgnore.ContainsKey(memberExp.Member.Name)) - throw new ArgumentException(CoreStrings.Ignored_Check_Confirm_PublicGetSet(tb.DbName, memberExp.Member.Name)); - throw new ArgumentException(CoreStrings.NotFound_Column(tb.DbName, memberExp.Member.Name)); + throw new ArgumentException(CoreErrorStrings.Ignored_Check_Confirm_PublicGetSet(tb.DbName, memberExp.Member.Name)); + throw new ArgumentException(CoreErrorStrings.NotFound_Column(tb.DbName, memberExp.Member.Name)); } var curcol = tb.ColumnsByCs[memberExp.Member.Name]; if (tsc._selectColumnMap != null) @@ -2111,7 +2111,7 @@ exp4.Expression is MethodCallExpression exp4CallExp && switch (exp2.NodeType) { case ExpressionType.Constant: - throw new NotImplementedException($"{CoreStrings.Not_Implemented_MemberAcess_Constant}"); + throw new NotImplementedException($"{CoreErrorStrings.Not_Implemented_MemberAcess_Constant}"); case ExpressionType.Parameter: case ExpressionType.MemberAccess: @@ -2130,7 +2130,7 @@ exp4.Expression is MethodCallExpression exp4CallExp && } name2 = col2.Attribute.Name; tsc.SetMapColumnTmp(col2); - if (expStack.Count > 0) throw new Exception(CoreStrings.Unable_Parse_Expression(expStack.Pop())); + if (expStack.Count > 0) throw new Exception(CoreErrorStrings.Unable_Parse_Expression(expStack.Pop())); break; } //判断 [JsonMap] 并非导航对象,所以在上面提前判断 ColumnsByCs @@ -2183,10 +2183,10 @@ exp4.Expression is MethodCallExpression exp4CallExp && } } if (tb2.ColumnsByCsIgnore.ContainsKey(mp2.Member.Name)) - throw new ArgumentException(CoreStrings.Ignored_Check_Confirm_PublicGetSet(tb2.DbName, mp2.Member.Name)); + throw new ArgumentException(CoreErrorStrings.Ignored_Check_Confirm_PublicGetSet(tb2.DbName, mp2.Member.Name)); if (tb2.GetTableRef(mp2.Member.Name, false, true) != null) - throw new ArgumentException(CoreStrings.Navigation_Missing_AsSelect(tb2.DbName, mp2.Member.Name)); - throw new ArgumentException(CoreStrings.NotFound_Column(tb2.DbName, mp2.Member.Name)); + throw new ArgumentException(CoreErrorStrings.Navigation_Missing_AsSelect(tb2.DbName, mp2.Member.Name)); + throw new ArgumentException(CoreErrorStrings.NotFound_Column(tb2.DbName, mp2.Member.Name)); } col2 = tb2.ColumnsByCs[mp2.Member.Name]; if (tsc._selectColumnMap != null && find2 != null) @@ -3010,7 +3010,7 @@ void LocalInitSelectProvider() e.Result = $"({select.ToSql().Replace(" \r\n", " \r\n ")})"; return; } - throw throwCallExp(CoreStrings.Not_Support); + throw throwCallExp(CoreErrorStrings.Not_Support); case "ToList": if (callExp.Arguments.Count == 1) { @@ -3019,7 +3019,7 @@ void LocalInitSelectProvider() e.Result = $"({select.ToSql().Replace(" \r\n", " \r\n ")})"; return; } - throw throwCallExp(CoreStrings.Not_Support); + throw throwCallExp(CoreErrorStrings.Not_Support); case "Contains": if (callExp.Arguments.Count == 2) { @@ -3037,7 +3037,7 @@ void LocalInitSelectProvider() select.Distinct(); break; } - throw throwCallExp(CoreStrings.Not_Support); + throw throwCallExp(CoreErrorStrings.Not_Support); case "OrderBy": select._tables[0].Parameter = (callExp.Arguments[1] as LambdaExpression)?.Parameters.FirstOrDefault(); LocalSetSelectProviderAlias(select._tables[0].Parameter.Name); @@ -3068,7 +3068,7 @@ void LocalInitSelectProvider() select.InternalWhere(whereParam); break; } - throw throwCallExp(CoreStrings.Not_Support); + throw throwCallExp(CoreErrorStrings.Not_Support); case "Skip": select.Offset((int)callExp.Arguments[1].GetConstExprValue()); @@ -3086,9 +3086,9 @@ void LocalInitSelectProvider() select._selectExpression = selectParam; break; } - throw throwCallExp(CoreStrings.Not_Support); + throw throwCallExp(CoreErrorStrings.Not_Support); } - Exception throwCallExp(string message) => new Exception(CoreStrings.Parsing_Failed(callExp.Method.Name, message)); + Exception throwCallExp(string message) => new Exception(CoreErrorStrings.Parsing_Failed(callExp.Method.Name, message)); } } } diff --git a/FreeSql/Internal/CommonProvider/AdoProvider/AdoProvider.cs b/FreeSql/Internal/CommonProvider/AdoProvider/AdoProvider.cs index 4446d93cf..8a0b0d2e6 100644 --- a/FreeSql/Internal/CommonProvider/AdoProvider/AdoProvider.cs +++ b/FreeSql/Internal/CommonProvider/AdoProvider/AdoProvider.cs @@ -654,7 +654,7 @@ public void ExecuteReaderMultiple(int multipleResult, DbConnection connection, D ReturnConnection(pool, conn, ex); //pool.Return(conn, ex); if (IsTracePerformance) logtxt.Append("Pool.Return: ").Append(DateTime.Now.Subtract(logtxt_dt).TotalMilliseconds).Append("ms Total: ").Append(DateTime.Now.Subtract(dt).TotalMilliseconds).Append("ms"); } - LoggerException(pool, pc, new Exception(CoreStrings.Connection_Failed_Switch_Servers), dt, logtxt, false); + LoggerException(pool, pc, new Exception(CoreErrorStrings.Connection_Failed_Switch_Servers), dt, logtxt, false); pc.cmd.Parameters.Clear(); if (DataType == DataType.Sqlite) pc.cmd.Dispose(); ExecuteReaderMultiple(multipleResult, connection, transaction, fetchHandler, schemaHandler, cmdType, cmdText, cmdTimeout, cmdParms); diff --git a/FreeSql/Internal/CommonProvider/AdoProvider/AdoProviderAsync.cs b/FreeSql/Internal/CommonProvider/AdoProvider/AdoProviderAsync.cs index da8a25489..80c862fda 100644 --- a/FreeSql/Internal/CommonProvider/AdoProvider/AdoProviderAsync.cs +++ b/FreeSql/Internal/CommonProvider/AdoProvider/AdoProviderAsync.cs @@ -574,7 +574,7 @@ async public Task ExecuteReaderMultipleAsync(int multipleResult, DbConnection co ReturnConnection(pool, conn, ex); //pool.Return(conn, ex); if (IsTracePerformance) logtxt.Append("Pool.Return: ").Append(DateTime.Now.Subtract(logtxt_dt).TotalMilliseconds).Append("ms Total: ").Append(DateTime.Now.Subtract(dt).TotalMilliseconds).Append("ms"); } - LoggerException(pool, pc, new Exception(CoreStrings.Connection_Failed_Switch_Servers), dt, logtxt, false); + LoggerException(pool, pc, new Exception(CoreErrorStrings.Connection_Failed_Switch_Servers), dt, logtxt, false); pc.cmd.Parameters.Clear(); if (DataType == DataType.Sqlite) pc.cmd.Dispose(); await ExecuteReaderMultipleAsync(multipleResult, connection, transaction, fetchHandler, schemaHandler, cmdType, cmdText, cmdTimeout, cmdParms, cancellationToken); diff --git a/FreeSql/Internal/CommonProvider/AdoProvider/AdoProviderTransaction.cs b/FreeSql/Internal/CommonProvider/AdoProvider/AdoProviderTransaction.cs index e87abc329..86bc8d02d 100644 --- a/FreeSql/Internal/CommonProvider/AdoProvider/AdoProviderTransaction.cs +++ b/FreeSql/Internal/CommonProvider/AdoProvider/AdoProviderTransaction.cs @@ -78,7 +78,7 @@ private void CommitTransaction(bool isCommit, Transaction2 tran, Exception rollb _trans.TryRemove(tran.Connection.LastGetThreadId, out var oldtran); Exception ex = null; - if (string.IsNullOrEmpty(remark)) remark = isCommit ? CoreStrings.Commit : CoreStrings.RollBack; + if (string.IsNullOrEmpty(remark)) remark = isCommit ? CoreErrorStrings.Commit : CoreErrorStrings.RollBack; try { if (tran.Transaction.Connection != null) //用户自行 Commit、Rollback diff --git a/FreeSql/Internal/CommonProvider/BaseDbProvider.cs b/FreeSql/Internal/CommonProvider/BaseDbProvider.cs index f7e77bc20..22b77a066 100644 --- a/FreeSql/Internal/CommonProvider/BaseDbProvider.cs +++ b/FreeSql/Internal/CommonProvider/BaseDbProvider.cs @@ -18,23 +18,23 @@ public abstract partial class BaseDbProvider : IFreeSql public IInsert Insert() where T1 : class => CreateInsertProvider(); public IInsert Insert(T1 source) where T1 : class { - if (typeof(T1) == typeof(Dictionary)) throw new Exception(CoreStrings.Use_InsertDict_Method); + if (typeof(T1) == typeof(Dictionary)) throw new Exception(CoreErrorStrings.Use_InsertDict_Method); return this.Insert().AppendData(source); } public IInsert Insert(T1[] source) where T1 : class { - if (typeof(T1) == typeof(Dictionary)) throw new Exception(CoreStrings.Use_InsertDict_Method); + if (typeof(T1) == typeof(Dictionary)) throw new Exception(CoreErrorStrings.Use_InsertDict_Method); return this.Insert().AppendData(source); } public IInsert Insert(List source) where T1 : class { - if (typeof(T1) == typeof(Dictionary)) throw new Exception(CoreStrings.Use_InsertDict_Method); + if (typeof(T1) == typeof(Dictionary)) throw new Exception(CoreErrorStrings.Use_InsertDict_Method); return this.Insert().AppendData(source); } public IInsert Insert(IEnumerable source) where T1 : class { - if (typeof(T1) == typeof(Dictionary)) throw new Exception(CoreStrings.Use_InsertDict_Method); + if (typeof(T1) == typeof(Dictionary)) throw new Exception(CoreErrorStrings.Use_InsertDict_Method); return this.Insert().AppendData(source); } public IUpdate Update() where T1 : class => CreateUpdateProvider(null); diff --git a/FreeSql/Internal/CommonProvider/DeleteProvider.cs b/FreeSql/Internal/CommonProvider/DeleteProvider.cs index ad4517e37..063317198 100644 --- a/FreeSql/Internal/CommonProvider/DeleteProvider.cs +++ b/FreeSql/Internal/CommonProvider/DeleteProvider.cs @@ -176,10 +176,10 @@ public IDelete AsTable(string tableName) } public IDelete AsType(Type entityType) { - if (entityType == typeof(object)) throw new Exception(CoreStrings.TypeAsType_NotSupport_Object("IDelete")); + if (entityType == typeof(object)) throw new Exception(CoreErrorStrings.TypeAsType_NotSupport_Object("IDelete")); if (entityType == _table.Type) return this; var newtb = _commonUtils.GetTableByEntity(entityType); - _table = newtb ?? throw new Exception(CoreStrings.Type_AsType_Parameter_Error("IDelete")); + _table = newtb ?? throw new Exception(CoreErrorStrings.Type_AsType_Parameter_Error("IDelete")); if (_isAutoSyncStructure) _orm.CodeFirst.SyncStructure(entityType); return this; } diff --git a/FreeSql/Internal/CommonProvider/InsertOrUpdateProvider.cs b/FreeSql/Internal/CommonProvider/InsertOrUpdateProvider.cs index c33929429..736eba535 100644 --- a/FreeSql/Internal/CommonProvider/InsertOrUpdateProvider.cs +++ b/FreeSql/Internal/CommonProvider/InsertOrUpdateProvider.cs @@ -51,7 +51,7 @@ public InsertOrUpdateProvider(IFreeSql orm, CommonUtils commonUtils, CommonExpre _isAutoSyncStructure = _orm.CodeFirst.IsAutoSyncStructure; _tempPrimarys = _table?.Primarys ?? new ColumnInfo[0]; if (_table == null && typeof(T1) != typeof(Dictionary)) - throw new Exception(CoreStrings.InsertOrUpdate_NotSuport_Generic_UseEntity(typeof(T1))); + throw new Exception(CoreErrorStrings.InsertOrUpdate_NotSuport_Generic_UseEntity(typeof(T1))); if (_isAutoSyncStructure && typeof(T1) != typeof(object)) _orm.CodeFirst.SyncStructure(); IdentityColumn = _table?.Primarys.Where(a => a.Attribute.IsIdentity).FirstOrDefault(); } @@ -157,7 +157,7 @@ public static void AuditDataValue(object sender, T1 data, IFreeSql orm, TableInf { if (data == null || table == null) return; if (typeof(T1) == typeof(object) && new[] { table.Type, table.TypeLazy }.Contains(data.GetType()) == false) - throw new Exception(CoreStrings.DataType_AsType_Inconsistent(data.GetType().DisplayCsharp(), table.Type.DisplayCsharp())); + throw new Exception(CoreErrorStrings.DataType_AsType_Inconsistent(data.GetType().DisplayCsharp(), table.Type.DisplayCsharp())); if (orm.Aop.AuditValueHandler == null) return; foreach (var col in table.Columns.Values) { @@ -256,10 +256,10 @@ public IInsertOrUpdate AsTable(string tableName) } public IInsertOrUpdate AsType(Type entityType) { - if (entityType == typeof(object)) throw new Exception(CoreStrings.TypeAsType_NotSupport_Object("IInsertOrUpdate")); + if (entityType == typeof(object)) throw new Exception(CoreErrorStrings.TypeAsType_NotSupport_Object("IInsertOrUpdate")); if (entityType == _table.Type) return this; var newtb = _commonUtils.GetTableByEntity(entityType); - _table = newtb ?? throw new Exception(CoreStrings.Type_AsType_Parameter_Error("IInsertOrUpdate")); + _table = newtb ?? throw new Exception(CoreErrorStrings.Type_AsType_Parameter_Error("IInsertOrUpdate")); if (_isAutoSyncStructure) _orm.CodeFirst.SyncStructure(entityType); _tempPrimarys = _table.Primarys; if (_orm.CodeFirst.IsAutoSyncStructure) _orm.CodeFirst.SyncStructure(entityType); @@ -414,12 +414,12 @@ void ExecuteBatchOptions(List[] splitedSource) _SplitSourceByIdentityValueIsNullFlag = 2; ExecuteBatchOptions(ss.Item2); _transaction.Commit(); - _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.Commit, null)); + _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreErrorStrings.Commit, null)); } catch (Exception ex) { _transaction.Rollback(); - _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.RollBack, ex)); + _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreErrorStrings.RollBack, ex)); throw; } _transaction = null; @@ -540,12 +540,12 @@ async Task ExecuteBatchOptions(List[] splitedSource) _SplitSourceByIdentityValueIsNullFlag = 2; await ExecuteBatchOptions(ss.Item2); _transaction.Commit(); - _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.Commit, null)); + _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreErrorStrings.Commit, null)); } catch (Exception ex) { _transaction.Rollback(); - _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.RollBack, ex)); + _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreErrorStrings.RollBack, ex)); throw; } _transaction = null; diff --git a/FreeSql/Internal/CommonProvider/InsertProvider.cs b/FreeSql/Internal/CommonProvider/InsertProvider.cs index ab166af62..c099faa59 100644 --- a/FreeSql/Internal/CommonProvider/InsertProvider.cs +++ b/FreeSql/Internal/CommonProvider/InsertProvider.cs @@ -164,7 +164,7 @@ public static void AuditDataValue(object sender, T1 data, IFreeSql orm, TableInf { if (data == null || table == null) return; if (typeof(T1) == typeof(object) && new[] { table.Type, table.TypeLazy }.Contains(data.GetType()) == false) - throw new Exception(CoreStrings.DataType_AsType_Inconsistent(data.GetType().DisplayCsharp(), table.Type.DisplayCsharp())); + throw new Exception(CoreErrorStrings.DataType_AsType_Inconsistent(data.GetType().DisplayCsharp(), table.Type.DisplayCsharp())); foreach (var col in table.Columns.Values) { object val = col.GetValue(data); @@ -297,7 +297,7 @@ protected virtual int SplitExecuteAffrows(int valuesLimit, int parameterLimit) } else { - if (_orm.Ado.MasterPool == null) throw new Exception(CoreStrings.MasterPool_IsNull_UseTransaction); + if (_orm.Ado.MasterPool == null) throw new Exception(CoreErrorStrings.MasterPool_IsNull_UseTransaction); using (var conn = _orm.Ado.MasterPool.Get()) { _transaction = conn.Value.BeginTransaction(); @@ -312,12 +312,12 @@ protected virtual int SplitExecuteAffrows(int valuesLimit, int parameterLimit) ret += this.RawExecuteAffrows(); } _transaction.Commit(); - _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.Commit, null)); + _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreErrorStrings.Commit, null)); } catch (Exception ex) { _transaction.Rollback(); - _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.RollBack, ex)); + _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreErrorStrings.RollBack, ex)); throw; } _transaction = null; @@ -377,7 +377,7 @@ protected long SplitExecuteIdentity(int valuesLimit, int parameterLimit) } else { - if (_orm.Ado.MasterPool == null) throw new Exception(CoreStrings.MasterPool_IsNull_UseTransaction); + if (_orm.Ado.MasterPool == null) throw new Exception(CoreErrorStrings.MasterPool_IsNull_UseTransaction); using (var conn = _orm.Ado.MasterPool.Get()) { _transaction = conn.Value.BeginTransaction(); @@ -393,12 +393,12 @@ protected long SplitExecuteIdentity(int valuesLimit, int parameterLimit) else ret = this.RawExecuteIdentity(); } _transaction.Commit(); - _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.Commit, null)); + _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreErrorStrings.Commit, null)); } catch (Exception ex) { _transaction.Rollback(); - _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.RollBack, ex)); + _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreErrorStrings.RollBack, ex)); throw; } _transaction = null; @@ -457,7 +457,7 @@ protected List SplitExecuteInserted(int valuesLimit, int parameterLimit) } else { - if (_orm.Ado.MasterPool == null) throw new Exception(CoreStrings.MasterPool_IsNull_UseTransaction); + if (_orm.Ado.MasterPool == null) throw new Exception(CoreErrorStrings.MasterPool_IsNull_UseTransaction); using (var conn = _orm.Ado.MasterPool.Get()) { _transaction = conn.Value.BeginTransaction(); @@ -472,12 +472,12 @@ protected List SplitExecuteInserted(int valuesLimit, int parameterLimit) ret.AddRange(this.RawExecuteInserted()); } _transaction.Commit(); - _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.Commit, null)); + _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreErrorStrings.Commit, null)); } catch (Exception ex) { _transaction.Rollback(); - _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.RollBack, ex)); + _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreErrorStrings.RollBack, ex)); throw; } _transaction = null; @@ -597,11 +597,11 @@ public IInsert AsTable(string tableName) } public IInsert AsType(Type entityType) { - if (entityType == typeof(object)) throw new Exception(CoreStrings.TypeAsType_NotSupport_Object("IInsert")); + if (entityType == typeof(object)) throw new Exception(CoreErrorStrings.TypeAsType_NotSupport_Object("IInsert")); if (entityType == typeof(T1)) return this; if (entityType == _table.Type) return this; var newtb = _commonUtils.GetTableByEntity(entityType); - _table = newtb ?? throw new Exception(CoreStrings.Type_AsType_Parameter_Error("IInsert")); + _table = newtb ?? throw new Exception(CoreErrorStrings.Type_AsType_Parameter_Error("IInsert")); if (_isAutoSyncStructure) _orm.CodeFirst.SyncStructure(entityType); IgnoreCanInsert(); return this; diff --git a/FreeSql/Internal/CommonProvider/InsertProviderAsync.cs b/FreeSql/Internal/CommonProvider/InsertProviderAsync.cs index 54b94b275..d997d3676 100644 --- a/FreeSql/Internal/CommonProvider/InsertProviderAsync.cs +++ b/FreeSql/Internal/CommonProvider/InsertProviderAsync.cs @@ -55,7 +55,7 @@ async protected virtual Task SplitExecuteAffrowsAsync(int valuesLimit, int } else { - if (_orm.Ado.MasterPool == null) throw new Exception(CoreStrings.MasterPool_IsNull_UseTransaction); + if (_orm.Ado.MasterPool == null) throw new Exception(CoreErrorStrings.MasterPool_IsNull_UseTransaction); using (var conn = await _orm.Ado.MasterPool.GetAsync()) { _transaction = conn.Value.BeginTransaction(); @@ -70,12 +70,12 @@ async protected virtual Task SplitExecuteAffrowsAsync(int valuesLimit, int ret += await this.RawExecuteAffrowsAsync(cancellationToken); } _transaction.Commit(); - _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.Commit, null)); + _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreErrorStrings.Commit, null)); } catch (Exception ex) { _transaction.Rollback(); - _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.RollBack, ex)); + _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreErrorStrings.RollBack, ex)); throw; } _transaction = null; @@ -135,7 +135,7 @@ async protected virtual Task SplitExecuteIdentityAsync(int valuesLimit, in } else { - if (_orm.Ado.MasterPool == null) throw new Exception(CoreStrings.MasterPool_IsNull_UseTransaction); + if (_orm.Ado.MasterPool == null) throw new Exception(CoreErrorStrings.MasterPool_IsNull_UseTransaction); using (var conn = await _orm.Ado.MasterPool.GetAsync()) { _transaction = conn.Value.BeginTransaction(); @@ -151,12 +151,12 @@ async protected virtual Task SplitExecuteIdentityAsync(int valuesLimit, in else ret = await this.RawExecuteIdentityAsync(cancellationToken); } _transaction.Commit(); - _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.Commit, null)); + _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreErrorStrings.Commit, null)); } catch (Exception ex) { _transaction.Rollback(); - _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.RollBack, ex)); + _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreErrorStrings.RollBack, ex)); throw; } _transaction = null; @@ -215,7 +215,7 @@ async protected virtual Task> SplitExecuteInsertedAsync(int valuesLimit } else { - if (_orm.Ado.MasterPool == null) throw new Exception(CoreStrings.MasterPool_IsNull_UseTransaction); + if (_orm.Ado.MasterPool == null) throw new Exception(CoreErrorStrings.MasterPool_IsNull_UseTransaction); using (var conn = await _orm.Ado.MasterPool.GetAsync()) { _transaction = conn.Value.BeginTransaction(); @@ -230,12 +230,12 @@ async protected virtual Task> SplitExecuteInsertedAsync(int valuesLimit ret.AddRange(await this.RawExecuteInsertedAsync(cancellationToken)); } _transaction.Commit(); - _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.Commit, null)); + _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreErrorStrings.Commit, null)); } catch (Exception ex) { _transaction.Rollback(); - _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.RollBack, ex)); + _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreErrorStrings.RollBack, ex)); throw; } _transaction = null; diff --git a/FreeSql/Internal/CommonProvider/SelectProvider/Select0Provider.cs b/FreeSql/Internal/CommonProvider/SelectProvider/Select0Provider.cs index 33ce90c41..1d65a44ca 100644 --- a/FreeSql/Internal/CommonProvider/SelectProvider/Select0Provider.cs +++ b/FreeSql/Internal/CommonProvider/SelectProvider/Select0Provider.cs @@ -312,7 +312,7 @@ public Expression ConvertStringPropertyToExpression(string property, bool fromFi break; } } - if (exp == null) throw new Exception(CoreStrings.Cannot_Match_Property(property)); + if (exp == null) throw new Exception(CoreErrorStrings.Cannot_Match_Property(property)); } else { @@ -333,7 +333,7 @@ public Expression ConvertStringPropertyToExpression(string property, bool fromFi { var tmp1 = field[x]; if (_commonUtils.GetTableByEntity(currentType).Properties.TryGetValue(tmp1, out var prop) == false) - throw new ArgumentException($"{currentType.DisplayCsharp()} {CoreStrings.NotFound_PropertyName(tmp1)}"); + throw new ArgumentException($"{currentType.DisplayCsharp()} {CoreErrorStrings.NotFound_PropertyName(tmp1)}"); currentType = prop.PropertyType; currentExp = Expression.MakeMemberAccess(currentExp, prop); } @@ -796,7 +796,7 @@ string GetToDeleteWhere(string alias) } public IDelete ToDelete() { - if (_tables[0].Table.Primarys.Any() == false) throw new Exception(CoreStrings.Entity_Must_Primary_Key("ToDelete", _tables[0].Table.CsName)); + if (_tables[0].Table.Primarys.Any() == false) throw new Exception(CoreErrorStrings.Entity_Must_Primary_Key("ToDelete", _tables[0].Table.CsName)); var del = (_orm as BaseDbProvider).CreateDeleteProvider(null) as DeleteProvider; if (_tables[0].Table.Type != typeof(T1)) del.AsType(_tables[0].Table.Type); if (_params.Any()) del._params = new List(_params.ToArray()); @@ -830,7 +830,7 @@ public IDelete ToDelete() } public IUpdate ToUpdate() { - if (_tables[0].Table.Primarys.Any() == false) throw new Exception(CoreStrings.Entity_Must_Primary_Key("ToUpdate", _tables[0].Table.CsName)); + if (_tables[0].Table.Primarys.Any() == false) throw new Exception(CoreErrorStrings.Entity_Must_Primary_Key("ToUpdate", _tables[0].Table.CsName)); var upd = (_orm as BaseDbProvider).CreateUpdateProvider(null) as UpdateProvider; if (_tables[0].Table.Type != typeof(T1)) upd.AsType(_tables[0].Table.Type); if (_params.Any()) upd._params = new List(_params.ToArray()); @@ -1018,10 +1018,10 @@ public TSelect AsAlias(Func aliasRule) } public TSelect AsType(Type entityType) { - if (entityType == typeof(object)) throw new Exception(CoreStrings.TypeAsType_NotSupport_Object("ISelect")); + if (entityType == typeof(object)) throw new Exception(CoreErrorStrings.TypeAsType_NotSupport_Object("ISelect")); if (entityType == _tables[0].Table.Type) return this as TSelect; var newtb = _commonUtils.GetTableByEntity(entityType); - _tables[0].Table = newtb ?? throw new Exception(CoreStrings.Type_AsType_Parameter_Error("ISelect")); + _tables[0].Table = newtb ?? throw new Exception(CoreErrorStrings.Type_AsType_Parameter_Error("ISelect")); if (_orm.CodeFirst.IsAutoSyncStructure) _orm.CodeFirst.SyncStructure(entityType); return this as TSelect; } @@ -1067,15 +1067,15 @@ void ParseFilter(DynamicFilterLogic logic, DynamicFilterInfo fi, bool isend) { case DynamicFilterOperator.Custom: var fiValueCustomArray = fi.Field?.ToString().Split(new[] { ' ' }, 2); - if (fiValueCustomArray.Length != 2) throw new ArgumentException(CoreStrings.CustomFieldSeparatedBySpaces); - if (string.IsNullOrWhiteSpace(fiValueCustomArray[0])) throw new ArgumentException(CoreStrings.Custom_StaticMethodName_IsNotNull); - if (string.IsNullOrWhiteSpace(fiValueCustomArray[1])) throw new ArgumentException(CoreStrings.Custom_Reflection_IsNotNull); + if (fiValueCustomArray.Length != 2) throw new ArgumentException(CoreErrorStrings.CustomFieldSeparatedBySpaces); + if (string.IsNullOrWhiteSpace(fiValueCustomArray[0])) throw new ArgumentException(CoreErrorStrings.Custom_StaticMethodName_IsNotNull); + if (string.IsNullOrWhiteSpace(fiValueCustomArray[1])) throw new ArgumentException(CoreErrorStrings.Custom_Reflection_IsNotNull); var fiValue1Type = Type.GetType(fiValueCustomArray[1]); - if (fiValue1Type == null) throw new ArgumentException(CoreStrings.NotFound_Reflection(fiValueCustomArray[1])); + if (fiValue1Type == null) throw new ArgumentException(CoreErrorStrings.NotFound_Reflection(fiValueCustomArray[1])); var fiValue0Method = fiValue1Type.GetMethod(fiValueCustomArray[0], new Type[] { typeof(string) }); if (fiValue0Method == null) fiValue0Method = fiValue1Type.GetMethod(fiValueCustomArray[0], new Type[] { typeof(object), typeof(string) }); - if (fiValue0Method == null) throw new ArgumentException(CoreStrings.NotFound_Static_MethodName(fiValueCustomArray[0])); - if (MethodIsDynamicFilterCustomAttribute(fiValue0Method) == false) throw new ArgumentException(CoreStrings.Custom_StaticMethodName_NotSet_DynamicFilterCustom(fiValueCustomArray[0])); + if (fiValue0Method == null) throw new ArgumentException(CoreErrorStrings.NotFound_Static_MethodName(fiValueCustomArray[0])); + if (MethodIsDynamicFilterCustomAttribute(fiValue0Method) == false) throw new ArgumentException(CoreErrorStrings.Custom_StaticMethodName_NotSet_DynamicFilterCustom(fiValueCustomArray[0])); var fiValue0MethodReturn = fiValue0Method?.Invoke(null, fiValue0Method.GetParameters() .Select(a => a.ParameterType == typeof(object) ? (object)this : (a.ParameterType == typeof(string) ? (object)(fi.Value?.ToString()) : (object)null)) @@ -1126,20 +1126,20 @@ void ParseFilter(DynamicFilterLogic logic, DynamicFilterInfo fi, bool isend) case DynamicFilterOperator.LessThanOrEqual: exp = Expression.Call(typeof(SqlExt).GetMethod("LessThanOrEqual").MakeGenericMethod(exp.Type), exp, Expression.Constant(Utils.GetDataReaderValue(exp.Type, fi.Value?.ToString()), exp.Type)); break; case DynamicFilterOperator.Range: var fiValueRangeArray = getFiListValue(); - if (fiValueRangeArray.Length != 2) throw new ArgumentException(CoreStrings.Range_Comma_Separateda_By2Char); + if (fiValueRangeArray.Length != 2) throw new ArgumentException(CoreErrorStrings.Range_Comma_Separateda_By2Char); exp = Expression.AndAlso( Expression.GreaterThanOrEqual(exp, Expression.Constant(Utils.GetDataReaderValue(exp.Type, fiValueRangeArray[0]), exp.Type)), Expression.LessThan(exp, Expression.Constant(Utils.GetDataReaderValue(exp.Type, fiValueRangeArray[1]), exp.Type))); break; case DynamicFilterOperator.DateRange: var fiValueDateRangeArray = getFiListValue(); - if (fiValueDateRangeArray?.Length != 2) throw new ArgumentException(CoreStrings.DateRange_Comma_Separateda_By2Char); + if (fiValueDateRangeArray?.Length != 2) throw new ArgumentException(CoreErrorStrings.DateRange_Comma_Separateda_By2Char); if (Regex.IsMatch(fiValueDateRangeArray[1], @"^\d\d\d\d[\-/]\d\d?[\-/]\d\d?$")) fiValueDateRangeArray[1] = DateTime.Parse(fiValueDateRangeArray[1]).AddDays(1).ToString("yyyy-MM-dd HH:mm:ss"); else if (Regex.IsMatch(fiValueDateRangeArray[1], @"^\d\d\d\d[\-/]\d\d?$")) fiValueDateRangeArray[1] = DateTime.Parse($"{fiValueDateRangeArray[1]}-01").AddMonths(1).ToString("yyyy-MM-dd HH:mm:ss"); else if (Regex.IsMatch(fiValueDateRangeArray[1], @"^\d\d\d\d$")) fiValueDateRangeArray[1] = DateTime.Parse($"{fiValueDateRangeArray[1]}-01-01").AddYears(1).ToString("yyyy-MM-dd HH:mm:ss"); else if (Regex.IsMatch(fiValueDateRangeArray[1], @"^\d\d\d\d[\-/]\d\d?[\-/]\d\d? \d\d?$")) fiValueDateRangeArray[1] = DateTime.Parse($"{fiValueDateRangeArray[1]}:00:00").AddHours(1).ToString("yyyy-MM-dd HH:mm:ss"); else if (Regex.IsMatch(fiValueDateRangeArray[1], @"^\d\d\d\d[\-/]\d\d?[\-/]\d\d? \d\d?:\d\d?$")) fiValueDateRangeArray[1] = DateTime.Parse($"{fiValueDateRangeArray[1]}:00").AddMinutes(1).ToString("yyyy-MM-dd HH:mm:ss"); - else if (!Regex.IsMatch(fiValueDateRangeArray[1], @"^\d\d\d\d[\-/]\d\d?[\-/]\d\d? \d\d?:\d\d?:\d\d?$")) throw new ArgumentException(CoreStrings.DateRange_DateFormat_yyyy); + else if (!Regex.IsMatch(fiValueDateRangeArray[1], @"^\d\d\d\d[\-/]\d\d?[\-/]\d\d? \d\d?:\d\d?:\d\d?$")) throw new ArgumentException(CoreErrorStrings.DateRange_DateFormat_yyyy); if (Regex.IsMatch(fiValueDateRangeArray[0], @"^\d\d\d\d[\-/]\d\d?$")) fiValueDateRangeArray[0] = DateTime.Parse($"{fiValueDateRangeArray[0]}-01").ToString("yyyy-MM-dd HH:mm:ss"); else if (Regex.IsMatch(fiValueDateRangeArray[0], @"^\d\d\d\d$")) fiValueDateRangeArray[0] = DateTime.Parse($"{fiValueDateRangeArray[0]}-01-01").ToString("yyyy-MM-dd HH:mm:ss"); @@ -1274,7 +1274,7 @@ public TSelect ForUpdate(bool noawait = false) { if (_transaction == null && _orm.Ado.TransactionCurrentThread != null) this.WithTransaction(_orm.Ado.TransactionCurrentThread); if (_transaction == null && _resolveHookTransaction != null) this.WithTransaction(_resolveHookTransaction()); - if (_transaction == null) throw new Exception($"{CoreStrings.Begin_Transaction_Then_ForUpdate}"); + if (_transaction == null) throw new Exception($"{CoreErrorStrings.Begin_Transaction_Then_ForUpdate}"); switch (_orm.Ado.DataType) { case DataType.MySql: diff --git a/FreeSql/Internal/CommonProvider/SelectProvider/Select0ProviderReader.cs b/FreeSql/Internal/CommonProvider/SelectProvider/Select0ProviderReader.cs index be40ee340..6216a73b5 100644 --- a/FreeSql/Internal/CommonProvider/SelectProvider/Select0ProviderReader.cs +++ b/FreeSql/Internal/CommonProvider/SelectProvider/Select0ProviderReader.cs @@ -21,13 +21,13 @@ partial class Select0Provider { public DataTable ToDataTableByPropertyName(string[] properties) { - if (properties?.Any() != true) throw new ArgumentException($"{CoreStrings.Properties_Cannot_Null}"); + if (properties?.Any() != true) throw new ArgumentException($"{CoreErrorStrings.Properties_Cannot_Null}"); var sbfield = new StringBuilder(); for (var propIdx = 0; propIdx < properties.Length; propIdx++) { var property = properties[propIdx]; var exp = ConvertStringPropertyToExpression(property); - if (exp == null) throw new Exception(CoreStrings.Property_Cannot_Find(property)); + if (exp == null) throw new Exception(CoreErrorStrings.Property_Cannot_Find(property)); var field = _commonExpression.ExpressionSelectColumn_MemberAccess(_tables, _tableRule, null, SelectTableInfoType.From, exp, true, _diymemexpWithTempQuery); if (propIdx > 0) sbfield.Append(", "); sbfield.Append(field); @@ -236,7 +236,7 @@ internal void ToListChunkPrivate(int chunkSize, Action>> done, bool includeNestedMembers = false) { - if (_selectExpression != null) throw new ArgumentException(CoreStrings.Before_Chunk_Cannot_Use_Select); + if (_selectExpression != null) throw new ArgumentException(CoreErrorStrings.Before_Chunk_Cannot_Use_Select); this.ToListChunkPrivate(size, done, includeNestedMembers == false ? this.GetAllFieldExpressionTreeLevel2() : this.GetAllFieldExpressionTreeLevelAll(), null); } @@ -859,7 +859,7 @@ public TSelect InternalJoin(Expression exp, SelectTableInfoType joinType) protected TSelect InternalJoin(Expression exp, SelectTableInfoType joinType) { var tb = _commonUtils.GetTableByEntity(typeof(T2)); - if (tb == null) throw new ArgumentException(CoreStrings.T2_Type_Error); + if (tb == null) throw new ArgumentException(CoreErrorStrings.T2_Type_Error); _tables.Add(new SelectTableInfo { Table = tb, Alias = $"IJ{_tables.Count}", On = null, Type = joinType }); _commonExpression.ExpressionJoinLambda(_tables, _tableRule, joinType, exp, _diymemexpWithTempQuery, _whereGlobalFilter); return this as TSelect; @@ -990,7 +990,7 @@ protected string InternalToSql(Expression select, FieldAliasOptions fie protected string InternalGetInsertIntoToSql(string tableName, Expression select) { var tb = _orm.CodeFirst.GetTableByEntity(typeof(TTargetEntity)); - if (tb == null) throw new ArgumentException(CoreStrings.InsertInto_TypeError(typeof(TTargetEntity).DisplayCsharp())); + if (tb == null) throw new ArgumentException(CoreErrorStrings.InsertInto_TypeError(typeof(TTargetEntity).DisplayCsharp())); if (string.IsNullOrEmpty(tableName)) tableName = tb.DbName; if (_orm.CodeFirst.IsSyncStructureToLower) tableName = tableName.ToLower(); if (_orm.CodeFirst.IsSyncStructureToUpper) tableName = tableName.ToUpper(); @@ -1003,7 +1003,7 @@ protected string InternalGetInsertIntoToSql(string tableName, Exp _commonExpression.ReadAnonymousField(_tables, _tableRule, field, map, ref index, select, null, _diymemexpWithTempQuery, _whereGlobalFilter, null, null, false); //不走 DTO 映射,不处理 IncludeMany var childs = map.Childs; - if (childs.Any() == false) throw new ArgumentException(CoreStrings.InsertInto_No_Property_Selected(typeof(TTargetEntity).DisplayCsharp())); + if (childs.Any() == false) throw new ArgumentException(CoreErrorStrings.InsertInto_No_Property_Selected(typeof(TTargetEntity).DisplayCsharp())); foreach (var col in tb.Columns.Values) { if (col.Attribute.IsIdentity && string.IsNullOrEmpty(col.DbInsertValue)) continue; @@ -1101,13 +1101,13 @@ protected TReturn InternalToAggregate(Expression select) #else public Task ToDataTableByPropertyNameAsync(string[] properties, CancellationToken cancellationToken) { - if (properties?.Any() != true) throw new ArgumentException($"{CoreStrings.Properties_Cannot_Null}"); + if (properties?.Any() != true) throw new ArgumentException($"{CoreErrorStrings.Properties_Cannot_Null}"); var sbfield = new StringBuilder(); for (var propIdx = 0; propIdx < properties.Length; propIdx++) { var property = properties[propIdx]; var exp = ConvertStringPropertyToExpression(property); - if (exp == null) throw new Exception(CoreStrings.Property_Cannot_Find(property)); + if (exp == null) throw new Exception(CoreErrorStrings.Property_Cannot_Find(property)); var field = _commonExpression.ExpressionSelectColumn_MemberAccess(_tables, _tableRule, null, SelectTableInfoType.From, exp, true, _diymemexpWithTempQuery); if (propIdx > 0) sbfield.Append(", "); sbfield.Append(field); diff --git a/FreeSql/Internal/CommonProvider/SelectProvider/Select1Provider.cs b/FreeSql/Internal/CommonProvider/SelectProvider/Select1Provider.cs index a06685c5d..a220402a9 100644 --- a/FreeSql/Internal/CommonProvider/SelectProvider/Select1Provider.cs +++ b/FreeSql/Internal/CommonProvider/SelectProvider/Select1Provider.cs @@ -31,7 +31,7 @@ protected ISelect InternalFrom(LambdaExpression lambdaExp) for (var a = 1; a < lambdaExp.Parameters.Count; a++) { var tb = _commonUtils.GetTableByEntity(lambdaExp.Parameters[a].Type); - if (tb == null) throw new ArgumentException(CoreStrings.Type_Error_Name(lambdaExp.Parameters[a].Name)); + if (tb == null) throw new ArgumentException(CoreErrorStrings.Type_Error_Name(lambdaExp.Parameters[a].Name)); _tables.Add(new SelectTableInfo { Table = tb, Alias = lambdaExp.Parameters[a].Name, On = null, Type = SelectTableInfoType.From }); } var exp = lambdaExp.Body; @@ -79,7 +79,7 @@ protected ISelect InternalFrom(LambdaExpression lambdaExp) case "LeftJoin": this.InternalJoin(expCall.Arguments[0], SelectTableInfoType.LeftJoin); break; case "InnerJoin": this.InternalJoin(expCall.Arguments[0], SelectTableInfoType.InnerJoin); break; case "RightJoin": this.InternalJoin(expCall.Arguments[0], SelectTableInfoType.RightJoin); break; - default: throw new NotImplementedException(CoreStrings.Not_Implemented_Name(expCall.Method.Name)); + default: throw new NotImplementedException(CoreErrorStrings.Not_Implemented_Name(expCall.Method.Name)); } } } @@ -528,7 +528,7 @@ public ISelect WithSql(string sql, object parms = null) public ISelect WithMemory(IEnumerable source) { var list = source?.Select(a => (object)a).ToList(); - if (list.Any() != true) throw new Exception(CoreStrings.Cannot_Be_NULL_Name(nameof(source))); + if (list.Any() != true) throw new Exception(CoreErrorStrings.Cannot_Be_NULL_Name(nameof(source))); var sb = new StringBuilder(); (_orm.InsertOrUpdate().AsType(_tables[0].Table.Type) as InsertOrUpdateProvider) .WriteSourceSelectUnionAll(list, sb, _params, true); @@ -563,13 +563,13 @@ public bool Any(Expression> exp) public ISelect IncludeByPropertyName(string property, Expression>> then) { var exp = ConvertStringPropertyToExpression(property, true); - if (exp == null) throw new ArgumentException($"{CoreStrings.Cannot_Resolve_ExpressionTree(nameof(property))}"); + if (exp == null) throw new ArgumentException($"{CoreErrorStrings.Cannot_Resolve_ExpressionTree(nameof(property))}"); var memExp = exp as MemberExpression; - if (memExp == null) throw new ArgumentException($"{CoreStrings.Cannot_Resolve_ExpressionTree(nameof(property))}2"); + if (memExp == null) throw new ArgumentException($"{CoreErrorStrings.Cannot_Resolve_ExpressionTree(nameof(property))}2"); var parTb = _commonUtils.GetTableByEntity(memExp.Expression.Type); - if (parTb == null) throw new ArgumentException($"{CoreStrings.Cannot_Resolve_ExpressionTree(nameof(property))}3"); + if (parTb == null) throw new ArgumentException($"{CoreErrorStrings.Cannot_Resolve_ExpressionTree(nameof(property))}3"); var parTbref = parTb.GetTableRef(memExp.Member.Name, true, true); - if (parTbref == null) throw new ArgumentException(CoreStrings.Not_Valid_Navigation_Property(nameof(property))); + if (parTbref == null) throw new ArgumentException(CoreErrorStrings.Not_Valid_Navigation_Property(nameof(property))); switch (parTbref.RefType) { case TableRefType.ManyToMany: @@ -584,7 +584,7 @@ public ISelect IncludeByPropertyName(string property, Expression Include(Expression> navigateSe { var expBody = navigateSelector?.Body; if (expBody == null) return this; - if (expBody.NodeType != ExpressionType.MemberAccess) throw new Exception(CoreStrings.Include_ParameterType_Error_Use_MemberAccess); - if (typeof(IEnumerable).IsAssignableFrom(expBody.Type)) throw new Exception(CoreStrings.Include_ParameterType_Error_Use_IncludeMany); + if (expBody.NodeType != ExpressionType.MemberAccess) throw new Exception(CoreErrorStrings.Include_ParameterType_Error_Use_MemberAccess); + if (typeof(IEnumerable).IsAssignableFrom(expBody.Type)) throw new Exception(CoreErrorStrings.Include_ParameterType_Error_Use_IncludeMany); var tb = _commonUtils.GetTableByEntity(expBody.Type); - if (tb == null) throw new Exception(CoreStrings.Include_ParameterType_Error); + if (tb == null) throw new Exception(CoreErrorStrings.Include_ParameterType_Error); _isIncluded = true; _tables[0].Parameter = navigateSelector.Parameters[0]; @@ -686,19 +686,19 @@ static NativeTuple> GetExpressionSta isbreak = true; break; } - throw new Exception(CoreStrings.Expression_Error_Use_Successive_MemberAccess_Type(exp)); + throw new Exception(CoreErrorStrings.Expression_Error_Use_Successive_MemberAccess_Type(exp)); default: - throw new Exception(CoreStrings.Expression_Error_Use_Successive_MemberAccess_Type(exp)); + throw new Exception(CoreErrorStrings.Expression_Error_Use_Successive_MemberAccess_Type(exp)); } } - if (param == null) throw new Exception(CoreStrings.Expression_Error_Use_ParameterExpression(exp)); + if (param == null) throw new Exception(CoreErrorStrings.Expression_Error_Use_ParameterExpression(exp)); return NativeTuple.Create(param, members.ToList()); } static MethodInfo GetEntityValueWithPropertyNameMethod = typeof(EntityUtilExtensions).GetMethod("GetEntityValueWithPropertyName"); static ConcurrentDictionary> _dicTypeMethod = new ConcurrentDictionary>(); public ISelect IncludeMany(Expression>> navigateSelector, Action> then = null) where TNavigate : class { - var throwNavigateSelector = new Exception(CoreStrings.IncludeMany_ParameterType_Error_Use_MemberAccess); + var throwNavigateSelector = new Exception(CoreErrorStrings.IncludeMany_ParameterType_Error_Use_MemberAccess); var expBody = navigateSelector?.Body; if (expBody == null) return this; @@ -708,7 +708,7 @@ public ISelect IncludeMany(Expression> selectExp = null; while (expBody.NodeType == ExpressionType.Call) { - throwNavigateSelector = new Exception(CoreStrings.IncludeMany_ParameterTypeError(nameof(navigateSelector))); + throwNavigateSelector = new Exception(CoreErrorStrings.IncludeMany_ParameterTypeError(nameof(navigateSelector))); var callExp = (expBody as MethodCallExpression); switch (callExp.Method.Name) { @@ -720,7 +720,7 @@ public ISelect IncludeMany(Expression>); - if (selectExp?.Parameters.Count != 1) throw new Exception(CoreStrings.IncludeMany_ParameterError_OnlyUseOneParameter(nameof(navigateSelector))); + if (selectExp?.Parameters.Count != 1) throw new Exception(CoreErrorStrings.IncludeMany_ParameterError_OnlyUseOneParameter(nameof(navigateSelector))); break; default: throw throwNavigateSelector; } @@ -736,9 +736,9 @@ public ISelect IncludeMany(Expression IncludeMany(Expression Join(ISelect query, Expression).MakeGenericType(typeof(T1), typeof(T2)) .GetConstructor(new[] { typeof(IUpdate), typeof(ISelect), typeof(Expression>) }); - if (ctor == null) throw new Exception(CoreStrings.Type_Cannot_Access_Constructor("UpdateJoinProvider<>")); + if (ctor == null) throw new Exception(CoreErrorStrings.Type_Cannot_Access_Constructor("UpdateJoinProvider<>")); return ctor.Invoke(new object[] { this, query, on }) as IUpdateJoin; } @@ -271,7 +271,7 @@ protected void ValidateVersionAndThrow(int affrows, string sql, DbParameter[] db if (_versionColumn != null && _source.Count > 0) { if (affrows != _source.Count) - throw new DbUpdateVersionException(CoreStrings.DbUpdateVersionException_RowLevelOptimisticLock(_source.Count, affrows), _table, sql, dbParms, affrows, _source.Select(a => (object)a)); + throw new DbUpdateVersionException(CoreErrorStrings.DbUpdateVersionException_RowLevelOptimisticLock(_source.Count, affrows), _table, sql, dbParms, affrows, _source.Select(a => (object)a)); foreach (var d in _source) { if (d is Dictionary dict) @@ -381,7 +381,7 @@ protected virtual void SplitExecute(int valuesLimit, int parameterLimit, string } else { - if (_orm.Ado.MasterPool == null) throw new Exception(CoreStrings.MasterPool_IsNull_UseTransaction); + if (_orm.Ado.MasterPool == null) throw new Exception(CoreErrorStrings.MasterPool_IsNull_UseTransaction); using (var conn = _orm.Ado.MasterPool.Get()) { _transaction = conn.Value.BeginTransaction(); @@ -396,12 +396,12 @@ protected virtual void SplitExecute(int valuesLimit, int parameterLimit, string execute(); } _transaction.Commit(); - _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.Commit, null)); + _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreErrorStrings.Commit, null)); } catch (Exception ex) { _transaction.Rollback(); - _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.RollBack, ex)); + _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreErrorStrings.RollBack, ex)); throw; } _transaction = null; @@ -537,7 +537,7 @@ public static void AuditDataValue(object sender, T1 data, IFreeSql orm, TableInf if (orm.Aop.AuditValueHandler == null) return; if (data == null || table == null) return; if (typeof(T1) == typeof(object) && new[] { table.Type, table.TypeLazy }.Contains(data.GetType()) == false) - throw new Exception(CoreStrings.DataType_AsType_Inconsistent(data.GetType().DisplayCsharp(), table.Type.DisplayCsharp())); + throw new Exception(CoreErrorStrings.DataType_AsType_Inconsistent(data.GetType().DisplayCsharp(), table.Type.DisplayCsharp())); foreach (var col in table.Columns.Values) { object val = col.GetValue(data); @@ -692,7 +692,7 @@ public IUpdate Set(Expression> exp) if (initAssignExp == null) continue; var memberName = initExp.Bindings[a].Member.Name; if (_table.ColumnsByCsIgnore.ContainsKey(memberName)) continue; - if (_table.ColumnsByCs.TryGetValue(memberName, out var col) == false) throw new Exception(CoreStrings.NotFound_Property(memberName)); + if (_table.ColumnsByCs.TryGetValue(memberName, out var col) == false) throw new Exception(CoreErrorStrings.NotFound_Property(memberName)); var memberValue = _commonExpression.ExpressionLambdaToSql(initAssignExp.Expression, new CommonExpression.ExpTSC { isQuoteName = true, @@ -710,7 +710,7 @@ public IUpdate Set(Expression> exp) { var memberName = newExp.Members[a].Name; if (_table.ColumnsByCsIgnore.ContainsKey(memberName)) continue; - if (_table.ColumnsByCs.TryGetValue(memberName, out var col) == false) throw new Exception(CoreStrings.NotFound_Property(memberName)); + if (_table.ColumnsByCs.TryGetValue(memberName, out var col) == false) throw new Exception(CoreErrorStrings.NotFound_Property(memberName)); var memberValue = _commonExpression.ExpressionLambdaToSql(newExp.Arguments[a], new CommonExpression.ExpTSC { isQuoteName = true, @@ -831,7 +831,7 @@ public IUpdate DisableGlobalFilter(params string[] name) protected string WhereCaseSource(string CsName, Func thenValue) { if (_source.Any() == false) return null; - if (_table.ColumnsByCs.ContainsKey(CsName) == false) throw new Exception(CoreStrings.NotFound_CsName_Column(CsName)); + if (_table.ColumnsByCs.ContainsKey(CsName) == false) throw new Exception(CoreErrorStrings.NotFound_CsName_Column(CsName)); if (thenValue == null) throw new ArgumentNullException(nameof(thenValue)); if (_source.Count == 0) return null; @@ -928,10 +928,10 @@ public IUpdate AsTable(string tableName) } public IUpdate AsType(Type entityType) { - if (entityType == typeof(object)) throw new Exception(CoreStrings.TypeAsType_NotSupport_Object("IUpdate")); + if (entityType == typeof(object)) throw new Exception(CoreErrorStrings.TypeAsType_NotSupport_Object("IUpdate")); if (entityType == _table.Type) return this; var newtb = _commonUtils.GetTableByEntity(entityType); - _table = newtb ?? throw new Exception(CoreStrings.Type_AsType_Parameter_Error("IUpdate")); + _table = newtb ?? throw new Exception(CoreErrorStrings.Type_AsType_Parameter_Error("IUpdate")); _tempPrimarys = _table.Primarys; _versionColumn = _ignoreVersion ? null : _table.VersionColumn; if (_isAutoSyncStructure) _orm.CodeFirst.SyncStructure(entityType); @@ -1228,7 +1228,7 @@ public virtual void ToSqlWhere(StringBuilder sb) sb.Append(" \r\nWHERE "); if (_source.Any()) { - if (_tempPrimarys.Any() == false) throw new ArgumentException(CoreStrings.NoPrimaryKey_UseSetDto(_table.Type.DisplayCsharp())); + if (_tempPrimarys.Any() == false) throw new ArgumentException(CoreErrorStrings.NoPrimaryKey_UseSetDto(_table.Type.DisplayCsharp())); sb.Append('(').Append(_commonUtils.WhereItems(_tempPrimarys, "", _source, _paramsSource)).Append(')'); andTimes++; } diff --git a/FreeSql/Internal/CommonProvider/UpdateProviderAsync.cs b/FreeSql/Internal/CommonProvider/UpdateProviderAsync.cs index 6f07d10ce..45bc2f898 100644 --- a/FreeSql/Internal/CommonProvider/UpdateProviderAsync.cs +++ b/FreeSql/Internal/CommonProvider/UpdateProviderAsync.cs @@ -50,7 +50,7 @@ async protected virtual Task SplitExecuteAsync(int valuesLimit, int parameterLim } else { - if (_orm.Ado.MasterPool == null) throw new Exception(CoreStrings.MasterPool_IsNull_UseTransaction); + if (_orm.Ado.MasterPool == null) throw new Exception(CoreErrorStrings.MasterPool_IsNull_UseTransaction); using (var conn = await _orm.Ado.MasterPool.GetAsync()) { _transaction = conn.Value.BeginTransaction(); @@ -65,12 +65,12 @@ async protected virtual Task SplitExecuteAsync(int valuesLimit, int parameterLim await executeAsync(); } _transaction.Commit(); - _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.Commit, null)); + _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreErrorStrings.Commit, null)); } catch (Exception ex) { _transaction.Rollback(); - _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.RollBack, ex)); + _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreErrorStrings.RollBack, ex)); throw; } _transaction = null; diff --git a/FreeSql/Internal/Exception/CoreErrorStrings.cs b/FreeSql/Internal/Exception/CoreErrorStrings.cs new file mode 100644 index 000000000..95baa0b40 --- /dev/null +++ b/FreeSql/Internal/Exception/CoreErrorStrings.cs @@ -0,0 +1,2027 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Text; + +namespace FreeSql +{ + public static class CoreErrorStrings + { + public static string Language = "en"; + /// + /// [Table(AsTable = "{asTable}")] 特性值格式错误 + /// + public static string AsTable_PropertyName_FormatError(object asTable) => string.Format(Language == "cn" ? + @"[Table(AsTable = ""{0}"")] 特性值格式错误" : + @"FreeSql: [Table(AsTable=""{0}"")] Property value formatted incorrectly", asTable); + /// + /// [Table(AsTable = xx)] 设置的属性名 {atmGroupsValue} 不是 DateTime 类型 + /// + public static string AsTable_PropertyName_NotDateTime(object atmGroupsValue) => string.Format(Language == "cn" ? + @"[Table(AsTable = xx)] 设置的属性名 {0} 不是 DateTime 类型" : + @"FreeSql: The property name {0} set by [Table (AsTable = xx)] is not of type DateTime", atmGroupsValue); + /// + /// {name}: Failed to get resource {statistics} + /// + public static string Available_Failed_Get_Resource(object name, object statistics) => string.Format(Language == "cn" ? + @"{0}: Failed to get resource {1}" : + @"FreeSql: {0}: Failed to get resource {1}", name, statistics); + /// + /// {name}: An exception needs to be thrown + /// + public static string Available_Thrown_Exception(object name) => string.Format(Language == "cn" ? + @"{0}: An exception needs to be thrown" : + @"FreeSql: {0}: An exception needs to be thrown", name); + /// + /// 错误的表达式格式 {column} + /// + public static string Bad_Expression_Format(object column) => string.Format(Language == "cn" ? + @"错误的表达式格式 {0}" : + @"FreeSql: Wrong expression format {0}", column); + /// + /// Chunk 功能之前不可使用 Select + /// + public static string Before_Chunk_Cannot_Use_Select => Language == "cn" ? + @"Chunk 功能之前不可使用 Select" : + @"FreeSql: Select is not available until the Chunk function"; + /// + /// 安全起见,请务必在事务开启之后,再使用 ForUpdate + /// + public static string Begin_Transaction_Then_ForUpdate => Language == "cn" ? + @"安全起见,请务必在事务开启之后,再使用 ForUpdate" : + @"FreeSql: For security reasons, be sure to use ForUpdate after the transaction is open"; + /// + /// 不能为 null + /// + public static string Cannot_Be_NULL => Language == "cn" ? + @"不能为 null" : + @"FreeSql: Cannot be null"; + /// + /// {name} 不能为 null + /// + public static string Cannot_Be_NULL_Name(object name) => string.Format(Language == "cn" ? + @"{0} 不能为 null" : + @"FreeSql: {0} cannot be null", name); + /// + /// 无法匹配 {property} + /// + public static string Cannot_Match_Property(object property) => string.Format(Language == "cn" ? + @"无法匹配 {0}" : + @"FreeSql: Unable to match {0}", property); + /// + /// {property} 无法解析为表达式树 + /// + public static string Cannot_Resolve_ExpressionTree(object property) => string.Format(Language == "cn" ? + @"{0} 无法解析为表达式树" : + @"FreeSql: {0} cannot be resolved to an expression tree", property); + /// + /// 参数 masterConnectionString 不可为空,请检查 UseConnectionString + /// + public static string Check_UseConnectionString => Language == "cn" ? + @"参数 masterConnectionString 不可为空,请检查 UseConnectionString" : + @"FreeSql: The parameter master ConnectionString cannot be empty, check UseConnectionString"; + /// + /// 提交 + /// + public static string Commit => Language == "cn" ? + @"提交" : + @"FreeSql: Commit"; + /// + /// 连接失败,准备切换其他可用服务器 + /// + public static string Connection_Failed_Switch_Servers => Language == "cn" ? + @"连接失败,准备切换其他可用服务器" : + @"FreeSql: Connection failed, ready to switch other available servers"; + /// + /// 自定义表达式解析错误:类型 {exp3MethodDeclaringType} 需要定义 static ThreadLocal&lt;ExpressionCallContext&gt; 字段、字段、字段(重要三次提醒) + /// + public static string Custom_Expression_ParsingError(object exp3MethodDeclaringType) => string.Format(Language == "cn" ? + @"自定义表达式解析错误:类型 {0} 需要定义 static ThreadLocal 字段、字段、字段(重要三次提醒)" : + @"FreeSql: Custom expression parsing error: type {0} needs to define static ThreadLocalfield, field, field (important three reminders)", exp3MethodDeclaringType); + /// + /// Custom { 反射信息 }不能为空,格式:{ 静态方法名 }{ 空格 }{ 反射信息 } + /// + public static string Custom_Reflection_IsNotNull => Language == "cn" ? + @"Custom { 反射信息 }不能为空,格式:{ 静态方法名 }{ 空格 }{ 反射信息 }" : + @"FreeSql: Custom {Reflection Information} cannot be empty, format: {static method name}{space}{reflection information}"; + /// + /// Custom { 静态方法名 }不能为空,格式:{ 静态方法名 }{ 空格 }{ 反射信息 } + /// + public static string Custom_StaticMethodName_IsNotNull => Language == "cn" ? + @"Custom { 静态方法名 }不能为空,格式:{ 静态方法名 }{ 空格 }{ 反射信息 }" : + @"FreeSql: Custom {static method name} cannot be empty, format: {static method name}{space}{reflection information}"; + /// + /// Custom 对应的{{ 静态方法名 }}:{fiValueCustomArray} 未设置 [DynamicFilterCustomAttribute] 特性 + /// + public static string Custom_StaticMethodName_NotSet_DynamicFilterCustom(object fiValueCustomArray) => string.Format(Language == "cn" ? + @"Custom 对应的{{ 静态方法名 }}:{0} 未设置 [DynamicFilterCustomAttribute] 特性" : + @"FreeSql: Custom corresponding {{static method name}}:{0} The [DynamicFilterCustomAttribute] attribute is not set", fiValueCustomArray); + /// + /// Custom 要求 Field 应该空格分割,并且长度为 2,格式:{ 静态方法名 }{ 空格 }{ 反射信息 } + /// + public static string CustomFieldSeparatedBySpaces => Language == "cn" ? + @"Custom 要求 Field 应该空格分割,并且长度为 2,格式:{ 静态方法名 }{ 空格 }{ 反射信息 }" : + @"FreeSql: Custom requires that Fields be space-split and 2-length in the format: {static method name}{space}{reflection information}"; + /// + /// 操作的数据类型({dataDisplayCsharp}) 与 AsType({tableTypeDisplayCsharp}) 不一致,请检查。 + /// + public static string DataType_AsType_Inconsistent(object dataDisplayCsharp, object tableTypeDisplayCsharp) => string.Format(Language == "cn" ? + @"操作的数据类型({0}) 与 AsType({1}) 不一致,请检查。" : + @"FreeSql: The data type of the operation ({0}) is inconsistent with AsType ({1}). Please check.", dataDisplayCsharp, tableTypeDisplayCsharp); + /// + /// DateRange 要求 Value 应该逗号分割,并且长度为 2 + /// + public static string DateRange_Comma_Separateda_By2Char => Language == "cn" ? + @"DateRange 要求 Value 应该逗号分割,并且长度为 2" : + @"FreeSql: DateRange requires that Value be comma-separated and 2-length"; + /// + /// DateRange 要求 Value[1] 格式必须为:yyyy、yyyy-MM、yyyy-MM-dd、yyyy-MM-dd HH、yyyy、yyyy-MM-dd HH:mm + /// + public static string DateRange_DateFormat_yyyy => Language == "cn" ? + @"DateRange 要求 Value[1] 格式必须为:yyyy、yyyy-MM、yyyy-MM-dd、yyyy-MM-dd HH、yyyy、yyyy-MM-dd HH:mm" : + @"FreeSql: DateRange requires that the Value [1] format must be: yyyy, yyyy-MM, yyyy-MM-dd, yyyyy-MM-dd HH, yyyy, yyyy-MM-dd HH:mm"; + /// + /// 记录可能不存在,或者【行级乐观锁】版本过旧,更新数量{sourceCount},影响的行数{affrows}。 + /// + public static string DbUpdateVersionException_RowLevelOptimisticLock(object sourceCount, object affrows) => string.Format(Language == "cn" ? + @"记录可能不存在,或者【行级乐观锁】版本过旧,更新数量{0},影响的行数{1}。" : + @"FreeSql: The record may not exist, or the row level optimistic lock version is out of date, the number of updates {0}, the number of rows affected {1}.", sourceCount, affrows); + /// + /// SlaveConnectionString 数量与 SlaveWeights 不相同 + /// + public static string Different_Number_SlaveConnectionString_SlaveWeights => Language == "cn" ? + @"SlaveConnectionString 数量与 SlaveWeights 不相同" : + @"FreeSql: The number of SlaveConnectionStrings is not the same as SlaveWeights"; + /// + /// ColumnAttribute.Name {colattrName} 重复存在,请检查(注意:不区分大小写) + /// + public static string Duplicate_ColumnAttribute(object colattrName) => string.Format(Language == "cn" ? + @"ColumnAttribute.Name {0} 重复存在,请检查(注意:不区分大小写)" : + @"FreeSql: ColumnAttribute. Name {0} exists repeatedly, please check (note: case insensitive)", colattrName); + /// + /// 属性名 {pName} 重复存在,请检查(注意:不区分大小写) + /// + public static string Duplicate_PropertyName(object pName) => string.Format(Language == "cn" ? + @"属性名 {0} 重复存在,请检查(注意:不区分大小写)" : + @"FreeSql: Property name {0} exists repeatedly, please check (note: case insensitive)", pName); + /// + /// {function} 功能要求实体类 {tableCsName} 必须有主键 + /// + public static string Entity_Must_Primary_Key(object function, object tableCsName) => string.Format(Language == "cn" ? + @"{0} 功能要求实体类 {1} 必须有主键" : + @"FreeSql: The {0} feature requires that the entity class {1} must have a primary key", function, tableCsName); + /// + /// {tbTypeFullName} 是父子关系,但是 MySql 8.0 以下版本中不支持组合多主键 + /// + public static string Entity_MySQL_VersionsBelow8_NotSupport_Multiple_PrimaryKeys(object tbTypeFullName) => string.Format(Language == "cn" ? + @"{0} 是父子关系,但是 MySql 8.0 以下版本中不支持组合多主键" : + @"FreeSql: {0} is a parent-child relationship, but combinations of multiple primary keys are not supported in versions below MySql 8.0", tbTypeFullName); + /// + /// {tbTypeFullName} 不是父子关系,无法使用该功能 + /// + public static string Entity_NotParentChild_Relationship(object tbTypeFullName) => string.Format(Language == "cn" ? + @"{0} 不是父子关系,无法使用该功能" : + @"FreeSql: {0} is not a parent-child relationship and cannot be used", tbTypeFullName); + /// + /// 这个特别的子查询不能解析 + /// + public static string EspeciallySubquery_Cannot_Parsing => Language == "cn" ? + @"这个特别的子查询不能解析" : + @"FreeSql: This particular subquery cannot be resolved"; + /// + /// 表达式错误,它的顶级对象不是 ParameterExpression:{exp} + /// + public static string Expression_Error_Use_ParameterExpression(object exp) => string.Format(Language == "cn" ? + @"表达式错误,它的顶级对象不是 ParameterExpression:{0}" : + @"FreeSql: Expression error, its top object is not ParameterExpression:{0}", exp); + /// + /// 表达式错误,它不是连续的 MemberAccess 类型:{exp} + /// + public static string Expression_Error_Use_Successive_MemberAccess_Type(object exp) => string.Format(Language == "cn" ? + @"表达式错误,它不是连续的 MemberAccess 类型:{0}" : + @"FreeSql: Expression error, it is not a continuous MemberAccess type: {0}", exp); + /// + /// ExpressionTree 转换类型错误,值({value}),类型({valueTypeFullName}),目标类型({typeFullName}),{exMessage} + /// + public static string ExpressionTree_Convert_Type_Error(object value, object valueTypeFullName, object typeFullName, object exMessage) => string.Format(Language == "cn" ? + @"ExpressionTree 转换类型错误,值({0}),类型({1}),目标类型({2}),{3}" : + @"FreeSql: ExpressionTree conversion type error, value ({0}), type ({1}), target type ({2}), Error:{3}", value, valueTypeFullName, typeFullName, exMessage); + /// + /// 未能解析分表字段值 {sqlWhere} + /// + public static string Failed_SubTable_FieldValue(object sqlWhere) => string.Format(Language == "cn" ? + @"未能解析分表字段值 {0}" : + @"FreeSql: Failed to parse table field value {0}", sqlWhere); + /// + /// AsTable 未实现的功能 {asTable} + /// + public static string Functions_AsTable_NotImplemented(object asTable) => string.Format(Language == "cn" ? + @"AsTable 未实现的功能 {0}" : + @"FreeSql: Function {0} not implemented by AsTable", asTable); + /// + /// GBase 暂时不支持逗号以外的分割符 + /// + public static string GBase_NotSupport_OtherThanCommas => Language == "cn" ? + @"GBase 暂时不支持逗号以外的分割符" : + @"FreeSql: GBase does not support separators other than commas at this time"; + /// + /// tableName:{tableName} 生成了相同的分表名 + /// + public static string Generated_Same_SubTable(object tableName) => string.Format(Language == "cn" ? + @"tableName:{0} 生成了相同的分表名" : + @"FreeSql: TableName:{0} generated the same table name", tableName); + /// + /// GetPrimarys 传递的参数 "{primary}" 不正确,它不属于字典数据的键名 + /// + public static string GetPrimarys_ParameterError_IsNotDictKey(object primary) => string.Format(Language == "cn" ? + @"GetPrimarys 传递的参数 ""{0}"" 不正确,它不属于字典数据的键名" : + @"FreeSql: The parameter'{0}'passed by GetPrimarys is incorrect and does not belong to the key name of the dictionary data", primary); + /// + /// 已经指定了 {first},不能再指定 {second} + /// + public static string Has_Specified_Cannot_Specified_Second(object first, object second) => string.Format(Language == "cn" ? + @"已经指定了 {0},不能再指定 {1}" : + @"FreeSql: {0} has already been specified and {1} can no longer be specified", first, second); + /// + /// {tb2DbName}.{mp2MemberName} 被忽略,请检查 IsIgnore 设置,确认 get/set 为 public + /// + public static string Ignored_Check_Confirm_PublicGetSet(object tb2DbName, object mp2MemberName) => string.Format(Language == "cn" ? + @"{0}.{1} 被忽略,请检查 IsIgnore 设置,确认 get/set 为 public" : + @"FreeSql: {0}. {1} is ignored. Check the IsIgnore setting to make sure get/set is public", tb2DbName, mp2MemberName); + /// + /// Include 参数类型错误 + /// + public static string Include_ParameterType_Error => Language == "cn" ? + @"Include 参数类型错误" : + @"FreeSql: Include parameter type error"; + /// + /// Include 参数类型错误,集合属性请使用 IncludeMany + /// + public static string Include_ParameterType_Error_Use_IncludeMany => Language == "cn" ? + @"Include 参数类型错误,集合属性请使用 IncludeMany" : + @"FreeSql: Include parameter type is wrong, use IncludeMany for collection properties"; + /// + /// Include 参数类型错误,表达式类型应该为 MemberAccess + /// + public static string Include_ParameterType_Error_Use_MemberAccess => Language == "cn" ? + @"Include 参数类型错误,表达式类型应该为 MemberAccess" : + @"FreeSql: Include parameter type is wrong, expression type should be MemberAccess"; + /// + /// IncludeMany 类型 {tbTypeDisplayCsharp} 的属性 {collMemMemberName} 不是有效的导航属性,提示:IsIgnore = true 不会成为导航属性 + /// + public static string IncludeMany_NotValid_Navigation(object collMemMemberName, object tbTypeDisplayCsharp) => string.Format(Language == "cn" ? + @"IncludeMany 类型 {1} 的属性 {0} 不是有效的导航属性,提示:IsIgnore = true 不会成为导航属性" : + @"FreeSql: The property {0} of IncludeMany type {1} is not a valid navigation property, hint: IsIgnore = true will not be a navigation property", collMemMemberName, tbTypeDisplayCsharp); + /// + /// IncludeMany {navigateSelector} 参数错误,Select 只可以使用一个参数的方法,正确格式:.Select(t =&gt;new TNavigate {{}}) + /// + public static string IncludeMany_ParameterError_OnlyUseOneParameter(object navigateSelector) => string.Format(Language == "cn" ? + @"IncludeMany {0} 参数错误,Select 只可以使用一个参数的方法,正确格式:.Select(t =>new TNavigate {{}})" : + @"FreeSql: IncludeMany {0} parameter is wrong, Select can only use one parameter's method, the correct format:.Select(t =>new TNavigate{{}})", navigateSelector); + /// + /// IncludeMany {navigateSelector} 参数错误,Select lambda参数返回值必须和 {collMemElementType} 类型一致 + /// + public static string IncludeMany_ParameterError_Select_ReturnConsistentType(object navigateSelector, object collMemElementType) => string.Format(Language == "cn" ? + @"IncludeMany {0} 参数错误,Select lambda参数返回值必须和 {1} 类型一致" : + @"FreeSql: IncludeMany {0} parameter error, Select lambda parameter return value must match {1} type", navigateSelector, collMemElementType); + /// + /// IncludeMany 参数1 类型错误,表达式类型应该为 MemberAccess + /// + public static string IncludeMany_ParameterType_Error_Use_MemberAccess => Language == "cn" ? + @"IncludeMany 参数1 类型错误,表达式类型应该为 MemberAccess" : + @"FreeSql: IncludeMany parameter 1 has wrong type, expression type should be MemberAccess"; + /// + /// IncludeMany {navigateSelector} 参数类型错误,正确格式: a.collections.Take(1).Where(c =&gt;c.aid == a.id).Select(a=&gt; new TNavigate{{}}) + /// + public static string IncludeMany_ParameterTypeError(object navigateSelector) => string.Format(Language == "cn" ? + @"IncludeMany {0} 参数类型错误,正确格式: a.collections.Take(1).Where(c =>c.aid == a.id).Select(a=> new TNavigate{{}})" : + @"FreeSql: IncludeMany {0} parameter type is wrong, correct format: a.collections.Take(1).Where(c => C.A ID == a.id).Select (a => new TNavigate{{}})", navigateSelector); + /// + /// ISelect.InsertInto() 未选择属性: {displayCsharp} + /// + public static string InsertInto_No_Property_Selected(object displayCsharp) => string.Format(Language == "cn" ? + @"ISelect.InsertInto() 未选择属性: {0}" : + @"FreeSql: ISelect. InsertInto() did not select an attribute: {0}", displayCsharp); + /// + /// ISelect.InsertInto() 类型错误: {displayCsharp} + /// + public static string InsertInto_TypeError(object displayCsharp) => string.Format(Language == "cn" ? + @"ISelect.InsertInto() 类型错误: {0}" : + @"FreeSql: ISelect. InsertInto() type error: {0}", displayCsharp); + /// + /// InsertOrUpdate 功能执行 merge into 要求实体类 {CsName} 必须有主键 + /// + public static string InsertOrUpdate_Must_Primary_Key(object CsName) => string.Format(Language == "cn" ? + @"InsertOrUpdate 功能执行 merge into 要求实体类 {0} 必须有主键" : + @"FreeSql: The InsertOrUpdate function performs merge into requiring the entity class {0} to have a primary key", CsName); + /// + /// InsertOrUpdate&lt;&gt;的泛型参数 不支持 {typeofT1},请传递您的实体类 + /// + public static string InsertOrUpdate_NotSuport_Generic_UseEntity(object typeofT1) => string.Format(Language == "cn" ? + @"InsertOrUpdate<>的泛型参数 不支持 {0},请传递您的实体类" : + @"FreeSql: The generic parameter for InsertOrUpdate<>does not support {0}. Pass in your entity class", typeofT1); + /// + /// 【延时加载】功能需要安装 FreeSql.Extensions.LazyLoading.dll,可前往 nuget 下载 + /// + public static string Install_FreeSql_Extensions_LazyLoading => Language == "cn" ? + @"【延时加载】功能需要安装 FreeSql.Extensions.LazyLoading.dll,可前往 nuget 下载" : + @"FreeSql: FreeSql needs to be installed for Delayed Loading. Extensions. LazyLoading. Dll, downloadable to nuget"; + /// + /// 【延时加载】{trytbTypeName} 编译错误:{exMessage} + /// + public static string LazyLoading_CompilationError(object trytbTypeName, object exMessage, object cscode) => string.Format(Language == "cn" ? + @"【延时加载】{0} 编译错误:{1} + +{2}" : + @"FreeSql: {0} Compilation error: {1} + +{2}", trytbTypeName, exMessage, cscode); + /// + /// 【延时加载】实体类型 {trytbTypeName} 必须声明为 public + /// + public static string LazyLoading_EntityMustDeclarePublic(object trytbTypeName) => string.Format(Language == "cn" ? + @"【延时加载】实体类型 {0} 必须声明为 public" : + @"FreeSql: Entity type {0} must be declared public", trytbTypeName); + /// + /// ManyToMany 导航属性 .AsSelect() 暂时不可用于 Sum/Avg/Max/Min/First/ToOne/ToList 方法 + /// + public static string ManyToMany_AsSelect_NotSupport_Sum_Avg_etc => Language == "cn" ? + @"ManyToMany 导航属性 .AsSelect() 暂时不可用于 Sum/Avg/Max/Min/First/ToOne/ToList 方法" : + @"FreeSql: ManyToMany navigation properties. AsSelect() is temporarily unavailable for the Sum/Avg/Max/Min/First/ToOne/ToList method"; + /// + /// 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 在 {tbmidCsName} 中没有找到对应的字段,如:{midTypePropsTrytbName}{findtrytbPkCsName}、{midTypePropsTrytbName}_{findtrytbPkCsName} + /// + public static string ManyToMany_NotFound_CorrespondingField(object trytbTypeName, object pnvName, object tbmidCsName, object midTypePropsTrytbName, object findtrytbPkCsName) => string.Format(Language == "cn" ? + @"【ManyToMany】导航属性 {0}.{1} 在 {2} 中没有找到对应的字段,如:{3}{4}、{3}_{4}" : + @"FreeSql: [ManyToMany] Navigation property {0}. {1} did not find a corresponding field in {2}, such as: {3}{4}, {3}_ {4}", trytbTypeName, pnvName, tbmidCsName, midTypePropsTrytbName, findtrytbPkCsName); + /// + /// 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,实体类型 {tbrefTypeName} 缺少主键标识,[Column(IsPrimary = true)] + /// + public static string ManyToMany_ParsingError_EntityMissing_PrimaryKey(object trytbTypeName, object pnvName, object tbrefTypeName) => string.Format(Language == "cn" ? + @"【ManyToMany】导航属性 {0}.{1} 解析错误,实体类型 {2} 缺少主键标识,[Column(IsPrimary = true)]" : + @"FreeSql: [ManyToMany] Navigation property {0}. {1} parsing error, entity type {2} missing primary key identity, [Column (IsPrimary = true)]", trytbTypeName, pnvName, tbrefTypeName); + /// + /// 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,实体类型 {tbrefTypeName} 必须存在对应的 [Navigate(ManyToMany = x)] 集合属性 + /// + public static string ManyToMany_ParsingError_EntityMustHas_NavigateCollection(object trytbTypeName, object pnvName, object tbrefTypeName) => string.Format(Language == "cn" ? + @"【ManyToMany】导航属性 {0}.{1} 解析错误,实体类型 {2} 必须存在对应的 [Navigate(ManyToMany = x)] 集合属性" : + @"FreeSql: [ManyToMany] Navigation property {0}. {1} parsing error, entity type {2} must have a corresponding [Navigate (ManyToMany = x)] collection property", trytbTypeName, pnvName, tbrefTypeName); + /// + /// 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,{tbmidCsName}.{trycolCsName} 和 {trytbCsName}.{trytbPrimarysCsName} 类型不一致 + /// + public static string ManyToMany_ParsingError_InconsistentType(object trytbTypeName, object pnvName, object tbmidCsName, object trycolCsName, object trytbCsName, object trytbPrimarysCsName) => string.Format(Language == "cn" ? + @"【ManyToMany】导航属性 {0}.{1} 解析错误,{2}.{3} 和 {4}.{5} 类型不一致" : + @"FreeSql: [ManyToMany] Navigation property {0}. {1} parsing error, {2}. {3} and {4}. {5} type inconsistent", trytbTypeName, pnvName, tbmidCsName, trycolCsName, trytbCsName, trytbPrimarysCsName); + /// + /// 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,中间类 {tbmidCsName}.{midTypePropsTrytbName} 错误:{exMessage} + /// + public static string ManyToMany_ParsingError_IntermediateClass_ErrorMessage(object trytbTypeName, object pnvName, object tbmidCsName, object midTypePropsTrytbName, object exMessage) => string.Format(Language == "cn" ? + @"【ManyToMany】导航属性 {0}.{1} 解析错误,中间类 {2}.{3} 错误:{4}" : + @"FreeSql: [ManyToMany] Navigation property {0}. {1} parsing error, intermediate class {2}.{3} Error: {4}", trytbTypeName, pnvName, tbmidCsName, midTypePropsTrytbName, exMessage); + /// + /// 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,中间类 {tbmidCsName}.{midTypePropsTrytbName} 导航属性不是【ManyToOne】或【OneToOne】 + /// + public static string ManyToMany_ParsingError_IntermediateClass_NotManyToOne_OneToOne(object trytbTypeName, object pnvName, object tbmidCsName, object midTypePropsTrytbName) => string.Format(Language == "cn" ? + @"【ManyToMany】导航属性 {0}.{1} 解析错误,中间类 {2}.{3} 导航属性不是【ManyToOne】或【OneToOne】" : + @"FreeSql: [ManyToMany] Navigation property {0}. {1} parsing error, intermediate class {2}. The {3} navigation property is not ManyToOne or OneToOne", trytbTypeName, pnvName, tbmidCsName, midTypePropsTrytbName); + /// + /// 映射异常:{name} 没有一个属性名相同 + /// + public static string Mapping_Exception_HasNo_SamePropertyName(object name) => string.Format(Language == "cn" ? + @"映射异常:{0} 没有一个属性名相同" : + @"FreeSql: Mapping exception: {0} None of the property names are the same", name); + /// + /// Ado.MasterPool 值为 null,该操作无法自启用事务,请显式传递【事务对象】解决 + /// + public static string MasterPool_IsNull_UseTransaction => Language == "cn" ? + @"Ado.MasterPool 值为 null,该操作无法自启用事务,请显式传递【事务对象】解决" : + @"FreeSql: Ado. MasterPool value is null, this operation cannot self-enable transactions, please explicitly pass [transaction object] resolution"; + /// + /// 缺少 FreeSql 数据库实现包:FreeSql.Provider.{Provider}.dll,可前往 nuget 下载 + /// + public static string Missing_FreeSqlProvider_Package(object Provider) => string.Format(Language == "cn" ? + @"缺少 FreeSql 数据库实现包:FreeSql.Provider.{0}.dll,可前往 nuget 下载" : + @"FreeSql: Missing FreeSql database implementation package: FreeSql.Provider.{0}.Dll, downloadable to nuget", Provider); + /// + /// 缺少 FreeSql 数据库实现包:{dll},可前往 nuget 下载;如果存在 {dll} 依然报错(原因是环境问题导致反射不到类型),请在 UseConnectionString/UseConnectionFactory 第三个参数手工传入 typeof({providerType}) + /// + public static string Missing_FreeSqlProvider_Package_Reason(object dll, object providerType) => string.Format(Language == "cn" ? + @"缺少 FreeSql 数据库实现包:{0},可前往 nuget 下载;如果存在 {0} 依然报错(原因是环境问题导致反射不到类型),请在 UseConnectionString/UseConnectionFactory 第三个参数手工传入 typeof({2})" : + @"FreeSql: The FreeSql database implementation package is missing: {0} can be downloaded to nuget; If there is {0} and an error still occurs (due to environmental issues that cause the type to be unreflected), manually pass in typeof ({2}) in the third parameter of UseConnectionString/UseConnectionFactory", dll, providerType); + /// + /// 导航属性 {trytbTypeName}.{pnvName} 特性 [Navigate] Bind 数目({bindColumnsCount}) 与 外部主键数目({tbrefPrimarysLength}) 不相同 + /// + public static string Navigation_Bind_Number_Different(object trytbTypeName, object pnvName, object bindColumnsCount, object tbrefPrimarysLength) => string.Format(Language == "cn" ? + @"导航属性 {0}.{1} 特性 [Navigate] Bind 数目({2}) 与 外部主键数目({3}) 不相同" : + @"FreeSql: Navigation property {0}. The number of {1} attributes [Navigate] Binds ({2}) is different from the number of external primary keys ({3})", trytbTypeName, pnvName, bindColumnsCount, tbrefPrimarysLength); + /// + /// {tb2DbName}.{mp2MemberName} 导航属性集合忘了 .AsSelect() 吗?如果在 ToList(a =&gt; a.{mp2MemberName}) 中使用,请移步参考 IncludeMany 文档。 + /// + public static string Navigation_Missing_AsSelect(object tb2DbName, object mp2MemberName) => string.Format(Language == "cn" ? + @"{0}.{1} 导航属性集合忘了 .AsSelect() 吗?如果在 ToList(a => a.{1}) 中使用,请移步参考 IncludeMany 文档。" : + @"FreeSql: {0}. {1} Navigation Property Collection forgotten. AsSelect()? If used in ToList (a => a. {1}), step by step to refer to the IncludeMany document.", tb2DbName, mp2MemberName); + /// + /// 【导航属性】{trytbTypeDisplayCsharp}.{pName} 缺少 set 属性 + /// + public static string Navigation_Missing_SetProperty(object trytbTypeDisplayCsharp, object pName) => string.Format(Language == "cn" ? + @"【导航属性】{0}.{1} 缺少 set 属性" : + @"FreeSql: Navigation Properties {0}. Missing set attribute for {1}", trytbTypeDisplayCsharp, pName); + /// + /// 导航属性 {trytbTypeName}.{pnvName} 没有找到对应的字段,如:{pnvName}{findtbrefPkCsName}、{pnvName}_{findtbrefPkCsName}。或者使用 [Navigate] 特性指定关系映射。 + /// + public static string Navigation_NotFound_CorrespondingField(object trytbTypeName, object pnvName, object findtbrefPkCsName) => string.Format(Language == "cn" ? + @"导航属性 {0}.{1} 没有找到对应的字段,如:{1}{3}、{1}_{3}。或者使用 [Navigate] 特性指定关系映射。" : + @"FreeSql: Navigation property {0}. {1} No corresponding fields were found, such as: {1}{3}, {1}_ {3}. Or use the [Navigate] attribute to specify the relationship mapping.", trytbTypeName, pnvName, findtbrefPkCsName); + /// + /// 导航属性 {trytbTypeName}.{pnvName} 解析错误,实体类型 {trytcTypeName} 缺少主键标识,[Column(IsPrimary = true)] + /// + public static string Navigation_ParsingError_EntityMissingPrimaryKey(object trytbTypeName, object pnvName, object trytcTypeName) => string.Format(Language == "cn" ? + @"导航属性 {0}.{1} 解析错误,实体类型 {2} 缺少主键标识,[Column(IsPrimary = true)]" : + @"FreeSql: Navigation property {0}. {1} parsing error, entity type {2} missing primary key identity, [Column (IsPrimary = true)]", trytbTypeName, pnvName, trytcTypeName); + /// + /// 导航属性 {trytbTypeName}.{pnvName} 解析错误,{trytbCsName}.{trycolCsName} 和 {tbrefCsName}.{tbrefPrimarysCsName} 类型不一致 + /// + public static string Navigation_ParsingError_InconsistentType(object trytbTypeName, object pnvName, object trytbCsName, object trycolCsName, object tbrefCsName, object tbrefPrimarysCsName) => string.Format(Language == "cn" ? + @"导航属性 {0}.{1} 解析错误,{2}.{3} 和 {4}.{5} 类型不一致" : + @"FreeSql: Navigation property {0}. {1} parsing error, {2}. {3} and {4}. {5} type inconsistent", trytbTypeName, pnvName, trytbCsName, trycolCsName, tbrefCsName, tbrefPrimarysCsName); + /// + /// 导航属性 {trytbTypeName}.{pnvName} 特性 [Navigate] 解析错误,在 {tbrefTypeName} 未找到属性:{bi} + /// + public static string Navigation_ParsingError_NotFound_Property(object trytbTypeName, object pnvName, object tbrefTypeName, object bi) => string.Format(Language == "cn" ? + @"导航属性 {0}.{1} 特性 [Navigate] 解析错误,在 {2} 未找到属性:{3}" : + @"FreeSql: Navigation property {0}. {1} attribute [Navigate] parsing error, property not found at {2}: {3}", trytbTypeName, pnvName, tbrefTypeName, bi); + /// + /// {tableTypeDisplayCsharp} 没有定义主键,无法使用 SetSource,请尝试 SetDto 或者 SetSource 指定临时主键 + /// + public static string NoPrimaryKey_UseSetDto(object tableTypeDisplayCsharp) => string.Format(Language == "cn" ? + @"{0} 没有定义主键,无法使用 SetSource,请尝试 SetDto 或者 SetSource 指定临时主键" : + @"FreeSql: {0} has no primary key defined and cannot use SetSource. Try SetDto", tableTypeDisplayCsharp); + /// + /// 没有定义属性 + /// + public static string NoProperty_Defined => Language == "cn" ? + @" 没有定义属性 " : + @"FreeSql: No properties defined"; + /// + /// 未实现 + /// + public static string Not_Implemented => Language == "cn" ? + @"未实现" : + @"FreeSql: Not implemented"; + /// + /// 未实现函数表达式 {exp} 解析 + /// + public static string Not_Implemented_Expression(object exp) => string.Format(Language == "cn" ? + @"未实现函数表达式 {0} 解析" : + @"FreeSql: Function expression {0} parsing not implemented", exp); + /// + /// 未实现函数表达式 {exp} 解析,参数 {expArguments} 必须为常量 + /// + public static string Not_Implemented_Expression_ParameterUseConstant(object exp, object expArguments) => string.Format(Language == "cn" ? + @"未实现函数表达式 {0} 解析,参数 {1} 必须为常量" : + @"FreeSql: Function expression {0} parsing not implemented, parameter {1} must be constant", exp, expArguments); + /// + /// 未实现函数表达式 {exp} 解析,如果正在操作导航属性集合,请使用 .AsSelect().{exp3MethodName}({exp3ArgumentsCount}) + /// + public static string Not_Implemented_Expression_UseAsSelect(object exp, object exp3MethodName, object exp3ArgumentsCount) => string.Format(Language == "cn" ? + @"未实现函数表达式 {0} 解析,如果正在操作导航属性集合,请使用 .AsSelect().{1}({2})" : + @"FreeSql: Function expression {0} parsing is not implemented. Use if you are working on a navigation property collection. AsSelect (). {1} ({2})", exp, exp3MethodName, exp3ArgumentsCount); + /// + /// 未实现 MemberAccess 下的 Constant + /// + public static string Not_Implemented_MemberAcess_Constant => Language == "cn" ? + @"未实现 MemberAccess 下的 Constant" : + @"FreeSql: Constant under MemberAccess is not implemented"; + /// + /// 未实现 {name} + /// + public static string Not_Implemented_Name(object name) => string.Format(Language == "cn" ? + @"未实现 {0}" : + @"FreeSql: {0} is not implemented", name); + /// + /// 不支持 + /// + public static string Not_Support => Language == "cn" ? + @"不支持" : + @"FreeSql: I won't support it"; + /// + /// {dataType} 不支持 OrderByRandom 随机排序 + /// + public static string Not_Support_OrderByRandom(object dataType) => string.Format(Language == "cn" ? + @"{0} 不支持 OrderByRandom 随机排序" : + @"FreeSql: {0} does not support OrderByRandom sorting", dataType); + /// + /// {property} 不是有效的导航属性 + /// + public static string Not_Valid_Navigation_Property(object property) => string.Format(Language == "cn" ? + @"{0} 不是有效的导航属性" : + @"FreeSql: {0} is not a valid navigation property", property); + /// + /// {dbName} 找不到列 {memberName} + /// + public static string NotFound_Column(object dbName, object memberName) => string.Format(Language == "cn" ? + @"{0} 找不到列 {1}" : + @"FreeSql: {0} Column {1} not found", dbName, memberName); + /// + /// 找不到 {CsName} 对应的列 + /// + public static string NotFound_CsName_Column(object CsName) => string.Format(Language == "cn" ? + @"找不到 {0} 对应的列" : + @"FreeSql: Cannot find the column corresponding to {0}", CsName); + /// + /// 找不到属性:{memberName} + /// + public static string NotFound_Property(object memberName) => string.Format(Language == "cn" ? + @"找不到属性:{0}" : + @"FreeSql: Attribute not found: {0}", memberName); + /// + /// 找不到属性名 {proto} + /// + public static string NotFound_PropertyName(object proto) => string.Format(Language == "cn" ? + @"找不到属性名 {0}" : + @"FreeSql: Property name {0} not found", proto); + /// + /// Custom 找不到对应的{{ 反射信息 }}:{fiValueCustomArray} + /// + public static string NotFound_Reflection(object fiValueCustomArray) => string.Format(Language == "cn" ? + @"Custom 找不到对应的{{ 反射信息 }}:{0}" : + @"FreeSql: Custom could not find the corresponding {{reflection information}}:{0}", fiValueCustomArray); + /// + /// Custom 找不到对应的{{ 静态方法名 }}:{fiValueCustomArray} + /// + public static string NotFound_Static_MethodName(object fiValueCustomArray) => string.Format(Language == "cn" ? + @"Custom 找不到对应的{{ 静态方法名 }}:{0}" : + @"FreeSql: Custom could not find the corresponding {{static method name}}:{0}", fiValueCustomArray); + /// + /// [Table(AsTable = xx)] 设置的属性名 {atmGroupsValue} 不存在 + /// + public static string NotFound_Table_Property_AsTable(object atmGroupsValue) => string.Format(Language == "cn" ? + @"[Table(AsTable = xx)] 设置的属性名 {0} 不存在" : + @"FreeSql: The property name {0} set by [Table(AsTable = xx)] does not exist", atmGroupsValue); + /// + /// 未指定 UseConnectionString 或者 UseConnectionFactory + /// + public static string NotSpecified_UseConnectionString_UseConnectionFactory => Language == "cn" ? + @"未指定 UseConnectionString 或者 UseConnectionFactory" : + @"FreeSql: No UseConnectionString or UseConnectionFactory specified"; + /// + /// 【{policyName}】ObjectPool.{GetName}() timeout {totalSeconds} seconds, see: https://github.com/dotnetcore/FreeSql/discussions/1081 + /// + public static string ObjectPool_Get_Timeout(object policyName, object GetName, object totalSeconds) => string.Format(Language == "cn" ? + @"【{0}】ObjectPool.{1}() timeout {2} seconds, see: https://github.com/dotnetcore/FreeSql/discussions/1081" : + @"FreeSql: [{0}] ObjectPool. {1}() timeout {2} seconds, see: https://github.com/dotnetcore/FreeSql/discussions/1081", policyName, GetName, totalSeconds); + /// + /// 【{policyName}】ObjectPool.GetAsync() The queue is too long. Policy.AsyncGetCapacity = {asyncGetCapacity} + /// + public static string ObjectPool_GetAsync_Queue_Long(object policyName, object asyncGetCapacity) => string.Format(Language == "cn" ? + @"【{0}】ObjectPool.GetAsync() The queue is too long. Policy.AsyncGetCapacity = {1}" : + @"FreeSql: [{0}] ObjectPool. GetAsync() The queue is too long. Policy. AsyncGetCapacity = {1}", policyName, asyncGetCapacity); + /// + /// 【OneToMany】导航属性 {trytbTypeName}.{pnvName} 在 {tbrefCsName} 中没有找到对应的字段,如:{findtrytb}{findtrytbPkCsName}、{findtrytb}_{findtrytbPkCsName} + /// + public static string OneToMany_NotFound_CorrespondingField(object trytbTypeName, object pnvName, object tbrefCsName, object findtrytb, object findtrytbPkCsName) => string.Format(Language == "cn" ? + @"【OneToMany】导航属性 {0}.{1} 在 {2} 中没有找到对应的字段,如:{3}{4}、{3}_{4}" : + @"FreeSql: [OneToMany] Navigation property {0}.{1} did not find a corresponding field in {2}, such as: {3}{4}, {3}_{4}", trytbTypeName, pnvName, tbrefCsName, findtrytb, findtrytbPkCsName); + /// + /// 【OneToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,{trytbCsName}.{trytbPrimarysCsName} 和 {tbrefCsName}.{trycolCsName} 类型不一致 + /// + public static string OneToMany_ParsingError_InconsistentType(object trytbTypeName, object pnvName, object trytbCsName, object trytbPrimarysCsName, object tbrefCsName, object trycolCsName) => string.Format(Language == "cn" ? + @"【OneToMany】导航属性 {0}.{1} 解析错误,{2}.{3} 和 {4}.{5} 类型不一致" : + @"FreeSql: [OneToMany] Navigation property {0}.{1} parsing error, {2}.{3} and {4}.{5} is of inconsistent type", trytbTypeName, pnvName, trytbCsName, trytbPrimarysCsName, tbrefCsName, trycolCsName); + /// + /// 、{refpropName}{findtrytbPkCsName}、{refpropName}_{findtrytbPkCsName}。或者使用 [Navigate] 特性指定关系映射。 + /// + public static string OneToMany_UseNavigate(object refpropName, object findtrytbPkCsName) => string.Format(Language == "cn" ? + @"、{0}{1}、{0}_{1}。或者使用 [Navigate] 特性指定关系映射。" : + @", {0}{1}, {0}_{1}. Or use the [Navigate] attribute to specify the relationship mapping.", refpropName, findtrytbPkCsName); + /// + /// 参数 field 未指定 + /// + public static string Parameter_Field_NotSpecified => Language == "cn" ? + @"参数 field 未指定" : + @"FreeSql: Parameter field not specified"; + /// + /// {property} 参数错误,它不是集合属性,必须为 IList&lt;T&gt; 或者 ICollection&lt;T&gt; + /// + public static string ParameterError_NotValid_Collection(object property) => string.Format(Language == "cn" ? + @"{0} 参数错误,它不是集合属性,必须为 IList 或者 ICollection" : + @"FreeSql: The {0} parameter is incorrect, it is not a collection property and must be IListor ICollection", property); + /// + /// {property} 参数错误,它不是有效的导航属性 + /// + public static string ParameterError_NotValid_Navigation(object property) => string.Format(Language == "cn" ? + @"{0} 参数错误,它不是有效的导航属性" : + @"FreeSql: The {0} parameter is incorrect, it is not a valid navigation property", property); + /// + /// {where} 参数错误,{keyval} 不是有效的属性名,在实体类 {reftbTypeDisplayCsharp} 无法找到 + /// + public static string ParameterError_NotValid_PropertyName(object where, object keyval, object reftbTypeDisplayCsharp) => string.Format(Language == "cn" ? + @"{0} 参数错误,{1} 不是有效的属性名,在实体类 {2} 无法找到" : + @"FreeSql: {0} parameter error, {1} is not a valid property name and cannot be found in entity class {2}", where, keyval, reftbTypeDisplayCsharp); + /// + /// {property} 参数错误,格式 "TopicId=Id,多组使用逗号连接" + /// + public static string ParameterError_NotValid_UseCommas(object property) => string.Format(Language == "cn" ? + @"{0} 参数错误,格式 ""TopicId=Id,多组使用逗号连接"" " : + @"FreeSql: {0} parameter error, format ""TopicId=Id, multiple groups using comma connection""", property); + /// + /// 解析失败 {callExpMethodName} {message} + /// + public static string Parsing_Failed(object callExpMethodName, object message) => string.Format(Language == "cn" ? + @"解析失败 {0} {1}" : + @"FreeSql: Parsing failed {0} {1}", callExpMethodName, message); + /// + /// 【{policyName}】The ObjectPool has been disposed, see: https://github.com/dotnetcore/FreeSql/discussions/1079 + /// + public static string Policy_ObjectPool_Dispose(object policyName) => string.Format(Language == "cn" ? + @"【{0}】The ObjectPool has been disposed, see: https://github.com/dotnetcore/FreeSql/discussions/1079" : + @"FreeSql: [{0}] The ObjectPool has been disposed, see: https://github.com/dotnetcore/FreeSql/discussions/1079", policyName); + /// + /// 【{policyName}】状态不可用,等待后台检查程序恢复方可使用。{UnavailableExceptionMessage} + /// + public static string Policy_Status_NotAvailable(object policyName, object UnavailableExceptionMessage) => string.Format(Language == "cn" ? + @"【{0}】状态不可用,等待后台检查程序恢复方可使用。{1}" : + @"FreeSql: The {0} status is unavailable and cannot be used until the background checker is restored. {1}", policyName, UnavailableExceptionMessage); + /// + /// 属性{trytbVersionColumnCsName} 被标注为行锁(乐观锁)(IsVersion),但其必须为数字类型 或者 byte[] 或者 string,并且不可为 Nullable + /// + public static string Properties_AsRowLock_Must_Numeric_Byte(object trytbVersionColumnCsName) => string.Format(Language == "cn" ? + @"属性{0} 被标注为行锁(乐观锁)(IsVersion),但其必须为数字类型 或者 byte[] 或者 string,并且不可为 Nullable" : + @"FreeSql: The property {0} is labeled as a row lock (optimistic lock) (IsVersion), but it must be a numeric type or byte[] or string, and it cannot be Nullable", trytbVersionColumnCsName); + /// + /// properties 参数不能为空 + /// + public static string Properties_Cannot_Null => Language == "cn" ? + @"properties 参数不能为空" : + @"FreeSql: Properrties parameter cannot be empty"; + /// + /// {property} 属性名无法找到 + /// + public static string Property_Cannot_Find(object property) => string.Format(Language == "cn" ? + @"{0} 属性名无法找到" : + @"FreeSql: {0} property name not found", property); + /// + /// Range 要求 Value 应该逗号分割,并且长度为 2 + /// + public static string Range_Comma_Separateda_By2Char => Language == "cn" ? + @"Range 要求 Value 应该逗号分割,并且长度为 2" : + @"FreeSql: Range requires that Value be comma-separated and 2-length"; + /// + /// 回滚 + /// + public static string RollBack => Language == "cn" ? + @"回滚" : + @"FreeSql: RollBack"; + /// + /// 运行时错误,反射获取 IncludeMany 方法失败 + /// + public static string RunTimeError_Reflection_IncludeMany => Language == "cn" ? + @"运行时错误,反射获取 IncludeMany 方法失败" : + @"FreeSql: Runtime error, reflection failed to get IncludeMany method"; + /// + /// {qoteSql} is NULL,除非设置特性 [Column(IsNullable = false)] + /// + public static string Set_Column_IsNullable_False(object qoteSql) => string.Format(Language == "cn" ? + @"{0} is NULL,除非设置特性 [Column(IsNullable = false)]" : + @"FreeSql: {0} is NULL unless the attribute [Column (IsNullable = false)]", qoteSql); + /// + /// 分表字段值 "{dt}" 不能小于 "{beginTime} " + /// + public static string SubTableFieldValue_CannotLessThen(object dt, object beginTime) => string.Format(Language == "cn" ? + @"分表字段值 ""{0}"" 不能小于 ""{1} """ : + @"FreeSql: Subtable field value'{0}'cannot be less than'{1}'", dt, beginTime); + /// + /// 分表字段值不能为 null + /// + public static string SubTableFieldValue_IsNotNull => Language == "cn" ? + @"分表字段值不能为 null" : + @"FreeSql: Subtable field value cannot be null"; + /// + /// 分表字段值 "{columnValue}" 不能转化成 DateTime + /// + public static string SubTableFieldValue_NotConvertDateTime(object columnValue) => string.Format(Language == "cn" ? + @"分表字段值 ""{0}"" 不能转化成 DateTime" : + @"FreeSql: The tabular field value'{0}'cannot be converted to DateTime", columnValue); + /// + /// 分表字段值 "{dt}" 未匹配到分表名 + /// + public static string SubTableFieldValue_NotMatchTable(object dt) => string.Format(Language == "cn" ? + @"分表字段值 ""{0}"" 未匹配到分表名" : + @"FreeSql: Table field value'{0}'does not match table name", dt); + /// + /// T2 类型错误 + /// + public static string T2_Type_Error => Language == "cn" ? + @"T2 类型错误" : + @"FreeSql: Type T2 Error"; + /// + /// tableName 格式错误,示例:“log_{yyyyMMdd}” + /// + public static string TableName_Format_Error(object yyyyMMdd) => string.Format(Language == "cn" ? + @"tableName 格式错误,示例:“log_{0}”" : + @"FreeSql: TableName format error, example: ""log_{0}""", yyyyMMdd); + /// + /// {Type}.AsType 参数错误,请传入正确的实体类型 + /// + public static string Type_AsType_Parameter_Error(object Type) => string.Format(Language == "cn" ? + @"{0}.AsType 参数错误,请传入正确的实体类型" : + @"FreeSql: {0}. AsType parameter error, please pass in the correct entity type", Type); + /// + /// {thatFullName} 类型无法访问构造函数 + /// + public static string Type_Cannot_Access_Constructor(object thatFullName) => string.Format(Language == "cn" ? + @"{0} 类型无法访问构造函数" : + @"FreeSql: The {0} type cannot access the constructor", thatFullName); + /// + /// {name} 类型错误 + /// + public static string Type_Error_Name(object name) => string.Format(Language == "cn" ? + @"{0} 类型错误" : + @"FreeSql: {0} type error", name); + /// + /// {Type}.AsType 参数不支持指定为 object + /// + public static string TypeAsType_NotSupport_Object(object Type) => string.Format(Language == "cn" ? + @"{0}.AsType 参数不支持指定为 object" : + @"FreeSql: {0}. AsType parameter does not support specifying as object", Type); + /// + /// 类型 {typeofFullName} 错误,不能使用 IncludeMany + /// + public static string TypeError_CannotUse_IncludeMany(object typeofFullName) => string.Format(Language == "cn" ? + @"类型 {0} 错误,不能使用 IncludeMany" : + @"FreeSql: Type {0} error, IncludeMany cannot be used", typeofFullName); + /// + /// 无法解析表达式:{exp} + /// + public static string Unable_Parse_Expression(object exp) => string.Format(Language == "cn" ? + @"无法解析表达式:{0}" : + @"FreeSql: Unable to parse expression: {0}", exp); + /// + /// 无法解析表达式方法 {exp3tmpCallMethodName} + /// + public static string Unable_Parse_ExpressionMethod(object exp3tmpCallMethodName) => string.Format(Language == "cn" ? + @"无法解析表达式方法 {0}" : + @"FreeSql: Unable to parse expression method {0}", exp3tmpCallMethodName); + /// + /// 请使用 fsql.InsertDict(dict) 方法插入字典数据 + /// + public static string Use_InsertDict_Method => Language == "cn" ? + @"请使用 fsql.InsertDict(dict) 方法插入字典数据" : + @"FreeSql: Please use fsql. InsertDict (dict) method inserts dictionary data"; + /// + /// 找不到 {name} + /// + public static string S_NotFound_Name(object name) => string.Format(Language == "cn" ? + @"找不到 {0}" : + @"FreeSql: {0} not found", name); + /// + /// 从库 + /// + public static string S_SlaveDatabase => Language == "cn" ? + @"从库" : + @"FreeSql: Slave Database"; + /// + /// 主库 + /// + public static string S_MasterDatabase => Language == "cn" ? + @"主库" : + @"FreeSql: Master Database"; + /// + /// 蛋疼的 Access 插入只能一条一条执行,不支持 values(..),(..) 也不支持 select .. UNION ALL select .. + /// + public static string S_Access_InsertOnlyOneAtTime => Language == "cn" ? + @"蛋疼的 Access 插入只能一条一条执行,不支持 values(..),(..) 也不支持 select .. UNION ALL select .." : + @"FreeSql: Egg pain Accs insertion can only be performed one at a time, values (..) are not supported. (..) Select is also not supported.. UNION ALL select.."; + /// + /// BaseEntity.Initialization 初始化错误,获取到 IFreeSql 是 null + /// + public static string S_BaseEntity_Initialization_Error => Language == "cn" ? + @"BaseEntity.Initialization 初始化错误,获取到 IFreeSql 是 null" : + @"FreeSql: BaseEntity. Initialization initialization error, get IFreeSql is null"; + /// + /// 【{thisName}】Block access and wait for recovery: {exMessage} + /// + public static string S_BlockAccess_WaitForRecovery(object thisName, object exMessage) => string.Format(Language == "cn" ? + @"【{0}】Block access and wait for recovery: {1}" : + @"FreeSql: [{0}] Block access and wait for recovery: {1}", thisName, exMessage); + /// + /// 无法将 IQueryable&lt;{typeofName}&gt; 转换为 ISelect&lt;{typeofName}&gt;,因为他的实现不是 FreeSql.Extensions.Linq.QueryableProvider + /// + public static string S_CannotBeConverted_To_ISelect(object typeofName) => string.Format(Language == "cn" ? + @"无法将 IQueryable<{0}> 转换为 ISelect<{0}>,因为他的实现不是 FreeSql.Extensions.Linq.QueryableProvider" : + @"FreeSql: IQueryable<{0}> cannot be converted to ISelect<{0}> because its implementation is not FreeSql.Extensions.Linq.QueryableProvider", typeofName); + /// + /// 连接字符串错误 + /// + public static string S_ConnectionStringError => Language == "cn" ? + @"连接字符串错误" : + @"FreeSql: Connection string error"; + /// + /// 【{thisName}】连接字符串错误,请检查。 + /// + public static string S_ConnectionStringError_Check(object thisName) => string.Format(Language == "cn" ? + @"【{0}】连接字符串错误,请检查。" : + @"FreeSql: [{0}] Connection string error, please check.", thisName); + /// + /// 连接字符串错误,或者检查项目属性 &gt; 生成 &gt; 目标平台:x86 | x64,或者改用 FreeSql.Provider.SqliteCore 访问 arm 平台 + /// + public static string S_ConnectionStringError_CheckProject => Language == "cn" ? + @"连接字符串错误,或者检查项目属性 > 生成 > 目标平台:x86 | x64,或者改用 FreeSql.Provider.SqliteCore 访问 arm 平台" : + @"FreeSql: Connection string error, or check project properties > Build > Target Platform: x86 | x64, Or use FreeSql.Provider.SqliteCore accessing arm platform"; + /// + /// 【{thisName}】连接字符串错误,请检查。或者检查项目属性 &gt; 生成 &gt; 目标平台:x86 | x64,或者改用 FreeSql.Provider.SqliteCore 访问 arm 平台 + /// + public static string S_ConnectionStringError_CheckProjectConnection(object thisName) => string.Format(Language == "cn" ? + @"【{0}】连接字符串错误,请检查。或者检查项目属性 > 生成 > 目标平台:x86 | x64,或者改用 FreeSql.Provider.SqliteCore 访问 arm 平台" : + @"FreeSql: [{0}] Connection string error, please check. Or check Project Properties > Build > Target Platform: x86 | x64, Or use FreeSql.Provider.SqliteCore accessing arm platform", thisName); + /// + /// FreeSql.Provider.CustomAdapter 无法使用 CreateCommand + /// + public static string S_CustomAdapter_Cannot_Use_CreateCommand => Language == "cn" ? + @"FreeSql.Provider.CustomAdapter 无法使用 CreateCommand" : + @"FreeSql: FreeSql.Provider.CustomAdapter cannot use CreateCommand"; + /// + /// FreeSql.Provider.CustomAdapter 仅支持 UseConnectionFactory 方式构建 IFreeSql + /// + public static string S_CustomAdapter_OnlySuppport_UseConnectionFactory => Language == "cn" ? + @"FreeSql.Provider.CustomAdapter 仅支持 UseConnectionFactory 方式构建 IFreeSql" : + @"FreeSql: FreeSql.Provider.CustomAdapter only supports building IFreeSql in the UseConnectionFactory way"; + /// + /// 达梦 CodeFirst 不支持代码创建 tablespace 与 schemas {tbname} + /// + public static string S_Dameng_NotSupport_TablespaceSchemas(object tbname) => string.Format(Language == "cn" ? + @"达梦 CodeFirst 不支持代码创建 tablespace 与 schemas {0}" : + @"FreeSql: Dream CodeFirst does not support code creation tablespace and schemas {0}", tbname); + /// + /// -DB 参数错误,未提供 ConnectionString + /// + public static string S_DB_Parameter_Error_NoConnectionString => Language == "cn" ? + @"-DB 参数错误,未提供 ConnectionString" : + @"FreeSql: -DB parameter error, no ConnectionString provided"; + /// + /// -DB 参数错误,格式为:MySql,ConnectionString + /// + public static string S_DB_ParameterError => Language == "cn" ? + @"-DB 参数错误,格式为:MySql,ConnectionString" : + @"FreeSql: -DB parameter error, format: MySql, ConnectionString"; + /// + /// -DB 参数错误,不支持的类型:"{dbargs}" + /// + public static string S_DB_ParameterError_UnsupportedType(object dbargs) => string.Format(Language == "cn" ? + @"-DB 参数错误,不支持的类型:""{0}""" : + @"FreeSql: -DB parameter error, unsupported type: ""{0}""", dbargs); + /// + /// {method} 是 FreeSql.Provider.{provider} 特有的功能 + /// + public static string S_Features_Unique(object method, object provider) => string.Format(Language == "cn" ? + @"{0} 是 FreeSql.Provider.{1} 特有的功能" : + @"FreeSql: {0} is FreeSql.Provider.{1} specific features", method, provider); + /// + /// fsql.InsertOrUpdate Sqlite 无法完成 UpdateColumns 操作 + /// + public static string S_InsertOrUpdate_Unable_UpdateColumns => Language == "cn" ? + @"fsql.InsertOrUpdate Sqlite 无法完成 UpdateColumns 操作" : + @"FreeSql: InsertOrUpdate Sqlite was unable to complete the UpdateColumns operation"; + /// + /// MygisGeometry.Parse 未实现 "{wkt}" + /// + public static string S_MygisGeometry_NotImplement(object wkt) => string.Format(Language == "cn" ? + @"MygisGeometry.Parse 未实现 ""{0}""" : + @"FreeSql: MygisGeometry. Parse does not implement ""{0}""", wkt); + /// + /// -NameOptions 参数错误,格式为:0,0,0,0 + /// + public static string S_NameOptions_Incorrect => Language == "cn" ? + @"-NameOptions 参数错误,格式为:0,0,0,0" : + @"FreeSql: -NameOptions parameter incorrect, format: 0,0,0,0"; + /// + /// 未实现该功能 + /// + public static string S_Not_Implemented_Feature => Language == "cn" ? + @" 未实现该功能" : + @"FreeSql: This function is not implemented"; + /// + /// 未实现错误,请反馈给作者 + /// + public static string S_Not_Implemented_FeedBack => Language == "cn" ? + @"未实现错误,请反馈给作者" : + @"FreeSql: Unrealized error, please feedback to author"; + /// + /// FreeSql.Provider.{providerName} 未实现 Skip/Offset 功能,如果需要分页请使用判断上一次 id + /// + public static string S_NotImplementSkipOffset(object providerName) => string.Format(Language == "cn" ? + @"FreeSql.Provider.{0} 未实现 Skip/Offset 功能,如果需要分页请使用判断上一次 id" : + @"FreeSql: FreeSql.Provider.{0} does not implement Skip/Offset functionality, use to determine last ID if paging is required", providerName); + /// + /// 旧表(OldName):{tboldname} 存在,数据库已存在 {tbname} 表,无法改名 + /// + public static string S_OldTableExists(object tboldname, object tbname) => string.Format(Language == "cn" ? + @"旧表(OldName):{0} 存在,数据库已存在 {1} 表,无法改名" : + @"FreeSql: Old table (OldName): {0} exists, database already exists {1} table, cannot rename", tboldname, tbname); + /// + /// OnConflictDoUpdate 功能要求实体类必须设置 IsPrimary 属性 + /// + public static string S_OnConflictDoUpdate_MustIsPrimary => Language == "cn" ? + @"OnConflictDoUpdate 功能要求实体类必须设置 IsPrimary 属性" : + @"FreeSql: The OnConflictDoUpdate feature requires that entity classes must set the IsPrimary property"; + /// + /// Oracle CodeFirst 不支持代码创建 tablespace 与 schemas {tbname} + /// + public static string S_Oracle_NotSupport_TablespaceSchemas(object tbname) => string.Format(Language == "cn" ? + @"Oracle CodeFirst 不支持代码创建 tablespace 与 schemas {0}" : + @"FreeSql: Oracle CodeFirst does not support code creation of tablespace and schemas {0}", tbname); + /// + /// 解析失败 {callExpMethodName} {message},提示:可以使用扩展方法 IQueryable.RestoreToSelect() 还原为 ISelect 再查询 + /// + public static string S_ParsingFailed_UseRestoreToSelect(object callExpMethodName, object message) => string.Format(Language == "cn" ? + @"解析失败 {0} {1},提示:可以使用扩展方法 IQueryable.RestoreToSelect() 还原为 ISelect 再查询" : + @"FreeSql: Parsing failed {0} {1}, hint: Extension method IQueryable can be used. RestoreToSelect() reverted to ISelect re-query", callExpMethodName, message); + /// + /// fsql.InsertOrUpdate + IfExistsDoNothing + {providerName}要求实体类 {tableCsName} 必须有主键 + /// + public static string S_RequiresEntityPrimaryKey(object providerName, object tableCsName) => string.Format(Language == "cn" ? + @"fsql.InsertOrUpdate + IfExistsDoNothing + {0}要求实体类 {1} 必须有主键" : + @"FreeSql: InsertOrUpdate + IfExistsDoNothing + {0} requires the entity class {1} to have a primary key", providerName, tableCsName); + /// + /// SelectMany 错误的类型:{typeFullName} + /// + public static string S_SelectManayErrorType(object typeFullName) => string.Format(Language == "cn" ? + @"SelectMany 错误的类型:{0}" : + @"FreeSql: SelectMany error type: {0}", typeFullName); + /// + /// 类型 {objentityTypeFullName} 不可迁移 + /// + public static string S_Type_IsNot_Migrable(object objentityTypeFullName) => string.Format(Language == "cn" ? + @"类型 {0} 不可迁移" : + @"FreeSql: Type {0} is not migrable", objentityTypeFullName); + /// + /// 类型 {objentityTypeFullName} 不可迁移,可迁移属性0个 + /// + public static string S_Type_IsNot_Migrable_0Attributes(object objentityTypeFullName) => string.Format(Language == "cn" ? + @"类型 {0} 不可迁移,可迁移属性0个" : + @"FreeSql: Type {0} is not migrable, migratable property 0", objentityTypeFullName); + /// + /// 未实现 {columnDbTypeTextFull} 类型映射 + /// + public static string S_TypeMappingNotImplemented(object columnDbTypeTextFull) => string.Format(Language == "cn" ? + @"未实现 {0} 类型映射" : + @"FreeSql: {0} type mapping not implemented", columnDbTypeTextFull); + /// + /// 错误的参数设置:{args} + /// + public static string S_WrongParameter(object args) => string.Format(Language == "cn" ? + @"错误的参数设置:{0}" : + @"FreeSql: Wrong parameter setting: {0}", args); + /// + /// 对象池 + /// + public static string S_ObjectPool => Language == "cn" ? + @"对象池" : + @"FreeSql: Object pool"; + } +} + +/* +var xml1 = ` + + FreeSql: [Table(AsTable="{asTable}")] Property value formatted incorrectly + + + FreeSql: The property name {atmGroupsValue} set by [Table (AsTable = xx)] is not of type DateTime + + + FreeSql: {name}: Failed to get resource {statistics} + + + FreeSql: {name}: An exception needs to be thrown + + + FreeSql: Wrong expression format {column} + + + FreeSql: Select is not available until the Chunk function + + + FreeSql: For security reasons, be sure to use ForUpdate after the transaction is open + + + FreeSql: Cannot be null + + + FreeSql: {name} cannot be null + + + FreeSql: Unable to match {property} + + + FreeSql: {property} cannot be resolved to an expression tree + + + FreeSql: The parameter master ConnectionString cannot be empty, check UseConnectionString + + + FreeSql: Commit + + + FreeSql: Connection failed, ready to switch other available servers + + + FreeSql: Custom expression parsing error: type {exp3MethodDeclaringType} needs to define static ThreadLocal<ExpressionCallContext>field, field, field (important three reminders) + + + FreeSql: Custom {Reflection Information} cannot be empty, format: {static method name}{space}{reflection information} + + + FreeSql: Custom {static method name} cannot be empty, format: {static method name}{space}{reflection information} + + + FreeSql: Custom corresponding {{static method name}}:{fiValueCustomArray} The [DynamicFilterCustomAttribute] attribute is not set + + + FreeSql: Custom requires that Fields be space-split and 2-length in the format: {static method name}{space}{reflection information} + + + FreeSql: The data type of the operation ({dataDisplayCsharp}) is inconsistent with AsType ({tableTypeDisplayCsharp}). Please check. + + + FreeSql: DateRange requires that Value be comma-separated and 2-length + + + FreeSql: DateRange requires that the Value [1] format must be: yyyy, yyyy-MM, yyyy-MM-dd, yyyyy-MM-dd HH, yyyy, yyyy-MM-dd HH:mm + + + FreeSql: The record may not exist, or the row level optimistic lock version is out of date, the number of updates {sourceCount}, the number of rows affected {affrows}. + + + FreeSql: The number of SlaveConnectionStrings is not the same as SlaveWeights + + + FreeSql: ColumnAttribute. Name {colattrName} exists repeatedly, please check (note: case insensitive) + + + FreeSql: Property name {pName} exists repeatedly, please check (note: case insensitive) + + + FreeSql: The {function} feature requires that the entity class {tableCsName} must have a primary key + + + FreeSql: {tbTypeFullName} is a parent-child relationship, but combinations of multiple primary keys are not supported in versions below MySql 8.0 + + + FreeSql: {tbTypeFullName} is not a parent-child relationship and cannot be used + + + FreeSql: This particular subquery cannot be resolved + + + FreeSql: Expression error, its top object is not ParameterExpression:{exp} + + + FreeSql: Expression error, it is not a continuous MemberAccess type: {exp} + + + FreeSql: ExpressionTree conversion type error, value ({value}), type ({valueTypeFullName}), target type ({typeFullName}), Error:{exMessage} + + + FreeSql: Failed to parse table field value {sqlWhere} + + + FreeSql: Function {asTable} not implemented by AsTable + + + FreeSql: GBase does not support separators other than commas at this time + + + FreeSql: TableName:{tableName} generated the same table name + + + FreeSql: The parameter'{primary}'passed by GetPrimarys is incorrect and does not belong to the key name of the dictionary data + + + FreeSql: {first} has already been specified and {second} can no longer be specified + + + FreeSql: {tb2DbName}. {mp2MemberName} is ignored. Check the IsIgnore setting to make sure get/set is public + + + FreeSql: Include parameter type error + + + FreeSql: Include parameter type is wrong, use IncludeMany for collection properties + + + FreeSql: Include parameter type is wrong, expression type should be MemberAccess + + + FreeSql: The property {collMemMemberName} of IncludeMany type {tbTypeDisplayCsharp} is not a valid navigation property, hint: IsIgnore = true will not be a navigation property + + + FreeSql: IncludeMany {navigateSelector} parameter is wrong, Select can only use one parameter's method, the correct format:.Select(t =>new TNavigate{{}}) + + + FreeSql: IncludeMany {navigateSelector} parameter error, Select lambda parameter return value must match {collMemElementType} type + + + FreeSql: IncludeMany parameter 1 has wrong type, expression type should be MemberAccess + + + FreeSql: IncludeMany {navigateSelector} parameter type is wrong, correct format: a.collections.Take(1).Where(c => C.A ID == a.id).Select (a => new TNavigate{{}}) + + + FreeSql: ISelect. InsertInto() did not select an attribute: {displayCsharp} + + + FreeSql: ISelect. InsertInto() type error: {displayCsharp} + + + FreeSql: The InsertOrUpdate function performs merge into requiring the entity class {CsName} to have a primary key + + + FreeSql: The generic parameter for InsertOrUpdate<>does not support {typeofT1}. Pass in your entity class + + + FreeSql: FreeSql needs to be installed for Delayed Loading. Extensions. LazyLoading. Dll, downloadable to nuget + + + FreeSql: {trytbTypeName} Compilation error: {exMessage}\r\n\r\n{cscode} + + + FreeSql: Entity type {trytbTypeName} must be declared public + + + FreeSql: ManyToMany navigation properties. AsSelect() is temporarily unavailable for the Sum/Avg/Max/Min/First/ToOne/ToList method + + + FreeSql: [ManyToMany] Navigation property {trytbTypeName}. {pnvName} did not find a corresponding field in {tbmidCsName}, such as: {midTypePropsTrytbName}{findtrytbPkCsName}, {midTypePropsTrytbName}_ {findtrytbPkCsName} + + + FreeSql: [ManyToMany] Navigation property {trytbTypeName}. {pnvName} parsing error, entity type {tbrefTypeName} missing primary key identity, [Column (IsPrimary = true)] + + + FreeSql: [ManyToMany] Navigation property {trytbTypeName}. {pnvName} parsing error, entity type {tbrefTypeName} must have a corresponding [Navigate (ManyToMany = x)] collection property + + + FreeSql: [ManyToMany] Navigation property {trytbTypeName}. {pnvName} parsing error, {tbmidCsName}. {trycolCsName} and {trytbCsName}. {trytbPrimarysCsName} type inconsistent + + + FreeSql: [ManyToMany] Navigation property {trytbTypeName}. {pnvName} parsing error, intermediate class {tbmidCsName}.{midTypePropsTrytbName} Error: {exMessage} + + + FreeSql: [ManyToMany] Navigation property {trytbTypeName}. {pnvName} parsing error, intermediate class {tbmidCsName}. The {midTypePropsTrytbName} navigation property is not ManyToOne or OneToOne + + + FreeSql: Mapping exception: {name} None of the property names are the same + + + FreeSql: Ado. MasterPool value is null, this operation cannot self-enable transactions, please explicitly pass [transaction object] resolution + + + FreeSql: Missing FreeSql database implementation package: FreeSql.Provider.{Provider}.Dll, downloadable to nuget + + + FreeSql: The FreeSql database implementation package is missing: {dll} can be downloaded to nuget; If there is {dll} and an error still occurs (due to environmental issues that cause the type to be unreflected), manually pass in typeof ({providerType}) in the third parameter of UseConnectionString/UseConnectionFactory + + + FreeSql: Navigation property {trytbTypeName}. The number of {pnvName} attributes [Navigate] Binds ({bindColumnsCount}) is different from the number of external primary keys ({tbrefPrimarysLength}) + + + FreeSql: {tb2DbName}. {mp2MemberName} Navigation Property Collection forgotten. AsSelect()? If used in ToList (a => a. {mp2MemberName}), step by step to refer to the IncludeMany document. + + + FreeSql: Navigation Properties {trytbTypeDisplayCsharp}. Missing set attribute for {pName} + + + FreeSql: Navigation property {trytbTypeName}. {pnvName} No corresponding fields were found, such as: {pnvName}{findtbrefPkCsName}, {pnvName}_ {findtbrefPkCsName}. Or use the [Navigate] attribute to specify the relationship mapping. + + + FreeSql: Navigation property {trytbTypeName}. {pnvName} parsing error, entity type {trytcTypeName} missing primary key identity, [Column (IsPrimary = true)] + + + FreeSql: Navigation property {trytbTypeName}. {pnvName} parsing error, {trytbCsName}. {trycolCsName} and {tbrefCsName}. {tbrefPrimarysCsName} type inconsistent + + + FreeSql: Navigation property {trytbTypeName}. {pnvName} attribute [Navigate] parsing error, property not found at {tbrefTypeName}: {bi} + + + FreeSql: {tableTypeDisplayCsharp} has no primary key defined and cannot use SetSource. Try SetDto + + + FreeSql: No properties defined + + + FreeSql: Not implemented + + + FreeSql: Function expression {exp} parsing not implemented + + + FreeSql: Function expression {exp} parsing not implemented, parameter {expArguments} must be constant + + + FreeSql: Function expression {exp} parsing is not implemented. Use if you are working on a navigation property collection. AsSelect (). {exp3MethodName} ({exp3ArgumentsCount}) + + + FreeSql: Constant under MemberAccess is not implemented + + + FreeSql: {name} is not implemented + + + FreeSql: I won't support it + + + FreeSql: {dataType} does not support OrderByRandom sorting + + + FreeSql: {property} is not a valid navigation property + + + FreeSql: {dbName} Column {memberName} not found + + + FreeSql: Cannot find the column corresponding to {CsName} + + + FreeSql: Attribute not found: {memberName} + + + FreeSql: Property name {proto} not found + + + FreeSql: Custom could not find the corresponding {{reflection information}}:{fiValueCustomArray} + + + FreeSql: Custom could not find the corresponding {{static method name}}:{fiValueCustomArray} + + + FreeSql: The property name {atmGroupsValue} set by [Table(AsTable = xx)] does not exist + + + FreeSql: No UseConnectionString or UseConnectionFactory specified + + + FreeSql: [{policyName}] ObjectPool. {GetName}() timeout {totalSeconds} seconds, see: https://github.com/dotnetcore/FreeSql/discussions/1081 + + + FreeSql: [{policyName}] ObjectPool. GetAsync() The queue is too long. Policy. AsyncGetCapacity = {asyncGetCapacity} + + + FreeSql: [OneToMany] Navigation property {trytbTypeName}.{pnvName} did not find a corresponding field in {tbrefCsName}, such as: {findtrytb}{findtrytbPkCsName}, {findtrytb}_{findtrytbPkCsName} + + + FreeSql: [OneToMany] Navigation property {trytbTypeName}.{pnvName} parsing error, {trytbCsName}.{trytbPrimarysCsName} and {tbrefCsName}.{trycolCsName} is of inconsistent type + + + , {refpropName}{findtrytbPkCsName}, {refpropName}_{findtrytbPkCsName}. Or use the [Navigate] attribute to specify the relationship mapping. + + + FreeSql: Parameter field not specified + + + FreeSql: The {property} parameter is incorrect, it is not a collection property and must be IList<T>or ICollection<T> + + + FreeSql: The {property} parameter is incorrect, it is not a valid navigation property + + + FreeSql: {where} parameter error, {keyval} is not a valid property name and cannot be found in entity class {reftbTypeDisplayCsharp} + + + FreeSql: {property} parameter error, format "TopicId=Id, multiple groups using comma connection" + + + FreeSql: Parsing failed {callExpMethodName} {message} + + + FreeSql: [{policyName}] The ObjectPool has been disposed, see: https://github.com/dotnetcore/FreeSql/discussions/1079 + + + FreeSql: The {policyName} status is unavailable and cannot be used until the background checker is restored. {UnavailableExceptionMessage} + + + FreeSql: The property {trytbVersionColumnCsName} is labeled as a row lock (optimistic lock) (IsVersion), but it must be a numeric type or byte[] or string, and it cannot be Nullable + + + FreeSql: Properrties parameter cannot be empty + + + FreeSql: {property} property name not found + + + FreeSql: Range requires that Value be comma-separated and 2-length + + + FreeSql: RollBack + + + FreeSql: Runtime error, reflection failed to get IncludeMany method + + + FreeSql: {qoteSql} is NULL unless the attribute [Column (IsNullable = false)] + + + FreeSql: Subtable field value'{dt}'cannot be less than'{beginTime}' + + + FreeSql: Subtable field value cannot be null + + + FreeSql: The tabular field value'{columnValue}'cannot be converted to DateTime + + + FreeSql: Table field value'{dt}'does not match table name + + + FreeSql: Type T2 Error + + + FreeSql: TableName format error, example: "log_{yyyyMMdd}" + + + FreeSql: {Type}. AsType parameter error, please pass in the correct entity type + + + FreeSql: The {thatFullName} type cannot access the constructor + + + FreeSql: {name} type error + + + FreeSql: {Type}. AsType parameter does not support specifying as object + + + FreeSql: Type {typeofFullName} error, IncludeMany cannot be used + + + FreeSql: Unable to parse expression: {exp} + + + FreeSql: Unable to parse expression method {exp3tmpCallMethodName} + + + FreeSql: Please use fsql. InsertDict (dict) method inserts dictionary data + + + FreeSql: {name} not found + + + FreeSql: Slave Database + + + FreeSql: Master Database + + + FreeSql: Egg pain Accs insertion can only be performed one at a time, values (..) are not supported. (..) Select is also not supported.. UNION ALL select.. + + + FreeSql: BaseEntity. Initialization initialization error, get IFreeSql is null + + + FreeSql: [{thisName}] Block access and wait for recovery: {exMessage} + + + FreeSql: IQueryable<{typeofName}> cannot be converted to ISelect<{typeofName}> because its implementation is not FreeSql.Extensions.Linq.QueryableProvider + + + FreeSql: Connection string error + + + FreeSql: [{thisName}] Connection string error, please check. + + + FreeSql: Connection string error, or check project properties > Build > Target Platform: x86 | x64, Or use FreeSql.Provider.SqliteCore accessing arm platform + + + FreeSql: [{thisName}] Connection string error, please check. Or check Project Properties > Build > Target Platform: x86 | x64, Or use FreeSql.Provider.SqliteCore accessing arm platform + + + FreeSql: FreeSql.Provider.CustomAdapter cannot use CreateCommand + + + FreeSql: FreeSql.Provider.CustomAdapter only supports building IFreeSql in the UseConnectionFactory way + + + FreeSql: Dream CodeFirst does not support code creation tablespace and schemas {tbname} + + + FreeSql: -DB parameter error, no ConnectionString provided + + + FreeSql: -DB parameter error, format: MySql, ConnectionString + + + FreeSql: -DB parameter error, unsupported type: "{dbargs}" + + + FreeSql: {method} is FreeSql.Provider.{provider} specific features + + + FreeSql: InsertOrUpdate Sqlite was unable to complete the UpdateColumns operation + + + FreeSql: MygisGeometry. Parse does not implement "{wkt}" + + + FreeSql: -NameOptions parameter incorrect, format: 0,0,0,0 + + + FreeSql: This function is not implemented + + + FreeSql: Unrealized error, please feedback to author + + + FreeSql: FreeSql.Provider.{providerName} does not implement Skip/Offset functionality, use to determine last ID if paging is required + + + FreeSql: Old table (OldName): {tboldname} exists, database already exists {tbname} table, cannot rename + + + FreeSql: The OnConflictDoUpdate feature requires that entity classes must set the IsPrimary property + + + FreeSql: Oracle CodeFirst does not support code creation of tablespace and schemas {tbname} + + + FreeSql: Parsing failed {callExpMethodName} {message}, hint: Extension method IQueryable can be used. RestoreToSelect() reverted to ISelect re-query + + + FreeSql: InsertOrUpdate + IfExistsDoNothing + {providerName} requires the entity class {tableCsName} to have a primary key + + + FreeSql: SelectMany error type: {typeFullName} + + + FreeSql: Type {objentityTypeFullName} is not migrable + + + FreeSql: Type {objentityTypeFullName} is not migrable, migratable property 0 + + + FreeSql: {columnDbTypeTextFull} type mapping not implemented + + + FreeSql: Wrong parameter setting: {args} + + + FreeSql: Object pool + `; + +var xml2= ` + [Table(AsTable = "{asTable}")] 特性值格式错误 + + + [Table(AsTable = xx)] 设置的属性名 {atmGroupsValue} 不是 DateTime 类型 + + + {name}: Failed to get resource {statistics} + + + {name}: An exception needs to be thrown + + + 错误的表达式格式 {column} + + + Chunk 功能之前不可使用 Select + + + 安全起见,请务必在事务开启之后,再使用 ForUpdate + + + 不能为 null + + + {name} 不能为 null + + + 无法匹配 {property} + + + {property} 无法解析为表达式树 + + + 参数 masterConnectionString 不可为空,请检查 UseConnectionString + + + 提交 + + + 连接失败,准备切换其他可用服务器 + + + 自定义表达式解析错误:类型 {exp3MethodDeclaringType} 需要定义 static ThreadLocal<ExpressionCallContext> 字段、字段、字段(重要三次提醒) + + + Custom { 反射信息 }不能为空,格式:{ 静态方法名 }{ 空格 }{ 反射信息 } + + + Custom { 静态方法名 }不能为空,格式:{ 静态方法名 }{ 空格 }{ 反射信息 } + + + Custom 对应的{{ 静态方法名 }}:{fiValueCustomArray} 未设置 [DynamicFilterCustomAttribute] 特性 + + + Custom 要求 Field 应该空格分割,并且长度为 2,格式:{ 静态方法名 }{ 空格 }{ 反射信息 } + + + 操作的数据类型({dataDisplayCsharp}) 与 AsType({tableTypeDisplayCsharp}) 不一致,请检查。 + + + DateRange 要求 Value 应该逗号分割,并且长度为 2 + + + DateRange 要求 Value[1] 格式必须为:yyyy、yyyy-MM、yyyy-MM-dd、yyyy-MM-dd HH、yyyy、yyyy-MM-dd HH:mm + + + 记录可能不存在,或者【行级乐观锁】版本过旧,更新数量{sourceCount},影响的行数{affrows}。 + + + SlaveConnectionString 数量与 SlaveWeights 不相同 + + + ColumnAttribute.Name {colattrName} 重复存在,请检查(注意:不区分大小写) + + + 属性名 {pName} 重复存在,请检查(注意:不区分大小写) + + + {function} 功能要求实体类 {tableCsName} 必须有主键 + + + {tbTypeFullName} 是父子关系,但是 MySql 8.0 以下版本中不支持组合多主键 + + + {tbTypeFullName} 不是父子关系,无法使用该功能 + + + 这个特别的子查询不能解析 + + + 表达式错误,它的顶级对象不是 ParameterExpression:{exp} + + + 表达式错误,它不是连续的 MemberAccess 类型:{exp} + + + ExpressionTree 转换类型错误,值({value}),类型({valueTypeFullName}),目标类型({typeFullName}),{exMessage} + + + 未能解析分表字段值 {sqlWhere} + + + AsTable 未实现的功能 {asTable} + + + GBase 暂时不支持逗号以外的分割符 + + + tableName:{tableName} 生成了相同的分表名 + + + GetPrimarys 传递的参数 "{primary}" 不正确,它不属于字典数据的键名 + + + 已经指定了 {first},不能再指定 {second} + + + {tb2DbName}.{mp2MemberName} 被忽略,请检查 IsIgnore 设置,确认 get/set 为 public + + + Include 参数类型错误 + + + Include 参数类型错误,集合属性请使用 IncludeMany + + + Include 参数类型错误,表达式类型应该为 MemberAccess + + + IncludeMany 类型 {tbTypeDisplayCsharp} 的属性 {collMemMemberName} 不是有效的导航属性,提示:IsIgnore = true 不会成为导航属性 + + + IncludeMany {navigateSelector} 参数错误,Select 只可以使用一个参数的方法,正确格式:.Select(t =>new TNavigate {{}}) + + + IncludeMany {navigateSelector} 参数错误,Select lambda参数返回值必须和 {collMemElementType} 类型一致 + + + IncludeMany 参数1 类型错误,表达式类型应该为 MemberAccess + + + IncludeMany {navigateSelector} 参数类型错误,正确格式: a.collections.Take(1).Where(c =>c.aid == a.id).Select(a=> new TNavigate{{}}) + + + ISelect.InsertInto() 未选择属性: {displayCsharp} + + + ISelect.InsertInto() 类型错误: {displayCsharp} + + + InsertOrUpdate 功能执行 merge into 要求实体类 {CsName} 必须有主键 + + + InsertOrUpdate<>的泛型参数 不支持 {typeofT1},请传递您的实体类 + + + 【延时加载】功能需要安装 FreeSql.Extensions.LazyLoading.dll,可前往 nuget 下载 + + + 【延时加载】{trytbTypeName} 编译错误:{exMessage}\r\n\r\n{cscode} + + + 【延时加载】实体类型 {trytbTypeName} 必须声明为 public + + + ManyToMany 导航属性 .AsSelect() 暂时不可用于 Sum/Avg/Max/Min/First/ToOne/ToList 方法 + + + 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 在 {tbmidCsName} 中没有找到对应的字段,如:{midTypePropsTrytbName}{findtrytbPkCsName}、{midTypePropsTrytbName}_{findtrytbPkCsName} + + + 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,实体类型 {tbrefTypeName} 缺少主键标识,[Column(IsPrimary = true)] + + + 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,实体类型 {tbrefTypeName} 必须存在对应的 [Navigate(ManyToMany = x)] 集合属性 + + + 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,{tbmidCsName}.{trycolCsName} 和 {trytbCsName}.{trytbPrimarysCsName} 类型不一致 + + + 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,中间类 {tbmidCsName}.{midTypePropsTrytbName} 错误:{exMessage} + + + 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,中间类 {tbmidCsName}.{midTypePropsTrytbName} 导航属性不是【ManyToOne】或【OneToOne】 + + + 映射异常:{name} 没有一个属性名相同 + + + Ado.MasterPool 值为 null,该操作无法自启用事务,请显式传递【事务对象】解决 + + + 缺少 FreeSql 数据库实现包:FreeSql.Provider.{Provider}.dll,可前往 nuget 下载 + + + 缺少 FreeSql 数据库实现包:{dll},可前往 nuget 下载;如果存在 {dll} 依然报错(原因是环境问题导致反射不到类型),请在 UseConnectionString/UseConnectionFactory 第三个参数手工传入 typeof({providerType}) + + + 导航属性 {trytbTypeName}.{pnvName} 特性 [Navigate] Bind 数目({bindColumnsCount}) 与 外部主键数目({tbrefPrimarysLength}) 不相同 + + + {tb2DbName}.{mp2MemberName} 导航属性集合忘了 .AsSelect() 吗?如果在 ToList(a => a.{mp2MemberName}) 中使用,请移步参考 IncludeMany 文档。 + + + 【导航属性】{trytbTypeDisplayCsharp}.{pName} 缺少 set 属性 + + + 导航属性 {trytbTypeName}.{pnvName} 没有找到对应的字段,如:{pnvName}{findtbrefPkCsName}、{pnvName}_{findtbrefPkCsName}。或者使用 [Navigate] 特性指定关系映射。 + + + 导航属性 {trytbTypeName}.{pnvName} 解析错误,实体类型 {trytcTypeName} 缺少主键标识,[Column(IsPrimary = true)] + + + 导航属性 {trytbTypeName}.{pnvName} 解析错误,{trytbCsName}.{trycolCsName} 和 {tbrefCsName}.{tbrefPrimarysCsName} 类型不一致 + + + 导航属性 {trytbTypeName}.{pnvName} 特性 [Navigate] 解析错误,在 {tbrefTypeName} 未找到属性:{bi} + + + {tableTypeDisplayCsharp} 没有定义主键,无法使用 SetSource,请尝试 SetDto 或者 SetSource 指定临时主键 + + + 没有定义属性 + + + 未实现 + + + 未实现函数表达式 {exp} 解析 + + + 未实现函数表达式 {exp} 解析,参数 {expArguments} 必须为常量 + + + 未实现函数表达式 {exp} 解析,如果正在操作导航属性集合,请使用 .AsSelect().{exp3MethodName}({exp3ArgumentsCount}) + + + 未实现 MemberAccess 下的 Constant + + + 未实现 {name} + + + 不支持 + + + {dataType} 不支持 OrderByRandom 随机排序 + + + {property} 不是有效的导航属性 + + + {dbName} 找不到列 {memberName} + + + 找不到 {CsName} 对应的列 + + + 找不到属性:{memberName} + + + 找不到属性名 {proto} + + + Custom 找不到对应的{{ 反射信息 }}:{fiValueCustomArray} + + + Custom 找不到对应的{{ 静态方法名 }}:{fiValueCustomArray} + + + [Table(AsTable = xx)] 设置的属性名 {atmGroupsValue} 不存在 + + + 未指定 UseConnectionString 或者 UseConnectionFactory + + + 【{policyName}】ObjectPool.{GetName}() timeout {totalSeconds} seconds, see: https://github.com/dotnetcore/FreeSql/discussions/1081 + + + 【{policyName}】ObjectPool.GetAsync() The queue is too long. Policy.AsyncGetCapacity = {asyncGetCapacity} + + + 【OneToMany】导航属性 {trytbTypeName}.{pnvName} 在 {tbrefCsName} 中没有找到对应的字段,如:{findtrytb}{findtrytbPkCsName}、{findtrytb}_{findtrytbPkCsName} + + + 【OneToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,{trytbCsName}.{trytbPrimarysCsName} 和 {tbrefCsName}.{trycolCsName} 类型不一致 + + + 、{refpropName}{findtrytbPkCsName}、{refpropName}_{findtrytbPkCsName}。或者使用 [Navigate] 特性指定关系映射。 + + + 参数 field 未指定 + + + {property} 参数错误,它不是集合属性,必须为 IList<T> 或者 ICollection<T> + + + {property} 参数错误,它不是有效的导航属性 + + + {where} 参数错误,{keyval} 不是有效的属性名,在实体类 {reftbTypeDisplayCsharp} 无法找到 + + + {property} 参数错误,格式 "TopicId=Id,多组使用逗号连接" + + + 解析失败 {callExpMethodName} {message} + + + 【{policyName}】The ObjectPool has been disposed, see: https://github.com/dotnetcore/FreeSql/discussions/1079 + + + 【{policyName}】状态不可用,等待后台检查程序恢复方可使用。{UnavailableExceptionMessage} + + + 属性{trytbVersionColumnCsName} 被标注为行锁(乐观锁)(IsVersion),但其必须为数字类型 或者 byte[] 或者 string,并且不可为 Nullable + + + properties 参数不能为空 + + + {property} 属性名无法找到 + + + Range 要求 Value 应该逗号分割,并且长度为 2 + + + 回滚 + + + 运行时错误,反射获取 IncludeMany 方法失败 + + + 蛋疼的 Access 插入只能一条一条执行,不支持 values(..),(..) 也不支持 select .. UNION ALL select .. + Providers + + + BaseEntity.Initialization 初始化错误,获取到 IFreeSql 是 null + Extensions + + + 【{thisName}】Block access and wait for recovery: {exMessage} + Providers + + + 无法将 IQueryable<{typeofName}> 转换为 ISelect<{typeofName}>,因为他的实现不是 FreeSql.Extensions.Linq.QueryableProvider + Extensions + + + 连接字符串错误 + Providers + + + 【{thisName}】连接字符串错误,请检查。 + Providers + + + 连接字符串错误,或者检查项目属性 > 生成 > 目标平台:x86 | x64,或者改用 FreeSql.Provider.SqliteCore 访问 arm 平台 + Providers + + + 【{thisName}】连接字符串错误,请检查。或者检查项目属性 > 生成 > 目标平台:x86 | x64,或者改用 FreeSql.Provider.SqliteCore 访问 arm 平台 + Providers + + + FreeSql.Provider.CustomAdapter 无法使用 CreateCommand + Providers + + + FreeSql.Provider.CustomAdapter 仅支持 UseConnectionFactory 方式构建 IFreeSql + Providers + + + 达梦 CodeFirst 不支持代码创建 tablespace 与 schemas {tbname} + Providers + + + -DB 参数错误,未提供 ConnectionString + Extensions + + + -DB 参数错误,格式为:MySql,ConnectionString + Extensions + + + -DB 参数错误,不支持的类型:"{dbargs}" + Extensions + + + {method} 是 FreeSql.Provider.{provider} 特有的功能 + Providers + + + fsql.InsertOrUpdate Sqlite 无法完成 UpdateColumns 操作 + Providers + + + 主库 + Providers + + + MygisGeometry.Parse 未实现 "{wkt}" + Providers + + + -NameOptions 参数错误,格式为:0,0,0,0 + Extensions + + + 未实现该功能 + Providers + + + 未实现错误,请反馈给作者 + Providers + + + 找不到 {name} + Providers + + + FreeSql.Provider.{providerName} 未实现 Skip/Offset 功能,如果需要分页请使用判断上一次 id + Providers + + + 对象池 + Providers + + + 旧表(OldName):{tboldname} 存在,数据库已存在 {tbname} 表,无法改名 + Providers + + + OnConflictDoUpdate 功能要求实体类必须设置 IsPrimary 属性 + Providers + + + Oracle CodeFirst 不支持代码创建 tablespace 与 schemas {tbname} + Providers + + + 解析失败 {callExpMethodName} {message},提示:可以使用扩展方法 IQueryable.RestoreToSelect() 还原为 ISelect 再查询 + Extensions + + + fsql.InsertOrUpdate + IfExistsDoNothing + {providerName}要求实体类 {tableCsName} 必须有主键 + Providers + + + SelectMany 错误的类型:{typeFullName} + Extensions + + + 从库 + Providers + + + 类型 {objentityTypeFullName} 不可迁移 + Providers + + + 类型 {objentityTypeFullName} 不可迁移,可迁移属性0个 + Providers + + + 未实现 {columnDbTypeTextFull} 类型映射 + Providers + + + 错误的参数设置:{args} + Extensions + + + {qoteSql} is NULL,除非设置特性 [Column(IsNullable = false)] + + + 分表字段值 "{dt}" 不能小于 "{beginTime} " + + + 分表字段值不能为 null + + + 分表字段值 "{columnValue}" 不能转化成 DateTime + + + 分表字段值 "{dt}" 未匹配到分表名 + + + T2 类型错误 + + + tableName 格式错误,示例:“log_{yyyyMMdd}” + + + {Type}.AsType 参数错误,请传入正确的实体类型 + + + {thatFullName} 类型无法访问构造函数 + + + {name} 类型错误 + + + {Type}.AsType 参数不支持指定为 object + + + 类型 {typeofFullName} 错误,不能使用 IncludeMany + + + 无法解析表达式:{exp} + + + 无法解析表达式方法 {exp3tmpCallMethodName} + + + 请使用 fsql.InsertDict(dict) 方法插入字典数据 + `; + +$(document.body).append(xml1); +$(document.body).append(xml2); + +var sb = 'public static class ErrorStrings {\r\npublic static string Language = "en";'; +var datas = $('#xml1 data'); +for (var a= 0; a < datas.length; a++) { + var name = $(datas[a]).attr('name'); + var en = $(datas[a]).find('value').text(); + var cn = $('#xml2 data[name="' + name + '"]').find('value').text(); + console.log(name + ':' + en + '|' + cn); + sb += ` + /// + /// ` + cn.replace(//g, '>').replace(/&/g, '&').split('\n')[0].replace(/\n/, '').replace(/\r\n/g, '') + ` + /// `; + var args = en.match(/\{(\w+)\}/g); + if (args == null || args.length == 0) { + sb += '\r\n public static string ' + name + ' => Language == "cn" ? \r\n @"' + cn.replace(/"/g, '""') + '" : \r\n @"' + en.replace(/"/g, '""') + '";'; + } + else if (args.length > 0) { + sb += '\r\n public static string ' + name + '('; + var csargs = []; + var csargsdict = {}; + for (var b = 0; b < args.length; b++) { + var argname = args[b].substr(1, args[b].length - 2); + if (csargsdict[argname] == null) { + if (b > 0) sb += ', '; + sb += 'object ' + argname; + csargsdict[argname] = b; + csargs.push(argname); + } + en = en.replace(args[b], '{' + csargsdict[argname] + '}'); + cn = cn.replace(args[b], '{' + csargsdict[argname] + '}'); + } + sb += ') => string.Format(Language == "cn" ? \r\n @"' + cn.replace(/"/g, '""') + '" : \r\n @"' + en.replace(/"/g, '""') + '", ' + csargs.join(', ') + ');'; + } +} +sb += '\r\n}\r\n'; +console.log(sb); + */ \ No newline at end of file diff --git a/FreeSql/Internal/UtilsExpressionTree.cs b/FreeSql/Internal/UtilsExpressionTree.cs index 01a688f80..bd53811ab 100644 --- a/FreeSql/Internal/UtilsExpressionTree.cs +++ b/FreeSql/Internal/UtilsExpressionTree.cs @@ -113,7 +113,7 @@ internal static TableInfo GetTableByEntity(Type entity, CommonUtils common) else colattr.IsIgnore = true; //Navigate 错误提示 var pnvAttr = common.GetEntityNavigateAttribute(trytb.Type, p); - if (pnvAttr != null) throw new Exception(CoreStrings.Navigation_Missing_SetProperty(trytb.Type.DisplayCsharp(), p.Name)); + if (pnvAttr != null) throw new Exception(CoreErrorStrings.Navigation_Missing_SetProperty(trytb.Type.DisplayCsharp(), p.Name)); } if (tp == null && colattr?.IsIgnore != true) { @@ -153,7 +153,7 @@ internal static TableInfo GetTableByEntity(Type entity, CommonUtils common) StringBuilder cscode = null; if (common.CodeFirst.IsLazyLoading && propsLazy.Any()) { - if (trytb.Type.IsPublic == false && trytb.Type.IsNestedPublic == false) throw new Exception(CoreStrings.LazyLoading_EntityMustDeclarePublic(trytbTypeName)); + if (trytb.Type.IsPublic == false && trytb.Type.IsNestedPublic == false) throw new Exception(CoreErrorStrings.LazyLoading_EntityMustDeclarePublic(trytbTypeName)); trytbTypeLazyName = $"FreeSqlLazyEntity__{Regex.Replace(trytbTypeName, @"[^\w\d]", "_")}"; @@ -179,14 +179,14 @@ internal static TableInfo GetTableByEntity(Type entity, CommonUtils common) { cscode.AppendLine("}"); Assembly assembly = null; - if (MethodLazyLoadingComplier.Value == null) throw new Exception(CoreStrings.Install_FreeSql_Extensions_LazyLoading); + if (MethodLazyLoadingComplier.Value == null) throw new Exception(CoreErrorStrings.Install_FreeSql_Extensions_LazyLoading); try { assembly = MethodLazyLoadingComplier.Value.Invoke(null, new object[] { cscode.ToString() }) as Assembly; } catch (Exception ex) { - throw new Exception(CoreStrings.LazyLoading_CompilationError(trytbTypeName, ex.Message, cscode)); + throw new Exception(CoreErrorStrings.LazyLoading_CompilationError(trytbTypeName, ex.Message, cscode)); } var type = assembly.GetExportedTypes()/*.DefinedTypes*/.Where(a => a.FullName.EndsWith(trytbTypeLazyName)).FirstOrDefault(); trytb.TypeLazy = type; @@ -503,8 +503,8 @@ public static ColumnInfo ColumnAttributeToInfo(TableInfo trytb, object entityDef colattr.DbType = Regex.Replace(colattr.DbType, decimalPatten, $"$1({colattr.Precision},{colattr.Scale})"); } - if (trytb.Columns.ContainsKey(colattr.Name)) throw new Exception(CoreStrings.Duplicate_ColumnAttribute(colattr.Name)); - if (trytb.ColumnsByCs.ContainsKey(csName)) throw new Exception(CoreStrings.Duplicate_PropertyName(csName)); + if (trytb.Columns.ContainsKey(colattr.Name)) throw new Exception(CoreErrorStrings.Duplicate_ColumnAttribute(colattr.Name)); + if (trytb.ColumnsByCs.ContainsKey(csName)) throw new Exception(CoreErrorStrings.Duplicate_PropertyName(csName)); return col; } @@ -515,7 +515,7 @@ public static void AuditTableInfo(TableInfo trytb, TableAttribute tbattr, IEnume { if (trytb.VersionColumn.Attribute.MapType.IsNullableType() || trytb.VersionColumn.Attribute.MapType.IsNumberType() == false && !new[] { typeof(byte[]), typeof(string) }.Contains(trytb.VersionColumn.Attribute.MapType)) - throw new Exception(CoreStrings.Properties_AsRowLock_Must_Numeric_Byte(trytb.VersionColumn.CsName)); + throw new Exception(CoreErrorStrings.Properties_AsRowLock_Must_Numeric_Byte(trytb.VersionColumn.CsName)); } tbattr?.ParseAsTable(trytb); @@ -800,7 +800,7 @@ void LocalLazyLoadingCode(string lmbdWhere) { if (locTb.ColumnsByCs.TryGetValue(bi, out var trybindcol) == false) { - nvref.Exception = new Exception(CoreStrings.Navigation_ParsingError_NotFound_Property(trytbTypeName, pnv.Name, locFindTypeName, bi)); + nvref.Exception = new Exception(CoreErrorStrings.Navigation_ParsingError_NotFound_Property(trytbTypeName, pnv.Name, locFindTypeName, bi)); trytb.AddOrUpdateTableRef(pnv.Name, nvref); //if (isLazy) throw nvref.Exception; break; @@ -820,7 +820,7 @@ void LocalLazyLoadingCode(string lmbdWhere) { if (bindColumnsTempPrimary[a].CsType.NullableTypeOrThis() != bindColumns[a].CsType.NullableTypeOrThis()) { - nvref.Exception = new Exception(CoreStrings.OneToMany_ParsingError_InconsistentType(trytbTypeName, pnv.Name, trytb.CsName, bindColumnsTempPrimary[a].CsName, tbref.CsName, bindColumns[a].CsName)); + nvref.Exception = new Exception(CoreErrorStrings.OneToMany_ParsingError_InconsistentType(trytbTypeName, pnv.Name, trytb.CsName, bindColumnsTempPrimary[a].CsName, tbref.CsName, bindColumns[a].CsName)); trytb.AddOrUpdateTableRef(pnv.Name, nvref); //if (isLazy) throw nvref.Exception; break; @@ -852,7 +852,7 @@ void LocalLazyLoadingCode(string lmbdWhere) { if (bindColumns[a].CsType.NullableTypeOrThis() != bindColumnsTempPrimary[a].CsType.NullableTypeOrThis()) { - nvref.Exception = new Exception(CoreStrings.Navigation_ParsingError_InconsistentType(trytbTypeName, pnv.Name, trytb.CsName, bindColumns[a].CsName, tbref.CsName, bindColumnsTempPrimary[a].CsName)); + nvref.Exception = new Exception(CoreErrorStrings.Navigation_ParsingError_InconsistentType(trytbTypeName, pnv.Name, trytb.CsName, bindColumns[a].CsName, tbref.CsName, bindColumnsTempPrimary[a].CsName)); trytb.AddOrUpdateTableRef(pnv.Name, nvref); //if (isLazy) throw nvref.Exception; break; @@ -883,7 +883,7 @@ void LocalLazyLoadingCode(string lmbdWhere) if (typeof(IEnumerable).IsAssignableFrom(pnv.PropertyType) == false) return; if (trytb.Primarys.Any() == false) { - nvref.Exception = new Exception(CoreStrings.Navigation_ParsingError_EntityMissingPrimaryKey(trytbTypeName, pnv.Name, trytbTypeName)); + nvref.Exception = new Exception(CoreErrorStrings.Navigation_ParsingError_EntityMissingPrimaryKey(trytbTypeName, pnv.Name, trytbTypeName)); trytb.AddOrUpdateTableRef(pnv.Name, nvref); //if (isLazy) throw nvref.Exception; return; @@ -916,7 +916,7 @@ void LocalLazyLoadingCode(string lmbdWhere) if (isManyToMany == false) { - nvref.Exception = new Exception(CoreStrings.ManyToMany_ParsingError_EntityMustHas_NavigateCollection(trytbTypeName, pnv.Name, tbrefTypeName)); + nvref.Exception = new Exception(CoreErrorStrings.ManyToMany_ParsingError_EntityMustHas_NavigateCollection(trytbTypeName, pnv.Name, tbrefTypeName)); trytb.AddOrUpdateTableRef(pnv.Name, nvref); //if (isLazy) throw nvref.Exception; return; @@ -939,7 +939,7 @@ void LocalLazyLoadingCode(string lmbdWhere) { if (tbref.Primarys.Any() == false) { - nvref.Exception = new Exception(CoreStrings.ManyToMany_ParsingError_EntityMissing_PrimaryKey(trytbTypeName, pnv.Name, tbrefTypeName)); + nvref.Exception = new Exception(CoreErrorStrings.ManyToMany_ParsingError_EntityMissing_PrimaryKey(trytbTypeName, pnv.Name, tbrefTypeName)); trytb.AddOrUpdateTableRef(pnv.Name, nvref); //if (isLazy) throw nvref.Exception; return; @@ -1010,7 +1010,7 @@ void midTypeFind(TableInfo maintb, string findTypeName) } catch (Exception ex) { - nvref.Exception = new Exception(CoreStrings.ManyToMany_ParsingError_IntermediateClass_ErrorMessage(trytbTypeName, pnv.Name, tbmid.CsName, midTypePropsTrytb.Name, ex.Message)); + nvref.Exception = new Exception(CoreErrorStrings.ManyToMany_ParsingError_IntermediateClass_ErrorMessage(trytbTypeName, pnv.Name, tbmid.CsName, midTypePropsTrytb.Name, ex.Message)); trytb.AddOrUpdateTableRef(pnv.Name, nvref); //if (isLazy) throw nvref.Exception; } @@ -1018,7 +1018,7 @@ void midTypeFind(TableInfo maintb, string findTypeName) { if (trytbTf.RefType != TableRefType.ManyToOne && trytbTf.RefType != TableRefType.OneToOne) { - nvref.Exception = new Exception(CoreStrings.ManyToMany_ParsingError_IntermediateClass_NotManyToOne_OneToOne(trytbTypeName, pnv.Name, tbmid.CsName, midTypePropsTrytb.Name)); + nvref.Exception = new Exception(CoreErrorStrings.ManyToMany_ParsingError_IntermediateClass_NotManyToOne_OneToOne(trytbTypeName, pnv.Name, tbmid.CsName, midTypePropsTrytb.Name)); trytb.AddOrUpdateTableRef(pnv.Name, nvref); //if (isLazy) throw nvref.Exception; } @@ -1057,7 +1057,7 @@ void midTypeFind(TableInfo maintb, string findTypeName) } catch (Exception ex) { - nvref.Exception = new Exception(CoreStrings.ManyToMany_ParsingError_IntermediateClass_ErrorMessage(trytbTypeName, pnv.Name, tbmid.CsName, midTypePropsTbref.Name, ex.Message)); + nvref.Exception = new Exception(CoreErrorStrings.ManyToMany_ParsingError_IntermediateClass_ErrorMessage(trytbTypeName, pnv.Name, tbmid.CsName, midTypePropsTbref.Name, ex.Message)); trytb.AddOrUpdateTableRef(pnv.Name, nvref); //if (isLazy) throw nvref.Exception; } @@ -1065,7 +1065,7 @@ void midTypeFind(TableInfo maintb, string findTypeName) { if (tbrefTf.RefType != TableRefType.ManyToOne && tbrefTf.RefType != TableRefType.OneToOne) { - nvref.Exception = new Exception(CoreStrings.ManyToMany_ParsingError_IntermediateClass_NotManyToOne_OneToOne(trytbTypeName, pnv.Name, tbmid.CsName, midTypePropsTbref.Name)); + nvref.Exception = new Exception(CoreErrorStrings.ManyToMany_ParsingError_IntermediateClass_NotManyToOne_OneToOne(trytbTypeName, pnv.Name, tbmid.CsName, midTypePropsTbref.Name)); trytb.AddOrUpdateTableRef(pnv.Name, nvref); //if (isLazy) throw nvref.Exception; } @@ -1103,14 +1103,14 @@ void midTypeFind(TableInfo maintb, string findTypeName) } if (trycol != null && trycol.CsType.NullableTypeOrThis() != trytb.Primarys[a].CsType.NullableTypeOrThis()) { - nvref.Exception = new Exception(CoreStrings.ManyToMany_ParsingError_InconsistentType(trytbTypeName, pnv.Name, tbmid.CsName, trycol.CsName, trytb.CsName, trytb.Primarys[a].CsName)); + nvref.Exception = new Exception(CoreErrorStrings.ManyToMany_ParsingError_InconsistentType(trytbTypeName, pnv.Name, tbmid.CsName, trycol.CsName, trytb.CsName, trytb.Primarys[a].CsName)); trytb.AddOrUpdateTableRef(pnv.Name, nvref); //if (isLazy) throw nvref.Exception; break; } if (trycol == null) { - nvref.Exception = new Exception(CoreStrings.ManyToMany_NotFound_CorrespondingField(trytbTypeName, pnv.Name, tbmid.CsName, midTypePropsTrytb.Name, findtrytbPkCsName)); + nvref.Exception = new Exception(CoreErrorStrings.ManyToMany_NotFound_CorrespondingField(trytbTypeName, pnv.Name, tbmid.CsName, midTypePropsTrytb.Name, findtrytbPkCsName)); trytb.AddOrUpdateTableRef(pnv.Name, nvref); //if (isLazy) throw nvref.Exception; break; @@ -1143,14 +1143,14 @@ void midTypeFind(TableInfo maintb, string findTypeName) } if (trycol != null && trycol.CsType.NullableTypeOrThis() != tbref.Primarys[a].CsType.NullableTypeOrThis()) { - nvref.Exception = new Exception(CoreStrings.ManyToMany_ParsingError_InconsistentType(trytbTypeName, pnv.Name, tbmid.CsName, trycol.CsName, trytb.CsName, trytb.Primarys[a].CsName)); + nvref.Exception = new Exception(CoreErrorStrings.ManyToMany_ParsingError_InconsistentType(trytbTypeName, pnv.Name, tbmid.CsName, trycol.CsName, trytb.CsName, trytb.Primarys[a].CsName)); trytb.AddOrUpdateTableRef(pnv.Name, nvref); //if (isLazy) throw nvref.Exception; break; } if (trycol == null) { - nvref.Exception = new Exception(CoreStrings.ManyToMany_NotFound_CorrespondingField(trytbTypeName, pnv.Name, tbmid.CsName, midTypePropsTrytb.Name, findtbrefPkCsName)); + nvref.Exception = new Exception(CoreErrorStrings.ManyToMany_NotFound_CorrespondingField(trytbTypeName, pnv.Name, tbmid.CsName, midTypePropsTrytb.Name, findtbrefPkCsName)); trytb.AddOrUpdateTableRef(pnv.Name, nvref); //if (isLazy) throw nvref.Exception; break; @@ -1356,7 +1356,7 @@ void midTypeFind(TableInfo maintb, string findTypeName) { if (tbref.ColumnsByCs.TryGetValue(bi, out var trybindcol) == false) { - nvref.Exception = new Exception(CoreStrings.Navigation_ParsingError_NotFound_Property(trytbTypeName, pnv.Name, tbrefTypeName, bi)); + nvref.Exception = new Exception(CoreErrorStrings.Navigation_ParsingError_NotFound_Property(trytbTypeName, pnv.Name, tbrefTypeName, bi)); trytb.AddOrUpdateTableRef(pnv.Name, nvref); //if (isLazy) throw nvref.Exception; break; @@ -1370,7 +1370,7 @@ void midTypeFind(TableInfo maintb, string findTypeName) if (nvref.Exception == null && bindColumns.Any() && bindColumns.Count != trytb.Primarys.Length) { - nvref.Exception = new Exception(CoreStrings.Navigation_Bind_Number_Different(trytbTypeName, pnv.Name, bindColumns.Count, trytb.Primarys.Length)); + nvref.Exception = new Exception(CoreErrorStrings.Navigation_Bind_Number_Different(trytbTypeName, pnv.Name, bindColumns.Count, trytb.Primarys.Length)); trytb.AddOrUpdateTableRef(pnv.Name, nvref); //if (isLazy) throw nvref.Exception; } @@ -1410,15 +1410,15 @@ void midTypeFind(TableInfo maintb, string findTypeName) } if (trycol != null && trycol.CsType.NullableTypeOrThis() != trytb.Primarys[a].CsType.NullableTypeOrThis()) { - nvref.Exception = new Exception(CoreStrings.OneToMany_ParsingError_InconsistentType(trytbTypeName, pnv.Name, trytb.CsName, trytb.Primarys[a].CsName, tbref.CsName, trycol.CsName)); + nvref.Exception = new Exception(CoreErrorStrings.OneToMany_ParsingError_InconsistentType(trytbTypeName, pnv.Name, trytb.CsName, trytb.Primarys[a].CsName, tbref.CsName, trycol.CsName)); trytb.AddOrUpdateTableRef(pnv.Name, nvref); //if (isLazy) throw nvref.Exception; break; } if (trycol == null) { - nvref.Exception = new Exception(CoreStrings.OneToMany_NotFound_CorrespondingField(trytbTypeName, pnv.Name, tbref.CsName, findtrytb, findtrytbPkCsName) - + (refprop == null ? "" : CoreStrings.OneToMany_UseNavigate(refprop.Name, findtrytbPkCsName))); + nvref.Exception = new Exception(CoreErrorStrings.OneToMany_NotFound_CorrespondingField(trytbTypeName, pnv.Name, tbref.CsName, findtrytb, findtrytbPkCsName) + + (refprop == null ? "" : CoreErrorStrings.OneToMany_UseNavigate(refprop.Name, findtrytbPkCsName))); trytb.AddOrUpdateTableRef(pnv.Name, nvref); //if (isLazy) throw nvref.Exception; break; @@ -1462,7 +1462,7 @@ void midTypeFind(TableInfo maintb, string findTypeName) if (tbref == null) return; if (tbref.Primarys.Any() == false) { - nvref.Exception = new Exception(CoreStrings.Navigation_ParsingError_EntityMissingPrimaryKey(trytbTypeName, pnv.Name, propTypeName)); + nvref.Exception = new Exception(CoreErrorStrings.Navigation_ParsingError_EntityMissingPrimaryKey(trytbTypeName, pnv.Name, propTypeName)); trytb.AddOrUpdateTableRef(pnv.Name, nvref); //if (isLazy) throw nvref.Exception; } @@ -1479,7 +1479,7 @@ void midTypeFind(TableInfo maintb, string findTypeName) { if (trytb.ColumnsByCs.TryGetValue(bi, out var trybindcol) == false) { - nvref.Exception = new Exception(CoreStrings.Navigation_ParsingError_NotFound_Property(trytbTypeName, pnv.Name, trytbTypeName, bi)); + nvref.Exception = new Exception(CoreErrorStrings.Navigation_ParsingError_NotFound_Property(trytbTypeName, pnv.Name, trytbTypeName, bi)); trytb.AddOrUpdateTableRef(pnv.Name, nvref); //if (isLazy) throw nvref.Exception; break; @@ -1491,7 +1491,7 @@ void midTypeFind(TableInfo maintb, string findTypeName) if (nvref.Exception == null && bindColumns.Any() && bindColumns.Count != tbref.Primarys.Length) { - nvref.Exception = new Exception(CoreStrings.Navigation_Bind_Number_Different(trytbTypeName, pnv.Name, bindColumns.Count, tbref.Primarys.Length)); + nvref.Exception = new Exception(CoreErrorStrings.Navigation_Bind_Number_Different(trytbTypeName, pnv.Name, bindColumns.Count, tbref.Primarys.Length)); trytb.AddOrUpdateTableRef(pnv.Name, nvref); //if (isLazy) throw nvref.Exception; } @@ -1546,14 +1546,14 @@ void midTypeFind(TableInfo maintb, string findTypeName) } if (trycol != null && trycol.CsType.NullableTypeOrThis() != tbref.Primarys[a].CsType.NullableTypeOrThis()) { - nvref.Exception = new Exception(CoreStrings.Navigation_ParsingError_InconsistentType(trytbTypeName, pnv.Name, trytb.CsName, trycol.CsName, tbref.CsName, tbref.Primarys[a].CsName)); + nvref.Exception = new Exception(CoreErrorStrings.Navigation_ParsingError_InconsistentType(trytbTypeName, pnv.Name, trytb.CsName, trycol.CsName, tbref.CsName, tbref.Primarys[a].CsName)); trytb.AddOrUpdateTableRef(pnv.Name, nvref); //if (isLazy) throw nvref.Exception; break; } if (trycol == null) { - nvref.Exception = new Exception(CoreStrings.Navigation_NotFound_CorrespondingField(trytbTypeName, pnv.Name, findtbrefPkCsName)); + nvref.Exception = new Exception(CoreErrorStrings.Navigation_NotFound_CorrespondingField(trytbTypeName, pnv.Name, findtbrefPkCsName)); trytb.AddOrUpdateTableRef(pnv.Name, nvref); //if (isLazy) throw nvref.Exception; break; @@ -2121,7 +2121,7 @@ internal static void FillPropertyValue(object info, string memberAccessPath, obj var parmValue = Expression.Parameter(typeof(object), "value"); Expression exp = Expression.Convert(parmInfo, typeObj); foreach (var pro in memberAccessPath.Split('.')) - exp = Expression.PropertyOrField(exp, pro) ?? throw new Exception(string.Concat(exp.Type.FullName, CoreStrings.NoProperty_Defined, pro)); + exp = Expression.PropertyOrField(exp, pro) ?? throw new Exception(string.Concat(exp.Type.FullName, CoreErrorStrings.NoProperty_Defined, pro)); var value2 = Expression.Call(MethodGetDataReaderValue, Expression.Constant(exp.Type), parmValue); var value3 = Expression.Convert(parmValue, typeValue); @@ -2761,7 +2761,7 @@ public static object GetDataReaderValue(Type type, object value) } catch (Exception ex) { - throw new ArgumentException(CoreStrings.ExpressionTree_Convert_Type_Error(string.Concat(value), value.GetType().FullName, type.FullName, ex.Message)); + throw new ArgumentException(CoreErrorStrings.ExpressionTree_Convert_Type_Error(string.Concat(value), value.GetType().FullName, type.FullName, ex.Message)); } } public static string GetCsName(string name) diff --git a/FreeSql/Properties/CoreStrings.Designer.cs b/FreeSql/Properties/CoreStrings.Designer.cs deleted file mode 100644 index 146386c87..000000000 --- a/FreeSql/Properties/CoreStrings.Designer.cs +++ /dev/null @@ -1,1243 +0,0 @@ - -// - -using System; -using System.Reflection; -using System.Resources; -using System.Globalization; -using System.Threading; - -namespace FreeSql -{ - /// - /// - /// String resources used in FreeSql exceptions, etc. - /// - /// - /// These strings are exposed publicly for use by database providers and extensions. - /// It is unusual for application code to need these strings. - /// - /// - public static class CoreStrings - { - private static readonly ResourceManager _resourceManager = new ResourceManager("FreeSql.Properties.CoreStrings", typeof(CoreStrings).Assembly); - - private static CultureInfo _resourceCulture; - - /// - /// 重写当前线程的 CurrentUICulture 属性,对 - /// 使用此强类型资源类的所有资源查找执行重写。 - /// - public static CultureInfo Culture - { - get - { - return _resourceCulture; - } - set - { - _resourceCulture = value; - } - } - - /// - /// [Table(AsTable = "{asTable}")] 特性值格式错误 - /// - public static string AsTable_PropertyName_FormatError(object asTable) - => string.Format( - GetString("AsTable_PropertyName_FormatError", nameof(asTable)), - asTable); - - /// - /// [Table(AsTable = xx)] 设置的属性名 {atmGroupsValue} 不是 DateTime 类型 - /// - public static string AsTable_PropertyName_NotDateTime(object atmGroupsValue) - => string.Format( - GetString("AsTable_PropertyName_NotDateTime", nameof(atmGroupsValue)), - atmGroupsValue); - - /// - /// {name}: Failed to get resource {statistics} - /// - public static string Available_Failed_Get_Resource(object name, object statistics) - => string.Format( - GetString("Available_Failed_Get_Resource", nameof(name), nameof(statistics)), - name, statistics); - - /// - /// {name}: An exception needs to be thrown - /// - public static string Available_Thrown_Exception(object name) - => string.Format( - GetString("Available_Thrown_Exception", nameof(name)), - name); - - /// - /// 错误的表达式格式 {column} - /// - public static string Bad_Expression_Format(object column) - => string.Format( - GetString("Bad_Expression_Format", nameof(column)), - column); - - /// - /// Chunk 功能之前不可使用 Select - /// - public static string Before_Chunk_Cannot_Use_Select - => GetString("Before_Chunk_Cannot_Use_Select"); - - /// - /// 安全起见,请务必在事务开启之后,再使用 ForUpdate - /// - public static string Begin_Transaction_Then_ForUpdate - => GetString("Begin_Transaction_Then_ForUpdate"); - - /// - /// 不能为 null - /// - public static string Cannot_Be_NULL - => GetString("Cannot_Be_NULL"); - - /// - /// {name} 不能为 null - /// - public static string Cannot_Be_NULL_Name(object name) - => string.Format( - GetString("Cannot_Be_NULL_Name", nameof(name)), - name); - - /// - /// 无法匹配 {property} - /// - public static string Cannot_Match_Property(object property) - => string.Format( - GetString("Cannot_Match_Property", nameof(property)), - property); - - /// - /// {property} 无法解析为表达式树 - /// - public static string Cannot_Resolve_ExpressionTree(object property) - => string.Format( - GetString("Cannot_Resolve_ExpressionTree", nameof(property)), - property); - - /// - /// 参数 masterConnectionString 不可为空,请检查 UseConnectionString - /// - public static string Check_UseConnectionString - => GetString("Check_UseConnectionString"); - - /// - /// 提交 - /// - public static string Commit - => GetString("Commit"); - - /// - /// 连接失败,准备切换其他可用服务器 - /// - public static string Connection_Failed_Switch_Servers - => GetString("Connection_Failed_Switch_Servers"); - - /// - /// 自定义表达式解析错误:类型 {exp3MethodDeclaringType} 需要定义 static ThreadLocal<ExpressionCallContext> 字段、字段、字段(重要三次提醒) - /// - public static string Custom_Expression_ParsingError(object exp3MethodDeclaringType) - => string.Format( - GetString("Custom_Expression_ParsingError", nameof(exp3MethodDeclaringType)), - exp3MethodDeclaringType); - - /// - /// Custom { 反射信息 }不能为空,格式:{ 静态方法名 }{ 空格 }{ 反射信息 } - /// - public static string Custom_Reflection_IsNotNull - => GetString("Custom_Reflection_IsNotNull"); - - /// - /// Custom { 静态方法名 }不能为空,格式:{ 静态方法名 }{ 空格 }{ 反射信息 } - /// - public static string Custom_StaticMethodName_IsNotNull - => GetString("Custom_StaticMethodName_IsNotNull"); - - /// - /// Custom 对应的{{ 静态方法名 }}:{fiValueCustomArray} 未设置 [DynamicFilterCustomAttribute] 特性 - /// - public static string Custom_StaticMethodName_NotSet_DynamicFilterCustom(object fiValueCustomArray) - => string.Format( - GetString("Custom_StaticMethodName_NotSet_DynamicFilterCustom", nameof(fiValueCustomArray)), - fiValueCustomArray); - - /// - /// Custom 要求 Field 应该空格分割,并且长度为 2,格式:{ 静态方法名 }{ 空格 }{ 反射信息 } - /// - public static string CustomFieldSeparatedBySpaces - => GetString("CustomFieldSeparatedBySpaces"); - - /// - /// 操作的数据类型({dataDisplayCsharp}) 与 AsType({tableTypeDisplayCsharp}) 不一致,请检查。 - /// - public static string DataType_AsType_Inconsistent(object dataDisplayCsharp, object tableTypeDisplayCsharp) - => string.Format( - GetString("DataType_AsType_Inconsistent", nameof(dataDisplayCsharp), nameof(tableTypeDisplayCsharp)), - dataDisplayCsharp, tableTypeDisplayCsharp); - - /// - /// DateRange 要求 Value 应该逗号分割,并且长度为 2 - /// - public static string DateRange_Comma_Separateda_By2Char - => GetString("DateRange_Comma_Separateda_By2Char"); - - /// - /// DateRange 要求 Value[1] 格式必须为:yyyy、yyyy-MM、yyyy-MM-dd、yyyy-MM-dd HH、yyyy、yyyy-MM-dd HH:mm - /// - public static string DateRange_DateFormat_yyyy - => GetString("DateRange_DateFormat_yyyy"); - - /// - /// 记录可能不存在,或者【行级乐观锁】版本过旧,更新数量{sourceCount},影响的行数{affrows}。 - /// - public static string DbUpdateVersionException_RowLevelOptimisticLock(object sourceCount, object affrows) - => string.Format( - GetString("DbUpdateVersionException_RowLevelOptimisticLock", nameof(sourceCount), nameof(affrows)), - sourceCount, affrows); - - /// - /// SlaveConnectionString 数量与 SlaveWeights 不相同 - /// - public static string Different_Number_SlaveConnectionString_SlaveWeights - => GetString("Different_Number_SlaveConnectionString_SlaveWeights"); - - /// - /// ColumnAttribute.Name {colattrName} 重复存在,请检查(注意:不区分大小写) - /// - public static string Duplicate_ColumnAttribute(object colattrName) - => string.Format( - GetString("Duplicate_ColumnAttribute", nameof(colattrName)), - colattrName); - - /// - /// 属性名 {pName} 重复存在,请检查(注意:不区分大小写) - /// - public static string Duplicate_PropertyName(object pName) - => string.Format( - GetString("Duplicate_PropertyName", nameof(pName)), - pName); - - /// - /// {function} 功能要求实体类 {tableCsName} 必须有主键 - /// - public static string Entity_Must_Primary_Key(object function, object tableCsName) - => string.Format( - GetString("Entity_Must_Primary_Key", nameof(function), nameof(tableCsName)), - function, tableCsName); - - /// - /// {tbTypeFullName} 是父子关系,但是 MySql 8.0 以下版本中不支持组合多主键 - /// - public static string Entity_MySQL_VersionsBelow8_NotSupport_Multiple_PrimaryKeys(object tbTypeFullName) - => string.Format( - GetString("Entity_MySQL_VersionsBelow8_NotSupport_Multiple_PrimaryKeys", nameof(tbTypeFullName)), - tbTypeFullName); - - /// - /// {tbTypeFullName} 不是父子关系,无法使用该功能 - /// - public static string Entity_NotParentChild_Relationship(object tbTypeFullName) - => string.Format( - GetString("Entity_NotParentChild_Relationship", nameof(tbTypeFullName)), - tbTypeFullName); - - /// - /// 这个特别的子查询不能解析 - /// - public static string EspeciallySubquery_Cannot_Parsing - => GetString("EspeciallySubquery_Cannot_Parsing"); - - /// - /// 表达式错误,它的顶级对象不是 ParameterExpression:{exp} - /// - public static string Expression_Error_Use_ParameterExpression(object exp) - => string.Format( - GetString("Expression_Error_Use_ParameterExpression", nameof(exp)), - exp); - - /// - /// 表达式错误,它不是连续的 MemberAccess 类型:{exp} - /// - public static string Expression_Error_Use_Successive_MemberAccess_Type(object exp) - => string.Format( - GetString("Expression_Error_Use_Successive_MemberAccess_Type", nameof(exp)), - exp); - - /// - /// ExpressionTree 转换类型错误,值({value}),类型({valueTypeFullName}),目标类型({typeFullName}),{exMessage} - /// - public static string ExpressionTree_Convert_Type_Error(object value, object valueTypeFullName, object typeFullName, object exMessage) - => string.Format( - GetString("ExpressionTree_Convert_Type_Error", nameof(value), nameof(valueTypeFullName), nameof(typeFullName), nameof(exMessage)), - value, valueTypeFullName, typeFullName, exMessage); - - /// - /// 未能解析分表字段值 {sqlWhere} - /// - public static string Failed_SubTable_FieldValue(object sqlWhere) - => string.Format( - GetString("Failed_SubTable_FieldValue", nameof(sqlWhere)), - sqlWhere); - - /// - /// AsTable 未实现的功能 {asTable} - /// - public static string Functions_AsTable_NotImplemented(object asTable) - => string.Format( - GetString("Functions_AsTable_NotImplemented", nameof(asTable)), - asTable); - - /// - /// GBase 暂时不支持逗号以外的分割符 - /// - public static string GBase_NotSupport_OtherThanCommas - => GetString("GBase_NotSupport_OtherThanCommas"); - - /// - /// tableName:{tableName} 生成了相同的分表名 - /// - public static string Generated_Same_SubTable(object tableName) - => string.Format( - GetString("Generated_Same_SubTable", nameof(tableName)), - tableName); - - /// - /// GetPrimarys 传递的参数 "{primary}" 不正确,它不属于字典数据的键名 - /// - public static string GetPrimarys_ParameterError_IsNotDictKey (object primary) - => string.Format( - GetString("GetPrimarys_ParameterError_IsNotDictKey ", nameof(primary)), - primary); - - /// - /// 已经指定了 {first},不能再指定 {second} - /// - public static string Has_Specified_Cannot_Specified_Second(object first, object second) - => string.Format( - GetString("Has_Specified_Cannot_Specified_Second", nameof(first), nameof(second)), - first, second); - - /// - /// {tb2DbName}.{mp2MemberName} 被忽略,请检查 IsIgnore 设置,确认 get/set 为 public - /// - public static string Ignored_Check_Confirm_PublicGetSet(object tb2DbName, object mp2MemberName) - => string.Format( - GetString("Ignored_Check_Confirm_PublicGetSet", nameof(tb2DbName), nameof(mp2MemberName)), - tb2DbName, mp2MemberName); - - /// - /// Include 参数类型错误 - /// - public static string Include_ParameterType_Error - => GetString("Include_ParameterType_Error"); - - /// - /// Include 参数类型错误,集合属性请使用 IncludeMany - /// - public static string Include_ParameterType_Error_Use_IncludeMany - => GetString("Include_ParameterType_Error_Use_IncludeMany"); - - /// - /// Include 参数类型错误,表达式类型应该为 MemberAccess - /// - public static string Include_ParameterType_Error_Use_MemberAccess - => GetString("Include_ParameterType_Error_Use_MemberAccess"); - - /// - /// IncludeMany 类型 {tbTypeDisplayCsharp} 的属性 {collMemMemberName} 不是有效的导航属性,提示:IsIgnore = true 不会成为导航属性 - /// - public static string IncludeMany_NotValid_Navigation(object tbTypeDisplayCsharp, object collMemMemberName) - => string.Format( - GetString("IncludeMany_NotValid_Navigation", nameof(tbTypeDisplayCsharp), nameof(collMemMemberName)), - tbTypeDisplayCsharp, collMemMemberName); - - /// - /// IncludeMany {navigateSelector} 参数错误,Select 只可以使用一个参数的方法,正确格式:.Select(t =>new TNavigate {{}}) - /// - public static string IncludeMany_ParameterError_OnlyUseOneParameter(object navigateSelector) - => string.Format( - GetString("IncludeMany_ParameterError_OnlyUseOneParameter", nameof(navigateSelector)), - navigateSelector); - - /// - /// IncludeMany {navigateSelector} 参数错误,Select lambda参数返回值必须和 {collMemElementType} 类型一致 - /// - public static string IncludeMany_ParameterError_Select_ReturnConsistentType(object navigateSelector, object collMemElementType) - => string.Format( - GetString("IncludeMany_ParameterError_Select_ReturnConsistentType", nameof(navigateSelector), nameof(collMemElementType)), - navigateSelector, collMemElementType); - - /// - /// IncludeMany 参数1 类型错误,表达式类型应该为 MemberAccess - /// - public static string IncludeMany_ParameterType_Error_Use_MemberAccess - => GetString("IncludeMany_ParameterType_Error_Use_MemberAccess"); - - /// - /// IncludeMany {navigateSelector} 参数类型错误,正确格式: a.collections.Take(1).Where(c =>c.aid == a.id).Select(a=> new TNavigate{{}}) - /// - public static string IncludeMany_ParameterTypeError(object navigateSelector) - => string.Format( - GetString("IncludeMany_ParameterTypeError", nameof(navigateSelector)), - navigateSelector); - - /// - /// ISelect.InsertInto() 未选择属性: {displayCsharp} - /// - public static string InsertInto_No_Property_Selected(object displayCsharp) - => string.Format( - GetString("InsertInto_No_Property_Selected", nameof(displayCsharp)), - displayCsharp); - - /// - /// ISelect.InsertInto() 类型错误: {displayCsharp} - /// - public static string InsertInto_TypeError(object displayCsharp) - => string.Format( - GetString("InsertInto_TypeError", nameof(displayCsharp)), - displayCsharp); - - /// - /// InsertOrUpdate 功能执行 merge into 要求实体类 {CsName} 必须有主键 - /// - public static string InsertOrUpdate_Must_Primary_Key(object CsName) - => string.Format( - GetString("InsertOrUpdate_Must_Primary_Key", nameof(CsName)), - CsName); - - /// - /// InsertOrUpdate<>的泛型参数 不支持 {typeofT1},请传递您的实体类 - /// - public static string InsertOrUpdate_NotSuport_Generic_UseEntity(object typeofT1) - => string.Format( - GetString("InsertOrUpdate_NotSuport_Generic_UseEntity", nameof(typeofT1)), - typeofT1); - - /// - /// 【延时加载】功能需要安装 FreeSql.Extensions.LazyLoading.dll,可前往 nuget 下载 - /// - public static string Install_FreeSql_Extensions_LazyLoading - => GetString("Install_FreeSql_Extensions_LazyLoading"); - - /// - /// 【延时加载】{trytbTypeName} 编译错误:{exMessage}\r\n\r\n{cscode} - /// - public static string LazyLoading_CompilationError(object trytbTypeName, object exMessage, object cscode) - => string.Format( - GetString("LazyLoading_CompilationError", nameof(trytbTypeName), nameof(exMessage), nameof(cscode)), - trytbTypeName, exMessage, cscode); - - /// - /// 【延时加载】实体类型 {trytbTypeName} 必须声明为 public - /// - public static string LazyLoading_EntityMustDeclarePublic(object trytbTypeName) - => string.Format( - GetString("LazyLoading_EntityMustDeclarePublic", nameof(trytbTypeName)), - trytbTypeName); - - /// - /// ManyToMany 导航属性 .AsSelect() 暂时不可用于 Sum/Avg/Max/Min/First/ToOne/ToList 方法 - /// - public static string ManyToMany_AsSelect_NotSupport_Sum_Avg_etc - => GetString("ManyToMany_AsSelect_NotSupport_Sum_Avg_etc"); - - /// - /// 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 在 {tbmidCsName} 中没有找到对应的字段,如:{midTypePropsTrytbName}{findtrytbPkCsName}、{midTypePropsTrytbName}_{findtrytbPkCsName} - /// - public static string ManyToMany_NotFound_CorrespondingField(object trytbTypeName, object pnvName, object tbmidCsName, object midTypePropsTrytbName, object findtrytbPkCsName) - => string.Format( - GetString("ManyToMany_NotFound_CorrespondingField", nameof(trytbTypeName), nameof(pnvName), nameof(tbmidCsName), nameof(midTypePropsTrytbName), nameof(findtrytbPkCsName)), - trytbTypeName, pnvName, tbmidCsName, midTypePropsTrytbName, findtrytbPkCsName); - - /// - /// 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,实体类型 {tbrefTypeName} 缺少主键标识,[Column(IsPrimary = true)] - /// - public static string ManyToMany_ParsingError_EntityMissing_PrimaryKey(object trytbTypeName, object pnvName, object tbrefTypeName) - => string.Format( - GetString("ManyToMany_ParsingError_EntityMissing_PrimaryKey", nameof(trytbTypeName), nameof(pnvName), nameof(tbrefTypeName)), - trytbTypeName, pnvName, tbrefTypeName); - - /// - /// 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,实体类型 {tbrefTypeName} 必须存在对应的 [Navigate(ManyToMany = x)] 集合属性 - /// - public static string ManyToMany_ParsingError_EntityMustHas_NavigateCollection(object trytbTypeName, object pnvName, object tbrefTypeName) - => string.Format( - GetString("ManyToMany_ParsingError_EntityMustHas_NavigateCollection", nameof(trytbTypeName), nameof(pnvName), nameof(tbrefTypeName)), - trytbTypeName, pnvName, tbrefTypeName); - - /// - /// 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,{tbmidCsName}.{trycolCsName} 和 {trytbCsName}.{trytbPrimarysCsName} 类型不一致 - /// - public static string ManyToMany_ParsingError_InconsistentType(object trytbTypeName, object pnvName, object tbmidCsName, object trycolCsName, object trytbCsName, object trytbPrimarysCsName) - => string.Format( - GetString("ManyToMany_ParsingError_InconsistentType", nameof(trytbTypeName), nameof(pnvName), nameof(tbmidCsName), nameof(trycolCsName), nameof(trytbCsName), nameof(trytbPrimarysCsName)), - trytbTypeName, pnvName, tbmidCsName, trycolCsName, trytbCsName, trytbPrimarysCsName); - - /// - /// 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,中间类 {tbmidCsName}.{midTypePropsTrytbName} 错误:{exMessage} - /// - public static string ManyToMany_ParsingError_IntermediateClass_ErrorMessage(object trytbTypeName, object pnvName, object tbmidCsName, object midTypePropsTrytbName, object exMessage) - => string.Format( - GetString("ManyToMany_ParsingError_IntermediateClass_ErrorMessage", nameof(trytbTypeName), nameof(pnvName), nameof(tbmidCsName), nameof(midTypePropsTrytbName), nameof(exMessage)), - trytbTypeName, pnvName, tbmidCsName, midTypePropsTrytbName, exMessage); - - /// - /// 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,中间类 {tbmidCsName}.{midTypePropsTrytbName} 导航属性不是【ManyToOne】或【OneToOne】 - /// - public static string ManyToMany_ParsingError_IntermediateClass_NotManyToOne_OneToOne(object trytbTypeName, object pnvName, object tbmidCsName, object midTypePropsTrytbName) - => string.Format( - GetString("ManyToMany_ParsingError_IntermediateClass_NotManyToOne_OneToOne", nameof(trytbTypeName), nameof(pnvName), nameof(tbmidCsName), nameof(midTypePropsTrytbName)), - trytbTypeName, pnvName, tbmidCsName, midTypePropsTrytbName); - - /// - /// 映射异常:{name} 没有一个属性名相同 - /// - public static string Mapping_Exception_HasNo_SamePropertyName(object name) - => string.Format( - GetString("Mapping_Exception_HasNo_SamePropertyName", nameof(name)), - name); - - /// - /// Ado.MasterPool 值为 null,该操作无法自启用事务,请显式传递【事务对象】解决 - /// - public static string MasterPool_IsNull_UseTransaction - => GetString("MasterPool_IsNull_UseTransaction"); - - /// - /// 缺少 FreeSql 数据库实现包:FreeSql.Provider.{Provider}.dll,可前往 nuget 下载 - /// - public static string Missing_FreeSqlProvider_Package(object Provider) - => string.Format( - GetString("Missing_FreeSqlProvider_Package", nameof(Provider)), - Provider); - - /// - /// 缺少 FreeSql 数据库实现包:{dll},可前往 nuget 下载;如果存在 {dll} 依然报错(原因是环境问题导致反射不到类型),请在 UseConnectionString/UseConnectionFactory 第三个参数手工传入 typeof({providerType}) - /// - public static string Missing_FreeSqlProvider_Package_Reason(object dll, object providerType) - => string.Format( - GetString("Missing_FreeSqlProvider_Package_Reason", nameof(dll), nameof(providerType)), - dll, providerType); - - /// - /// 导航属性 {trytbTypeName}.{pnvName} 特性 [Navigate] Bind 数目({bindColumnsCount}) 与 外部主键数目({tbrefPrimarysLength}) 不相同 - /// - public static string Navigation_Bind_Number_Different(object trytbTypeName, object pnvName, object bindColumnsCount, object tbrefPrimarysLength) - => string.Format( - GetString("Navigation_Bind_Number_Different", nameof(trytbTypeName), nameof(pnvName), nameof(bindColumnsCount), nameof(tbrefPrimarysLength)), - trytbTypeName, pnvName, bindColumnsCount, tbrefPrimarysLength); - - /// - /// {tb2DbName}.{mp2MemberName} 导航属性集合忘了 .AsSelect() 吗?如果在 ToList(a => a.{mp2MemberName}) 中使用,请移步参考 IncludeMany 文档。 - /// - public static string Navigation_Missing_AsSelect(object tb2DbName, object mp2MemberName) - => string.Format( - GetString("Navigation_Missing_AsSelect", nameof(tb2DbName), nameof(mp2MemberName)), - tb2DbName, mp2MemberName); - - /// - /// 【导航属性】{trytbTypeDisplayCsharp}.{pName} 缺少 set 属性 - /// - public static string Navigation_Missing_SetProperty(object trytbTypeDisplayCsharp, object pName) - => string.Format( - GetString("Navigation_Missing_SetProperty", nameof(trytbTypeDisplayCsharp), nameof(pName)), - trytbTypeDisplayCsharp, pName); - - /// - /// 导航属性 {trytbTypeName}.{pnvName} 没有找到对应的字段,如:{pnvName}{findtbrefPkCsName}、{pnvName}_{findtbrefPkCsName}。或者使用 [Navigate] 特性指定关系映射。 - /// - public static string Navigation_NotFound_CorrespondingField(object trytbTypeName, object pnvName, object findtbrefPkCsName) - => string.Format( - GetString("Navigation_NotFound_CorrespondingField", nameof(trytbTypeName), nameof(pnvName), nameof(findtbrefPkCsName)), - trytbTypeName, pnvName, findtbrefPkCsName); - - /// - /// 导航属性 {trytbTypeName}.{pnvName} 解析错误,实体类型 {trytcTypeName} 缺少主键标识,[Column(IsPrimary = true)] - /// - public static string Navigation_ParsingError_EntityMissingPrimaryKey(object trytbTypeName, object pnvName, object trytcTypeName) - => string.Format( - GetString("Navigation_ParsingError_EntityMissingPrimaryKey", nameof(trytbTypeName), nameof(pnvName), nameof(trytcTypeName)), - trytbTypeName, pnvName, trytcTypeName); - - /// - /// 导航属性 {trytbTypeName}.{pnvName} 解析错误,{trytbCsName}.{trycolCsName} 和 {tbrefCsName}.{tbrefPrimarysCsName} 类型不一致 - /// - public static string Navigation_ParsingError_InconsistentType(object trytbTypeName, object pnvName, object trytbCsName, object trycolCsName, object tbrefCsName, object tbrefPrimarysCsName) - => string.Format( - GetString("Navigation_ParsingError_InconsistentType", nameof(trytbTypeName), nameof(pnvName), nameof(trytbCsName), nameof(trycolCsName), nameof(tbrefCsName), nameof(tbrefPrimarysCsName)), - trytbTypeName, pnvName, trytbCsName, trycolCsName, tbrefCsName, tbrefPrimarysCsName); - - /// - /// 导航属性 {trytbTypeName}.{pnvName} 特性 [Navigate] 解析错误,在 {tbrefTypeName} 未找到属性:{bi} - /// - public static string Navigation_ParsingError_NotFound_Property(object trytbTypeName, object pnvName, object tbrefTypeName, object bi) - => string.Format( - GetString("Navigation_ParsingError_NotFound_Property", nameof(trytbTypeName), nameof(pnvName), nameof(tbrefTypeName), nameof(bi)), - trytbTypeName, pnvName, tbrefTypeName, bi); - - /// - /// {tableTypeDisplayCsharp} 没有定义主键,无法使用 SetSource,请尝试 SetDto 或者 SetSource 指定临时主键 - /// - public static string NoPrimaryKey_UseSetDto(object tableTypeDisplayCsharp) - => string.Format( - GetString("NoPrimaryKey_UseSetDto", nameof(tableTypeDisplayCsharp)), - tableTypeDisplayCsharp); - - /// - /// 没有定义属性 - /// - public static string NoProperty_Defined - => GetString("NoProperty_Defined"); - - /// - /// 未实现 - /// - public static string Not_Implemented - => GetString("Not_Implemented"); - - /// - /// 未实现函数表达式 {exp} 解析 - /// - public static string Not_Implemented_Expression(object exp) - => string.Format( - GetString("Not_Implemented_Expression", nameof(exp)), - exp); - - /// - /// 未实现函数表达式 {exp} 解析,参数 {expArguments} 必须为常量 - /// - public static string Not_Implemented_Expression_ParameterUseConstant(object exp, object expArguments) - => string.Format( - GetString("Not_Implemented_Expression_ParameterUseConstant", nameof(exp), nameof(expArguments)), - exp, expArguments); - - /// - /// 未实现函数表达式 {exp} 解析,如果正在操作导航属性集合,请使用 .AsSelect().{exp3MethodName}({exp3ArgumentsCount}) - /// - public static string Not_Implemented_Expression_UseAsSelect(object exp, object exp3MethodName, object exp3ArgumentsCount) - => string.Format( - GetString("Not_Implemented_Expression_UseAsSelect", nameof(exp), nameof(exp3MethodName), nameof(exp3ArgumentsCount)), - exp, exp3MethodName, exp3ArgumentsCount); - - /// - /// 未实现 MemberAccess 下的 Constant - /// - public static string Not_Implemented_MemberAcess_Constant - => GetString("Not_Implemented_MemberAcess_Constant"); - - /// - /// 未实现 {name} - /// - public static string Not_Implemented_Name(object name) - => string.Format( - GetString("Not_Implemented_Name", nameof(name)), - name); - - /// - /// 不支持 - /// - public static string Not_Support - => GetString("Not_Support"); - - /// - /// {dataType} 不支持 OrderByRandom 随机排序 - /// - public static string Not_Support_OrderByRandom(object dataType) - => string.Format( - GetString("Not_Support_OrderByRandom", nameof(dataType)), - dataType); - - /// - /// {property} 不是有效的导航属性 - /// - public static string Not_Valid_Navigation_Property(object property) - => string.Format( - GetString("Not_Valid_Navigation_Property", nameof(property)), - property); - - /// - /// {dbName} 找不到列 {memberName} - /// - public static string NotFound_Column(object dbName, object memberName) - => string.Format( - GetString("NotFound_Column", nameof(dbName), nameof(memberName)), - dbName, memberName); - - /// - /// 找不到 {CsName} 对应的列 - /// - public static string NotFound_CsName_Column(object CsName) - => string.Format( - GetString("NotFound_CsName_Column", nameof(CsName)), - CsName); - - /// - /// 找不到属性:{memberName} - /// - public static string NotFound_Property(object memberName) - => string.Format( - GetString("NotFound_Property", nameof(memberName)), - memberName); - - /// - /// 找不到属性名 {proto} - /// - public static string NotFound_PropertyName(object proto) - => string.Format( - GetString("NotFound_PropertyName", nameof(proto)), - proto); - - /// - /// Custom 找不到对应的{{ 反射信息 }}:{fiValueCustomArray} - /// - public static string NotFound_Reflection(object fiValueCustomArray) - => string.Format( - GetString("NotFound_Reflection", nameof(fiValueCustomArray)), - fiValueCustomArray); - - /// - /// Custom 找不到对应的{{ 静态方法名 }}:{fiValueCustomArray} - /// - public static string NotFound_Static_MethodName(object fiValueCustomArray) - => string.Format( - GetString("NotFound_Static_MethodName", nameof(fiValueCustomArray)), - fiValueCustomArray); - - /// - /// [Table(AsTable = xx)] 设置的属性名 {atmGroupsValue} 不存在 - /// - public static string NotFound_Table_Property_AsTable(object atmGroupsValue) - => string.Format( - GetString("NotFound_Table_Property_AsTable", nameof(atmGroupsValue)), - atmGroupsValue); - - /// - /// 未指定 UseConnectionString 或者 UseConnectionFactory - /// - public static string NotSpecified_UseConnectionString_UseConnectionFactory - => GetString("NotSpecified_UseConnectionString_UseConnectionFactory"); - - /// - /// 【{policyName}】ObjectPool.{GetName}() timeout {totalSeconds} seconds, see: https://github.com/dotnetcore/FreeSql/discussions/1081 - /// - public static string ObjectPool_Get_Timeout(object policyName, object GetName, object totalSeconds) - => string.Format( - GetString("ObjectPool_Get_Timeout", nameof(policyName), nameof(GetName), nameof(totalSeconds)), - policyName, GetName, totalSeconds); - - /// - /// 【{policyName}】ObjectPool.GetAsync() The queue is too long. Policy.AsyncGetCapacity = {asyncGetCapacity} - /// - public static string ObjectPool_GetAsync_Queue_Long(object policyName, object asyncGetCapacity) - => string.Format( - GetString("ObjectPool_GetAsync_Queue_Long", nameof(policyName), nameof(asyncGetCapacity)), - policyName, asyncGetCapacity); - - /// - /// 【OneToMany】导航属性 {trytbTypeName}.{pnvName} 在 {tbrefCsName} 中没有找到对应的字段,如:{findtrytb}{findtrytbPkCsName}、{findtrytb}_{findtrytbPkCsName} - /// - public static string OneToMany_NotFound_CorrespondingField(object trytbTypeName, object pnvName, object tbrefCsName, object findtrytb, object findtrytbPkCsName) - => string.Format( - GetString("OneToMany_NotFound_CorrespondingField", nameof(trytbTypeName), nameof(pnvName), nameof(tbrefCsName), nameof(findtrytb), nameof(findtrytbPkCsName)), - trytbTypeName, pnvName, tbrefCsName, findtrytb, findtrytbPkCsName); - - /// - /// 【OneToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,{trytbCsName}.{trytbPrimarysCsName} 和 {tbrefCsName}.{trycolCsName} 类型不一致 - /// - public static string OneToMany_ParsingError_InconsistentType(object trytbTypeName, object pnvName, object trytbCsName, object trytbPrimarysCsName, object tbrefCsName, object trycolCsName) - => string.Format( - GetString("OneToMany_ParsingError_InconsistentType", nameof(trytbTypeName), nameof(pnvName), nameof(trytbCsName), nameof(trytbPrimarysCsName), nameof(tbrefCsName), nameof(trycolCsName)), - trytbTypeName, pnvName, trytbCsName, trytbPrimarysCsName, tbrefCsName, trycolCsName); - - /// - /// 、{refpropName}{findtrytbPkCsName}、{refpropName}_{findtrytbPkCsName}。或者使用 [Navigate] 特性指定关系映射。 - /// - public static string OneToMany_UseNavigate(object refpropName, object findtrytbPkCsName) - => string.Format( - GetString("OneToMany_UseNavigate", nameof(refpropName), nameof(findtrytbPkCsName)), - refpropName, findtrytbPkCsName); - - /// - /// 参数 field 未指定 - /// - public static string Parameter_Field_NotSpecified - => GetString("Parameter_Field_NotSpecified"); - - /// - /// {property} 参数错误,它不是集合属性,必须为 IList<T> 或者 ICollection<T> - /// - public static string ParameterError_NotValid_Collection(object property) - => string.Format( - GetString("ParameterError_NotValid_Collection", nameof(property)), - property); - - /// - /// {property} 参数错误,它不是有效的导航属性 - /// - public static string ParameterError_NotValid_Navigation(object property) - => string.Format( - GetString("ParameterError_NotValid_Navigation", nameof(property)), - property); - - /// - /// {where} 参数错误,{keyval} 不是有效的属性名,在实体类 {reftbTypeDisplayCsharp} 无法找到 - /// - public static string ParameterError_NotValid_PropertyName(object where, object keyval, object reftbTypeDisplayCsharp) - => string.Format( - GetString("ParameterError_NotValid_PropertyName", nameof(where), nameof(keyval), nameof(reftbTypeDisplayCsharp)), - where, keyval, reftbTypeDisplayCsharp); - - /// - /// {property} 参数错误,格式 "TopicId=Id,多组使用逗号连接" - /// - public static string ParameterError_NotValid_UseCommas(object property) - => string.Format( - GetString("ParameterError_NotValid_UseCommas", nameof(property)), - property); - - /// - /// 解析失败 {callExpMethodName} {message} - /// - public static string Parsing_Failed(object callExpMethodName, object message) - => string.Format( - GetString("Parsing_Failed", nameof(callExpMethodName), nameof(message)), - callExpMethodName, message); - - /// - /// 【{policyName}】The ObjectPool has been disposed, see: https://github.com/dotnetcore/FreeSql/discussions/1079 - /// - public static string Policy_ObjectPool_Dispose(object policyName) - => string.Format( - GetString("Policy_ObjectPool_Dispose", nameof(policyName)), - policyName); - - /// - /// 【{policyName}】状态不可用,等待后台检查程序恢复方可使用。{UnavailableExceptionMessage} - /// - public static string Policy_Status_NotAvailable(object policyName, object UnavailableExceptionMessage) - => string.Format( - GetString("Policy_Status_NotAvailable", nameof(policyName), nameof(UnavailableExceptionMessage)), - policyName, UnavailableExceptionMessage); - - /// - /// 属性{trytbVersionColumnCsName} 被标注为行锁(乐观锁)(IsVersion),但其必须为数字类型 或者 byte[] 或者 string,并且不可为 Nullable - /// - public static string Properties_AsRowLock_Must_Numeric_Byte(object trytbVersionColumnCsName) - => string.Format( - GetString("Properties_AsRowLock_Must_Numeric_Byte", nameof(trytbVersionColumnCsName)), - trytbVersionColumnCsName); - - /// - /// properties 参数不能为空 - /// - public static string Properties_Cannot_Null - => GetString("Properties_Cannot_Null"); - - /// - /// {property} 属性名无法找到 - /// - public static string Property_Cannot_Find(object property) - => string.Format( - GetString("Property_Cannot_Find", nameof(property)), - property); - - /// - /// Range 要求 Value 应该逗号分割,并且长度为 2 - /// - public static string Range_Comma_Separateda_By2Char - => GetString("Range_Comma_Separateda_By2Char"); - - /// - /// 回滚 - /// - public static string RollBack - => GetString("RollBack"); - - /// - /// 运行时错误,反射获取 IncludeMany 方法失败 - /// - public static string RunTimeError_Reflection_IncludeMany - => GetString("RunTimeError_Reflection_IncludeMany"); - - /// - /// 蛋疼的 Access 插入只能一条一条执行,不支持 values(..),(..) 也不支持 select .. UNION ALL select .. - /// - public static string S_Access_InsertOnlyOneAtTime - => GetString("S_Access_InsertOnlyOneAtTime"); - - /// - /// BaseEntity.Initialization 初始化错误,获取到 IFreeSql 是 null - /// - public static string S_BaseEntity_Initialization_Error - => GetString("S_BaseEntity_Initialization_Error"); - - /// - /// 【{thisName}】Block access and wait for recovery: {exMessage} - /// - public static string S_BlockAccess_WaitForRecovery(object thisName, object exMessage) - => string.Format( - GetString("S_BlockAccess_WaitForRecovery", nameof(thisName), nameof(exMessage)), - thisName, exMessage); - - /// - /// 无法将 IQueryable<{typeofName}> 转换为 ISelect<{typeofName}>,因为他的实现不是 FreeSql.Extensions.Linq.QueryableProvider - /// - public static string S_CannotBeConverted_To_ISelect(object typeofName) - => string.Format( - GetString("S_CannotBeConverted_To_ISelect", nameof(typeofName)), - typeofName); - - /// - /// 连接字符串错误 - /// - public static string S_ConnectionStringError - => GetString("S_ConnectionStringError"); - - /// - /// 【{thisName}】连接字符串错误,请检查。 - /// - public static string S_ConnectionStringError_Check(object thisName) - => string.Format( - GetString("S_ConnectionStringError_Check", nameof(thisName)), - thisName); - - /// - /// 连接字符串错误,或者检查项目属性 > 生成 > 目标平台:x86 | x64,或者改用 FreeSql.Provider.SqliteCore 访问 arm 平台 - /// - public static string S_ConnectionStringError_CheckProject - => GetString("S_ConnectionStringError_CheckProject"); - - /// - /// 【{thisName}】连接字符串错误,请检查。或者检查项目属性 > 生成 > 目标平台:x86 | x64,或者改用 FreeSql.Provider.SqliteCore 访问 arm 平台 - /// - public static string S_ConnectionStringError_CheckProjectConnection(object thisName) - => string.Format( - GetString("S_ConnectionStringError_CheckProjectConnection", nameof(thisName)), - thisName); - - /// - /// FreeSql.Provider.CustomAdapter 无法使用 CreateCommand - /// - public static string S_CustomAdapter_Cannot_Use_CreateCommand - => GetString("S_CustomAdapter_Cannot_Use_CreateCommand"); - - /// - /// FreeSql.Provider.CustomAdapter 仅支持 UseConnectionFactory 方式构建 IFreeSql - /// - public static string S_CustomAdapter_OnlySuppport_UseConnectionFactory - => GetString("S_CustomAdapter_OnlySuppport_UseConnectionFactory "); - - /// - /// 达梦 CodeFirst 不支持代码创建 tablespace 与 schemas {tbname} - /// - public static string S_Dameng_NotSupport_TablespaceSchemas (object tbname) - => string.Format( - GetString("S_Dameng_NotSupport_TablespaceSchemas ", nameof(tbname)), - tbname); - - /// - /// -DB 参数错误,未提供 ConnectionString - /// - public static string S_DB_Parameter_Error_NoConnectionString - => GetString("S_DB_Parameter_Error_NoConnectionString"); - - /// - /// -DB 参数错误,格式为:MySql,ConnectionString - /// - public static string S_DB_ParameterError - => GetString("S_DB_ParameterError"); - - /// - /// -DB 参数错误,不支持的类型:"{dbargs}" - /// - public static string S_DB_ParameterError_UnsupportedType(object dbargs) - => string.Format( - GetString("S_DB_ParameterError_UnsupportedType", nameof(dbargs)), - dbargs); - - /// - /// {method} 是 FreeSql.Provider.{provider} 特有的功能 - /// - public static string S_Features_Unique(object method, object provider) - => string.Format( - GetString("S_Features_Unique", nameof(method), nameof(provider)), - method, provider); - - /// - /// fsql.InsertOrUpdate Sqlite 无法完成 UpdateColumns 操作 - /// - public static string S_InsertOrUpdate_Unable_UpdateColumns - => GetString("S_InsertOrUpdate_Unable_UpdateColumns"); - - /// - /// 主库 - /// - public static string S_MasterDatabase - => GetString("S_MasterDatabase"); - - /// - /// MygisGeometry.Parse 未实现 "{wkt}" - /// - public static string S_MygisGeometry_NotImplement(object wkt) - => string.Format( - GetString("S_MygisGeometry_NotImplement", nameof(wkt)), - wkt); - - /// - /// -NameOptions 参数错误,格式为:0,0,0,0 - /// - public static string S_NameOptions_Incorrect - => GetString("S_NameOptions_Incorrect"); - - /// - /// 未实现该功能 - /// - public static string S_Not_Implemented_Feature - => GetString("S_Not_Implemented_Feature"); - - /// - /// 未实现错误,请反馈给作者 - /// - public static string S_Not_Implemented_FeedBack - => GetString("S_Not_Implemented_FeedBack"); - - /// - /// 找不到 {name} - /// - public static string S_NotFound_Name(object name) - => string.Format( - GetString("S_NotFound_Name", nameof(name)), - name); - - /// - /// FreeSql.Provider.{providerName} 未实现 Skip/Offset 功能,如果需要分页请使用判断上一次 id - /// - public static string S_NotImplementSkipOffset(object providerName) - => string.Format( - GetString("S_NotImplementSkipOffset", nameof(providerName)), - providerName); - - /// - /// 对象池 - /// - public static string S_ObjectPool - => GetString("S_ObjectPool"); - - /// - /// 旧表(OldName):{tboldname} 存在,数据库已存在 {tbname} 表,无法改名 - /// - public static string S_OldTableExists(object tboldname, object tbname) - => string.Format( - GetString("S_OldTableExists", nameof(tboldname), nameof(tbname)), - tboldname, tbname); - - /// - /// OnConflictDoUpdate 功能要求实体类必须设置 IsPrimary 属性 - /// - public static string S_OnConflictDoUpdate_MustIsPrimary - => GetString("S_OnConflictDoUpdate_MustIsPrimary"); - - /// - /// Oracle CodeFirst 不支持代码创建 tablespace 与 schemas {tbname} - /// - public static string S_Oracle_NotSupport_TablespaceSchemas(object tbname) - => string.Format( - GetString("S_Oracle_NotSupport_TablespaceSchemas", nameof(tbname)), - tbname); - - /// - /// 解析失败 {callExpMethodName} {message},提示:可以使用扩展方法 IQueryable.RestoreToSelect() 还原为 ISelect 再查询 - /// - public static string S_ParsingFailed_UseRestoreToSelect(object callExpMethodName, object message) - => string.Format( - GetString("S_ParsingFailed_UseRestoreToSelect", nameof(callExpMethodName), nameof(message)), - callExpMethodName, message); - - /// - /// fsql.InsertOrUpdate + IfExistsDoNothing + {providerName}要求实体类 {tableCsName} 必须有主键 - /// - public static string S_RequiresEntityPrimaryKey(object providerName, object tableCsName) - => string.Format( - GetString("S_RequiresEntityPrimaryKey", nameof(providerName), nameof(tableCsName)), - providerName, tableCsName); - - /// - /// SelectMany 错误的类型:{typeFullName} - /// - public static string S_SelectManayErrorType(object typeFullName) - => string.Format( - GetString("S_SelectManayErrorType", nameof(typeFullName)), - typeFullName); - - /// - /// 从库 - /// - public static string S_SlaveDatabase - => GetString("S_SlaveDatabase"); - - /// - /// 类型 {objentityTypeFullName} 不可迁移 - /// - public static string S_Type_IsNot_Migrable(object objentityTypeFullName) - => string.Format( - GetString("S_Type_IsNot_Migrable", nameof(objentityTypeFullName)), - objentityTypeFullName); - - /// - /// 类型 {objentityTypeFullName} 不可迁移,可迁移属性0个 - /// - public static string S_Type_IsNot_Migrable_0Attributes(object objentityTypeFullName) - => string.Format( - GetString("S_Type_IsNot_Migrable_0Attributes", nameof(objentityTypeFullName)), - objentityTypeFullName); - - /// - /// 未实现 {columnDbTypeTextFull} 类型映射 - /// - public static string S_TypeMappingNotImplemented(object columnDbTypeTextFull) - => string.Format( - GetString("S_TypeMappingNotImplemented", nameof(columnDbTypeTextFull)), - columnDbTypeTextFull); - - /// - /// 错误的参数设置:{args} - /// - public static string S_WrongParameter(object args) - => string.Format( - GetString("S_WrongParameter", nameof(args)), - args); - - /// - /// {qoteSql} is NULL,除非设置特性 [Column(IsNullable = false)] - /// - public static string Set_Column_IsNullable_False(object qoteSql) - => string.Format( - GetString("Set_Column_IsNullable_False", nameof(qoteSql)), - qoteSql); - - /// - /// 分表字段值 "{dt}" 不能小于 "{beginTime} " - /// - public static string SubTableFieldValue_CannotLessThen(object dt, object beginTime) - => string.Format( - GetString("SubTableFieldValue_CannotLessThen", nameof(dt), nameof(beginTime)), - dt, beginTime); - - /// - /// 分表字段值不能为 null - /// - public static string SubTableFieldValue_IsNotNull - => GetString("SubTableFieldValue_IsNotNull"); - - /// - /// 分表字段值 "{columnValue}" 不能转化成 DateTime - /// - public static string SubTableFieldValue_NotConvertDateTime(object columnValue) - => string.Format( - GetString("SubTableFieldValue_NotConvertDateTime", nameof(columnValue)), - columnValue); - - /// - /// 分表字段值 "{dt}" 未匹配到分表名 - /// - public static string SubTableFieldValue_NotMatchTable(object dt) - => string.Format( - GetString("SubTableFieldValue_NotMatchTable", nameof(dt)), - dt); - - /// - /// T2 类型错误 - /// - public static string T2_Type_Error - => GetString("T2_Type_Error"); - - /// - /// tableName 格式错误,示例:“log_{yyyyMMdd}” - /// - public static string TableName_Format_Error(object yyyyMMdd) - => string.Format( - GetString("TableName_Format_Error", nameof(yyyyMMdd)), - yyyyMMdd); - - /// - /// {Type}.AsType 参数错误,请传入正确的实体类型 - /// - public static string Type_AsType_Parameter_Error(object Type) - => string.Format( - GetString("Type_AsType_Parameter_Error", nameof(Type)), - Type); - - /// - /// {thatFullName} 类型无法访问构造函数 - /// - public static string Type_Cannot_Access_Constructor(object thatFullName) - => string.Format( - GetString("Type_Cannot_Access_Constructor", nameof(thatFullName)), - thatFullName); - - /// - /// {name} 类型错误 - /// - public static string Type_Error_Name(object name) - => string.Format( - GetString("Type_Error_Name", nameof(name)), - name); - - /// - /// {Type}.AsType 参数不支持指定为 object - /// - public static string TypeAsType_NotSupport_Object(object Type) - => string.Format( - GetString("TypeAsType_NotSupport_Object", nameof(Type)), - Type); - - /// - /// 类型 {typeofFullName} 错误,不能使用 IncludeMany - /// - public static string TypeError_CannotUse_IncludeMany(object typeofFullName) - => string.Format( - GetString("TypeError_CannotUse_IncludeMany", nameof(typeofFullName)), - typeofFullName); - - /// - /// 无法解析表达式:{exp} - /// - public static string Unable_Parse_Expression(object exp) - => string.Format( - GetString("Unable_Parse_Expression", nameof(exp)), - exp); - - /// - /// 无法解析表达式方法 {exp3tmpCallMethodName} - /// - public static string Unable_Parse_ExpressionMethod(object exp3tmpCallMethodName) - => string.Format( - GetString("Unable_Parse_ExpressionMethod", nameof(exp3tmpCallMethodName)), - exp3tmpCallMethodName); - - /// - /// 请使用 fsql.InsertDict(dict) 方法插入字典数据 - /// - public static string Use_InsertDict_Method - => GetString("Use_InsertDict_Method"); - - private static string GetString(string name, params string[] formatterNames) - { - var value = _resourceManager.GetString(name,_resourceCulture); - for (var i = 0; i < formatterNames.Length; i++) - { - value = value.Replace("{" + formatterNames[i] + "}", "{" + i + "}"); - } - - return value; - } - } -} - diff --git a/FreeSql/Properties/CoreStrings.Designer.tt b/FreeSql/Properties/CoreStrings.Designer.tt deleted file mode 100644 index 1b17aead8..000000000 --- a/FreeSql/Properties/CoreStrings.Designer.tt +++ /dev/null @@ -1,5 +0,0 @@ -<# - Session["ResourceFile"] = "CoreStrings.resx"; - Session["AccessModifier"] = "public"; -#> -<#@ include file="Resources.tt" #> \ No newline at end of file diff --git a/FreeSql/Properties/CoreStrings.resx b/FreeSql/Properties/CoreStrings.resx deleted file mode 100644 index 6328057c6..000000000 --- a/FreeSql/Properties/CoreStrings.resx +++ /dev/null @@ -1,603 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - FreeSql: [Table(AsTable="{asTable}")] Property value formatted incorrectly - - - FreeSql: The property name {atmGroupsValue} set by [Table (AsTable = xx)] is not of type DateTime - - - FreeSql: {name}: Failed to get resource {statistics} - - - FreeSql: {name}: An exception needs to be thrown - - - FreeSql: Wrong expression format {column} - - - FreeSql: Select is not available until the Chunk function - - - FreeSql: For security reasons, be sure to use ForUpdate after the transaction is open - - - FreeSql: Cannot be null - - - FreeSql: {name} cannot be null - - - FreeSql: Unable to match {property} - - - FreeSql: {property} cannot be resolved to an expression tree - - - FreeSql: The parameter master ConnectionString cannot be empty, check UseConnectionString - - - FreeSql: Commit - - - FreeSql: Connection failed, ready to switch other available servers - - - FreeSql: Custom expression parsing error: type {exp3MethodDeclaringType} needs to define static ThreadLocal<ExpressionCallContext>field, field, field (important three reminders) - - - FreeSql: Custom {Reflection Information} cannot be empty, format: {static method name}{space}{reflection information} - - - FreeSql: Custom {static method name} cannot be empty, format: {static method name}{space}{reflection information} - - - FreeSql: Custom corresponding {{static method name}}:{fiValueCustomArray} The [DynamicFilterCustomAttribute] attribute is not set - - - FreeSql: Custom requires that Fields be space-split and 2-length in the format: {static method name}{space}{reflection information} - - - FreeSql: The data type of the operation ({dataDisplayCsharp}) is inconsistent with AsType ({tableTypeDisplayCsharp}). Please check. - - - FreeSql: DateRange requires that Value be comma-separated and 2-length - - - FreeSql: DateRange requires that the Value [1] format must be: yyyy, yyyy-MM, yyyy-MM-dd, yyyyy-MM-dd HH, yyyy, yyyy-MM-dd HH:mm - - - FreeSql: The record may not exist, or the row level optimistic lock version is out of date, the number of updates {sourceCount}, the number of rows affected {affrows}. - - - FreeSql: The number of SlaveConnectionStrings is not the same as SlaveWeights - - - FreeSql: ColumnAttribute. Name {colattrName} exists repeatedly, please check (note: case insensitive) - - - FreeSql: Property name {pName} exists repeatedly, please check (note: case insensitive) - - - FreeSql: The {function} feature requires that the entity class {tableCsName} must have a primary key - - - FreeSql: {tbTypeFullName} is a parent-child relationship, but combinations of multiple primary keys are not supported in versions below MySql 8.0 - - - FreeSql: {tbTypeFullName} is not a parent-child relationship and cannot be used - - - FreeSql: This particular subquery cannot be resolved - - - FreeSql: Expression error, its top object is not ParameterExpression:{exp} - - - FreeSql: Expression error, it is not a continuous MemberAccess type: {exp} - - - FreeSql: ExpressionTree conversion type error, value ({value}), type ({valueTypeFullName}), target type ({typeFullName}), Error:{exMessage} - - - FreeSql: Failed to parse table field value {sqlWhere} - - - FreeSql: Function {asTable} not implemented by AsTable - - - FreeSql: GBase does not support separators other than commas at this time - - - FreeSql: TableName:{tableName} generated the same table name - - - FreeSql: The parameter'{primary}'passed by GetPrimarys is incorrect and does not belong to the key name of the dictionary data - - - FreeSql: {first} has already been specified and {second} can no longer be specified - - - FreeSql: {tb2DbName}. {mp2MemberName} is ignored. Check the IsIgnore setting to make sure get/set is public - - - FreeSql: Include parameter type error - - - FreeSql: Include parameter type is wrong, use IncludeMany for collection properties - - - FreeSql: Include parameter type is wrong, expression type should be MemberAccess - - - FreeSql: The property {collMemMemberName} of IncludeMany type {tbTypeDisplayCsharp} is not a valid navigation property, hint: IsIgnore = true will not be a navigation property - - - FreeSql: IncludeMany {navigateSelector} parameter is wrong, Select can only use one parameter's method, the correct format:.Select(t =>new TNavigate{{}}) - - - FreeSql: IncludeMany {navigateSelector} parameter error, Select lambda parameter return value must match {collMemElementType} type - - - FreeSql: IncludeMany parameter 1 has wrong type, expression type should be MemberAccess - - - FreeSql: IncludeMany {navigateSelector} parameter type is wrong, correct format: a.collections.Take(1).Where(c => C.A ID == a.id).Select (a => new TNavigate{{}}) - - - FreeSql: ISelect. InsertInto() did not select an attribute: {displayCsharp} - - - FreeSql: ISelect. InsertInto() type error: {displayCsharp} - - - FreeSql: The InsertOrUpdate function performs merge into requiring the entity class {CsName} to have a primary key - - - FreeSql: The generic parameter for InsertOrUpdate<>does not support {typeofT1}. Pass in your entity class - - - FreeSql: FreeSql needs to be installed for Delayed Loading. Extensions. LazyLoading. Dll, downloadable to nuget - - - FreeSql: {trytbTypeName} Compilation error: {exMessage}\r\n\r\n{cscode} - - - FreeSql: Entity type {trytbTypeName} must be declared public - - - FreeSql: ManyToMany navigation properties. AsSelect() is temporarily unavailable for the Sum/Avg/Max/Min/First/ToOne/ToList method - - - FreeSql: [ManyToMany] Navigation property {trytbTypeName}. {pnvName} did not find a corresponding field in {tbmidCsName}, such as: {midTypePropsTrytbName}{findtrytbPkCsName}, {midTypePropsTrytbName}_ {findtrytbPkCsName} - - - FreeSql: [ManyToMany] Navigation property {trytbTypeName}. {pnvName} parsing error, entity type {tbrefTypeName} missing primary key identity, [Column (IsPrimary = true)] - - - FreeSql: [ManyToMany] Navigation property {trytbTypeName}. {pnvName} parsing error, entity type {tbrefTypeName} must have a corresponding [Navigate (ManyToMany = x)] collection property - - - FreeSql: [ManyToMany] Navigation property {trytbTypeName}. {pnvName} parsing error, {tbmidCsName}. {trycolCsName} and {trytbCsName}. {trytbPrimarysCsName} type inconsistent - - - FreeSql: [ManyToMany] Navigation property {trytbTypeName}. {pnvName} parsing error, intermediate class {tbmidCsName}.{midTypePropsTrytbName} Error: {exMessage} - - - FreeSql: [ManyToMany] Navigation property {trytbTypeName}. {pnvName} parsing error, intermediate class {tbmidCsName}. The {midTypePropsTrytbName} navigation property is not ManyToOne or OneToOne - - - FreeSql: Mapping exception: {name} None of the property names are the same - - - FreeSql: Ado. MasterPool value is null, this operation cannot self-enable transactions, please explicitly pass [transaction object] resolution - - - FreeSql: Missing FreeSql database implementation package: FreeSql.Provider.{Provider}.Dll, downloadable to nuget - - - FreeSql: The FreeSql database implementation package is missing: {dll} can be downloaded to nuget; If there is {dll} and an error still occurs (due to environmental issues that cause the type to be unreflected), manually pass in typeof ({providerType}) in the third parameter of UseConnectionString/UseConnectionFactory - - - FreeSql: Navigation property {trytbTypeName}. The number of {pnvName} attributes [Navigate] Binds ({bindColumnsCount}) is different from the number of external primary keys ({tbrefPrimarysLength}) - - - FreeSql: {tb2DbName}. {mp2MemberName} Navigation Property Collection forgotten. AsSelect()? If used in ToList (a => a. {mp2MemberName}), step by step to refer to the IncludeMany document. - - - FreeSql: Navigation Properties {trytbTypeDisplayCsharp}. Missing set attribute for {pName} - - - FreeSql: Navigation property {trytbTypeName}. {pnvName} No corresponding fields were found, such as: {pnvName}{findtbrefPkCsName}, {pnvName}_ {findtbrefPkCsName}. Or use the [Navigate] attribute to specify the relationship mapping. - - - FreeSql: Navigation property {trytbTypeName}. {pnvName} parsing error, entity type {trytcTypeName} missing primary key identity, [Column (IsPrimary = true)] - - - FreeSql: Navigation property {trytbTypeName}. {pnvName} parsing error, {trytbCsName}. {trycolCsName} and {tbrefCsName}. {tbrefPrimarysCsName} type inconsistent - - - FreeSql: Navigation property {trytbTypeName}. {pnvName} attribute [Navigate] parsing error, property not found at {tbrefTypeName}: {bi} - - - FreeSql: {tableTypeDisplayCsharp} has no primary key defined and cannot use SetSource. Try SetDto - - - FreeSql: No properties defined - - - FreeSql: Not implemented - - - FreeSql: Function expression {exp} parsing not implemented - - - FreeSql: Function expression {exp} parsing not implemented, parameter {expArguments} must be constant - - - FreeSql: Function expression {exp} parsing is not implemented. Use if you are working on a navigation property collection. AsSelect (). {exp3MethodName} ({exp3ArgumentsCount}) - - - FreeSql: Constant under MemberAccess is not implemented - - - FreeSql: {name} is not implemented - - - FreeSql: I won't support it - - - FreeSql: {dataType} does not support OrderByRandom sorting - - - FreeSql: {property} is not a valid navigation property - - - FreeSql: {dbName} Column {memberName} not found - - - FreeSql: Cannot find the column corresponding to {CsName} - - - FreeSql: Attribute not found: {memberName} - - - FreeSql: Property name {proto} not found - - - FreeSql: Custom could not find the corresponding {{reflection information}}:{fiValueCustomArray} - - - FreeSql: Custom could not find the corresponding {{static method name}}:{fiValueCustomArray} - - - FreeSql: The property name {atmGroupsValue} set by [Table(AsTable = xx)] does not exist - - - FreeSql: No UseConnectionString or UseConnectionFactory specified - - - FreeSql: [{policyName}] ObjectPool. {GetName}() timeout {totalSeconds} seconds, see: https://github.com/dotnetcore/FreeSql/discussions/1081 - - - FreeSql: [{policyName}] ObjectPool. GetAsync() The queue is too long. Policy. AsyncGetCapacity = {asyncGetCapacity} - - - FreeSql: [OneToMany] Navigation property {trytbTypeName}.{pnvName} did not find a corresponding field in {tbrefCsName}, such as: {findtrytb}{findtrytbPkCsName}, {findtrytb}_{findtrytbPkCsName} - - - FreeSql: [OneToMany] Navigation property {trytbTypeName}.{pnvName} parsing error, {trytbCsName}.{trytbPrimarysCsName} and {tbrefCsName}.{trycolCsName} is of inconsistent type - - - , {refpropName}{findtrytbPkCsName}, {refpropName}_{findtrytbPkCsName}. Or use the [Navigate] attribute to specify the relationship mapping. - - - FreeSql: Parameter field not specified - - - FreeSql: The {property} parameter is incorrect, it is not a collection property and must be IList<T>or ICollection<T> - - - FreeSql: The {property} parameter is incorrect, it is not a valid navigation property - - - FreeSql: {where} parameter error, {keyval} is not a valid property name and cannot be found in entity class {reftbTypeDisplayCsharp} - - - FreeSql: {property} parameter error, format "TopicId=Id, multiple groups using comma connection" - - - FreeSql: Parsing failed {callExpMethodName} {message} - - - FreeSql: [{policyName}] The ObjectPool has been disposed, see: https://github.com/dotnetcore/FreeSql/discussions/1079 - - - FreeSql: The {policyName} status is unavailable and cannot be used until the background checker is restored. {UnavailableExceptionMessage} - - - FreeSql: The property {trytbVersionColumnCsName} is labeled as a row lock (optimistic lock) (IsVersion), but it must be a numeric type or byte[] or string, and it cannot be Nullable - - - FreeSql: Properrties parameter cannot be empty - - - FreeSql: {property} property name not found - - - FreeSql: Range requires that Value be comma-separated and 2-length - - - FreeSql: RollBack - - - FreeSql: Runtime error, reflection failed to get IncludeMany method - - - FreeSql: {qoteSql} is NULL unless the attribute [Column (IsNullable = false)] - - - FreeSql: Subtable field value'{dt}'cannot be less than'{beginTime}' - - - FreeSql: Subtable field value cannot be null - - - FreeSql: The tabular field value'{columnValue}'cannot be converted to DateTime - - - FreeSql: Table field value'{dt}'does not match table name - - - FreeSql: Type T2 Error - - - FreeSql: TableName format error, example: "log_{yyyyMMdd}" - - - FreeSql: {Type}. AsType parameter error, please pass in the correct entity type - - - FreeSql: The {thatFullName} type cannot access the constructor - - - FreeSql: {name} type error - - - FreeSql: {Type}. AsType parameter does not support specifying as object - - - FreeSql: Type {typeofFullName} error, IncludeMany cannot be used - - - FreeSql: Unable to parse expression: {exp} - - - FreeSql: Unable to parse expression method {exp3tmpCallMethodName} - - - FreeSql: Please use fsql. InsertDict (dict) method inserts dictionary data - - - FreeSql: {name} not found - - - FreeSql: Slave Database - - - FreeSql: Master Database - - - FreeSql: Egg pain Accs insertion can only be performed one at a time, values (..) are not supported. (..) Select is also not supported.. UNION ALL select.. - - - FreeSql: BaseEntity. Initialization initialization error, get IFreeSql is null - - - FreeSql: [{thisName}] Block access and wait for recovery: {exMessage} - - - FreeSql: IQueryable<{typeofName}> cannot be converted to ISelect<{typeofName}> because its implementation is not FreeSql.Extensions.Linq.QueryableProvider - - - FreeSql: Connection string error - - - FreeSql: [{thisName}] Connection string error, please check. - - - FreeSql: Connection string error, or check project properties > Build > Target Platform: x86 | x64, Or use FreeSql.Provider.SqliteCore accessing arm platform - - - FreeSql: [{thisName}] Connection string error, please check. Or check Project Properties > Build > Target Platform: x86 | x64, Or use FreeSql.Provider.SqliteCore accessing arm platform - - - FreeSql: FreeSql.Provider.CustomAdapter cannot use CreateCommand - - - FreeSql: FreeSql.Provider.CustomAdapter only supports building IFreeSql in the UseConnectionFactory way - - - FreeSql: Dream CodeFirst does not support code creation tablespace and schemas {tbname} - - - FreeSql: -DB parameter error, no ConnectionString provided - - - FreeSql: -DB parameter error, format: MySql, ConnectionString - - - FreeSql: -DB parameter error, unsupported type: "{dbargs}" - - - FreeSql: {method} is FreeSql.Provider.{provider} specific features - - - FreeSql: InsertOrUpdate Sqlite was unable to complete the UpdateColumns operation - - - FreeSql: MygisGeometry. Parse does not implement "{wkt}" - - - FreeSql: -NameOptions parameter incorrect, format: 0,0,0,0 - - - FreeSql: This function is not implemented - - - FreeSql: Unrealized error, please feedback to author - - - FreeSql: FreeSql.Provider.{providerName} does not implement Skip/Offset functionality, use to determine last ID if paging is required - - - FreeSql: Old table (OldName): {tboldname} exists, database already exists {tbname} table, cannot rename - - - FreeSql: The OnConflictDoUpdate feature requires that entity classes must set the IsPrimary property - - - FreeSql: Oracle CodeFirst does not support code creation of tablespace and schemas {tbname} - - - FreeSql: Parsing failed {callExpMethodName} {message}, hint: Extension method IQueryable can be used. RestoreToSelect() reverted to ISelect re-query - - - FreeSql: InsertOrUpdate + IfExistsDoNothing + {providerName} requires the entity class {tableCsName} to have a primary key - - - FreeSql: SelectMany error type: {typeFullName} - - - FreeSql: Type {objentityTypeFullName} is not migrable - - - FreeSql: Type {objentityTypeFullName} is not migrable, migratable property 0 - - - FreeSql: {columnDbTypeTextFull} type mapping not implemented - - - FreeSql: Wrong parameter setting: {args} - - - FreeSql: Object pool - - \ No newline at end of file diff --git a/FreeSql/Properties/CoreStrings.zh-Hans.resx b/FreeSql/Properties/CoreStrings.zh-Hans.resx deleted file mode 100644 index 2b501999b..000000000 --- a/FreeSql/Properties/CoreStrings.zh-Hans.resx +++ /dev/null @@ -1,638 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - [Table(AsTable = "{asTable}")] 特性值格式错误 - - - [Table(AsTable = xx)] 设置的属性名 {atmGroupsValue} 不是 DateTime 类型 - - - {name}: Failed to get resource {statistics} - - - {name}: An exception needs to be thrown - - - 错误的表达式格式 {column} - - - Chunk 功能之前不可使用 Select - - - 安全起见,请务必在事务开启之后,再使用 ForUpdate - - - 不能为 null - - - {name} 不能为 null - - - 无法匹配 {property} - - - {property} 无法解析为表达式树 - - - 参数 masterConnectionString 不可为空,请检查 UseConnectionString - - - 提交 - - - 连接失败,准备切换其他可用服务器 - - - 自定义表达式解析错误:类型 {exp3MethodDeclaringType} 需要定义 static ThreadLocal<ExpressionCallContext> 字段、字段、字段(重要三次提醒) - - - Custom { 反射信息 }不能为空,格式:{ 静态方法名 }{ 空格 }{ 反射信息 } - - - Custom { 静态方法名 }不能为空,格式:{ 静态方法名 }{ 空格 }{ 反射信息 } - - - Custom 对应的{{ 静态方法名 }}:{fiValueCustomArray} 未设置 [DynamicFilterCustomAttribute] 特性 - - - Custom 要求 Field 应该空格分割,并且长度为 2,格式:{ 静态方法名 }{ 空格 }{ 反射信息 } - - - 操作的数据类型({dataDisplayCsharp}) 与 AsType({tableTypeDisplayCsharp}) 不一致,请检查。 - - - DateRange 要求 Value 应该逗号分割,并且长度为 2 - - - DateRange 要求 Value[1] 格式必须为:yyyy、yyyy-MM、yyyy-MM-dd、yyyy-MM-dd HH、yyyy、yyyy-MM-dd HH:mm - - - 记录可能不存在,或者【行级乐观锁】版本过旧,更新数量{sourceCount},影响的行数{affrows}。 - - - SlaveConnectionString 数量与 SlaveWeights 不相同 - - - ColumnAttribute.Name {colattrName} 重复存在,请检查(注意:不区分大小写) - - - 属性名 {pName} 重复存在,请检查(注意:不区分大小写) - - - {function} 功能要求实体类 {tableCsName} 必须有主键 - - - {tbTypeFullName} 是父子关系,但是 MySql 8.0 以下版本中不支持组合多主键 - - - {tbTypeFullName} 不是父子关系,无法使用该功能 - - - 这个特别的子查询不能解析 - - - 表达式错误,它的顶级对象不是 ParameterExpression:{exp} - - - 表达式错误,它不是连续的 MemberAccess 类型:{exp} - - - ExpressionTree 转换类型错误,值({value}),类型({valueTypeFullName}),目标类型({typeFullName}),{exMessage} - - - 未能解析分表字段值 {sqlWhere} - - - AsTable 未实现的功能 {asTable} - - - GBase 暂时不支持逗号以外的分割符 - - - tableName:{tableName} 生成了相同的分表名 - - - GetPrimarys 传递的参数 "{primary}" 不正确,它不属于字典数据的键名 - - - 已经指定了 {first},不能再指定 {second} - - - {tb2DbName}.{mp2MemberName} 被忽略,请检查 IsIgnore 设置,确认 get/set 为 public - - - Include 参数类型错误 - - - Include 参数类型错误,集合属性请使用 IncludeMany - - - Include 参数类型错误,表达式类型应该为 MemberAccess - - - IncludeMany 类型 {tbTypeDisplayCsharp} 的属性 {collMemMemberName} 不是有效的导航属性,提示:IsIgnore = true 不会成为导航属性 - - - IncludeMany {navigateSelector} 参数错误,Select 只可以使用一个参数的方法,正确格式:.Select(t =>new TNavigate {{}}) - - - IncludeMany {navigateSelector} 参数错误,Select lambda参数返回值必须和 {collMemElementType} 类型一致 - - - IncludeMany 参数1 类型错误,表达式类型应该为 MemberAccess - - - IncludeMany {navigateSelector} 参数类型错误,正确格式: a.collections.Take(1).Where(c =>c.aid == a.id).Select(a=> new TNavigate{{}}) - - - ISelect.InsertInto() 未选择属性: {displayCsharp} - - - ISelect.InsertInto() 类型错误: {displayCsharp} - - - InsertOrUpdate 功能执行 merge into 要求实体类 {CsName} 必须有主键 - - - InsertOrUpdate<>的泛型参数 不支持 {typeofT1},请传递您的实体类 - - - 【延时加载】功能需要安装 FreeSql.Extensions.LazyLoading.dll,可前往 nuget 下载 - - - 【延时加载】{trytbTypeName} 编译错误:{exMessage}\r\n\r\n{cscode} - - - 【延时加载】实体类型 {trytbTypeName} 必须声明为 public - - - ManyToMany 导航属性 .AsSelect() 暂时不可用于 Sum/Avg/Max/Min/First/ToOne/ToList 方法 - - - 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 在 {tbmidCsName} 中没有找到对应的字段,如:{midTypePropsTrytbName}{findtrytbPkCsName}、{midTypePropsTrytbName}_{findtrytbPkCsName} - - - 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,实体类型 {tbrefTypeName} 缺少主键标识,[Column(IsPrimary = true)] - - - 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,实体类型 {tbrefTypeName} 必须存在对应的 [Navigate(ManyToMany = x)] 集合属性 - - - 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,{tbmidCsName}.{trycolCsName} 和 {trytbCsName}.{trytbPrimarysCsName} 类型不一致 - - - 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,中间类 {tbmidCsName}.{midTypePropsTrytbName} 错误:{exMessage} - - - 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,中间类 {tbmidCsName}.{midTypePropsTrytbName} 导航属性不是【ManyToOne】或【OneToOne】 - - - 映射异常:{name} 没有一个属性名相同 - - - Ado.MasterPool 值为 null,该操作无法自启用事务,请显式传递【事务对象】解决 - - - 缺少 FreeSql 数据库实现包:FreeSql.Provider.{Provider}.dll,可前往 nuget 下载 - - - 缺少 FreeSql 数据库实现包:{dll},可前往 nuget 下载;如果存在 {dll} 依然报错(原因是环境问题导致反射不到类型),请在 UseConnectionString/UseConnectionFactory 第三个参数手工传入 typeof({providerType}) - - - 导航属性 {trytbTypeName}.{pnvName} 特性 [Navigate] Bind 数目({bindColumnsCount}) 与 外部主键数目({tbrefPrimarysLength}) 不相同 - - - {tb2DbName}.{mp2MemberName} 导航属性集合忘了 .AsSelect() 吗?如果在 ToList(a => a.{mp2MemberName}) 中使用,请移步参考 IncludeMany 文档。 - - - 【导航属性】{trytbTypeDisplayCsharp}.{pName} 缺少 set 属性 - - - 导航属性 {trytbTypeName}.{pnvName} 没有找到对应的字段,如:{pnvName}{findtbrefPkCsName}、{pnvName}_{findtbrefPkCsName}。或者使用 [Navigate] 特性指定关系映射。 - - - 导航属性 {trytbTypeName}.{pnvName} 解析错误,实体类型 {trytcTypeName} 缺少主键标识,[Column(IsPrimary = true)] - - - 导航属性 {trytbTypeName}.{pnvName} 解析错误,{trytbCsName}.{trycolCsName} 和 {tbrefCsName}.{tbrefPrimarysCsName} 类型不一致 - - - 导航属性 {trytbTypeName}.{pnvName} 特性 [Navigate] 解析错误,在 {tbrefTypeName} 未找到属性:{bi} - - - {tableTypeDisplayCsharp} 没有定义主键,无法使用 SetSource,请尝试 SetDto 或者 SetSource 指定临时主键 - - - 没有定义属性 - - - 未实现 - - - 未实现函数表达式 {exp} 解析 - - - 未实现函数表达式 {exp} 解析,参数 {expArguments} 必须为常量 - - - 未实现函数表达式 {exp} 解析,如果正在操作导航属性集合,请使用 .AsSelect().{exp3MethodName}({exp3ArgumentsCount}) - - - 未实现 MemberAccess 下的 Constant - - - 未实现 {name} - - - 不支持 - - - {dataType} 不支持 OrderByRandom 随机排序 - - - {property} 不是有效的导航属性 - - - {dbName} 找不到列 {memberName} - - - 找不到 {CsName} 对应的列 - - - 找不到属性:{memberName} - - - 找不到属性名 {proto} - - - Custom 找不到对应的{{ 反射信息 }}:{fiValueCustomArray} - - - Custom 找不到对应的{{ 静态方法名 }}:{fiValueCustomArray} - - - [Table(AsTable = xx)] 设置的属性名 {atmGroupsValue} 不存在 - - - 未指定 UseConnectionString 或者 UseConnectionFactory - - - 【{policyName}】ObjectPool.{GetName}() timeout {totalSeconds} seconds, see: https://github.com/dotnetcore/FreeSql/discussions/1081 - - - 【{policyName}】ObjectPool.GetAsync() The queue is too long. Policy.AsyncGetCapacity = {asyncGetCapacity} - - - 【OneToMany】导航属性 {trytbTypeName}.{pnvName} 在 {tbrefCsName} 中没有找到对应的字段,如:{findtrytb}{findtrytbPkCsName}、{findtrytb}_{findtrytbPkCsName} - - - 【OneToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,{trytbCsName}.{trytbPrimarysCsName} 和 {tbrefCsName}.{trycolCsName} 类型不一致 - - - 、{refpropName}{findtrytbPkCsName}、{refpropName}_{findtrytbPkCsName}。或者使用 [Navigate] 特性指定关系映射。 - - - 参数 field 未指定 - - - {property} 参数错误,它不是集合属性,必须为 IList<T> 或者 ICollection<T> - - - {property} 参数错误,它不是有效的导航属性 - - - {where} 参数错误,{keyval} 不是有效的属性名,在实体类 {reftbTypeDisplayCsharp} 无法找到 - - - {property} 参数错误,格式 "TopicId=Id,多组使用逗号连接" - - - 解析失败 {callExpMethodName} {message} - - - 【{policyName}】The ObjectPool has been disposed, see: https://github.com/dotnetcore/FreeSql/discussions/1079 - - - 【{policyName}】状态不可用,等待后台检查程序恢复方可使用。{UnavailableExceptionMessage} - - - 属性{trytbVersionColumnCsName} 被标注为行锁(乐观锁)(IsVersion),但其必须为数字类型 或者 byte[] 或者 string,并且不可为 Nullable - - - properties 参数不能为空 - - - {property} 属性名无法找到 - - - Range 要求 Value 应该逗号分割,并且长度为 2 - - - 回滚 - - - 运行时错误,反射获取 IncludeMany 方法失败 - - - 蛋疼的 Access 插入只能一条一条执行,不支持 values(..),(..) 也不支持 select .. UNION ALL select .. - Providers - - - BaseEntity.Initialization 初始化错误,获取到 IFreeSql 是 null - Extensions - - - 【{thisName}】Block access and wait for recovery: {exMessage} - Providers - - - 无法将 IQueryable<{typeofName}> 转换为 ISelect<{typeofName}>,因为他的实现不是 FreeSql.Extensions.Linq.QueryableProvider - Extensions - - - 连接字符串错误 - Providers - - - 【{thisName}】连接字符串错误,请检查。 - Providers - - - 连接字符串错误,或者检查项目属性 > 生成 > 目标平台:x86 | x64,或者改用 FreeSql.Provider.SqliteCore 访问 arm 平台 - Providers - - - 【{thisName}】连接字符串错误,请检查。或者检查项目属性 > 生成 > 目标平台:x86 | x64,或者改用 FreeSql.Provider.SqliteCore 访问 arm 平台 - Providers - - - FreeSql.Provider.CustomAdapter 无法使用 CreateCommand - Providers - - - FreeSql.Provider.CustomAdapter 仅支持 UseConnectionFactory 方式构建 IFreeSql - Providers - - - 达梦 CodeFirst 不支持代码创建 tablespace 与 schemas {tbname} - Providers - - - -DB 参数错误,未提供 ConnectionString - Extensions - - - -DB 参数错误,格式为:MySql,ConnectionString - Extensions - - - -DB 参数错误,不支持的类型:"{dbargs}" - Extensions - - - {method} 是 FreeSql.Provider.{provider} 特有的功能 - Providers - - - fsql.InsertOrUpdate Sqlite 无法完成 UpdateColumns 操作 - Providers - - - 主库 - Providers - - - MygisGeometry.Parse 未实现 "{wkt}" - Providers - - - -NameOptions 参数错误,格式为:0,0,0,0 - Extensions - - - 未实现该功能 - Providers - - - 未实现错误,请反馈给作者 - Providers - - - 找不到 {name} - Providers - - - FreeSql.Provider.{providerName} 未实现 Skip/Offset 功能,如果需要分页请使用判断上一次 id - Providers - - - 对象池 - Providers - - - 旧表(OldName):{tboldname} 存在,数据库已存在 {tbname} 表,无法改名 - Providers - - - OnConflictDoUpdate 功能要求实体类必须设置 IsPrimary 属性 - Providers - - - Oracle CodeFirst 不支持代码创建 tablespace 与 schemas {tbname} - Providers - - - 解析失败 {callExpMethodName} {message},提示:可以使用扩展方法 IQueryable.RestoreToSelect() 还原为 ISelect 再查询 - Extensions - - - fsql.InsertOrUpdate + IfExistsDoNothing + {providerName}要求实体类 {tableCsName} 必须有主键 - Providers - - - SelectMany 错误的类型:{typeFullName} - Extensions - - - 从库 - Providers - - - 类型 {objentityTypeFullName} 不可迁移 - Providers - - - 类型 {objentityTypeFullName} 不可迁移,可迁移属性0个 - Providers - - - 未实现 {columnDbTypeTextFull} 类型映射 - Providers - - - 错误的参数设置:{args} - Extensions - - - {qoteSql} is NULL,除非设置特性 [Column(IsNullable = false)] - - - 分表字段值 "{dt}" 不能小于 "{beginTime} " - - - 分表字段值不能为 null - - - 分表字段值 "{columnValue}" 不能转化成 DateTime - - - 分表字段值 "{dt}" 未匹配到分表名 - - - T2 类型错误 - - - tableName 格式错误,示例:“log_{yyyyMMdd}” - - - {Type}.AsType 参数错误,请传入正确的实体类型 - - - {thatFullName} 类型无法访问构造函数 - - - {name} 类型错误 - - - {Type}.AsType 参数不支持指定为 object - - - 类型 {typeofFullName} 错误,不能使用 IncludeMany - - - 无法解析表达式:{exp} - - - 无法解析表达式方法 {exp3tmpCallMethodName} - - - 请使用 fsql.InsertDict(dict) 方法插入字典数据 - - \ No newline at end of file diff --git a/FreeSql/Properties/Resources.tt b/FreeSql/Properties/Resources.tt deleted file mode 100644 index 935558b84..000000000 --- a/FreeSql/Properties/Resources.tt +++ /dev/null @@ -1,281 +0,0 @@ -<#@ template hostspecific="true" #> -<#@ assembly name="System.Core" #> -<#@ assembly name="EnvDTE" #> -<#@ assembly name="System.Windows.Forms" #> -<#@ import namespace="System.Collections" #> -<#@ import namespace="System.Collections.Generic" #> -<#@ import namespace="System.ComponentModel.Design" #> -<#@ import namespace="System.IO" #> -<#@ import namespace="System.Linq" #> -<#@ import namespace="System.Resources" #> -<#@ import namespace="System.Text.RegularExpressions" #> -<#@ import namespace="EnvDTE" #> -<#@ import namespace="System.IO" #> -<#@ import namespace="Microsoft.VisualStudio.TextTemplating" #> - -<# - var model = LoadResources(); -#> -// - -using System; -using System.Reflection; -using System.Resources; -using System.Globalization; -<# - if (!model.NoDiagnostics) - { -#> -using System.Threading; -<# - } -#> - -namespace <#= model.Namespace #> -{ -<# - if (model.Namespace.EndsWith("Internal") - || model.AccessModifier == "internal") - { -#> - /// - /// This is an internal API that supports the FreeSql infrastructure and not subject to - /// the same compatibility standards as public APIs. It may be changed or removed without notice in - /// any release. You should only use it directly in your code with extreme caution and knowing that - /// doing so can result in application failures when updating to a new FreeSql release. - /// -<# - } - else - { -#> - /// - /// - /// String resources used in FreeSql exceptions, etc. - /// - /// - /// These strings are exposed publicly for use by database providers and extensions. - /// It is unusual for application code to need these strings. - /// - /// -<# - } -#> - <#= model.AccessModifier #> static class <#= model.Class #> - { - private static readonly ResourceManager _resourceManager = new ResourceManager("<#= model.ResourceName #>", typeof(<#= model.Class #>).Assembly); - - private static CultureInfo _resourceCulture; - - /// - /// 重写当前线程的 CurrentUICulture 属性,对 - /// 使用此强类型资源类的所有资源查找执行重写。 - /// - public static CultureInfo Culture - { - get - { - return _resourceCulture; - } - set - { - _resourceCulture = value; - } - } -<# - foreach (var resource in model.Resources) - { -#> - - /// -<# - foreach (var line in Lines(resource.Value)) - { -#> - /// <#= Xml(line) #> -<# - } -#> - /// -<# - if (resource.Obsolete) - { -#> - [Obsolete] -<# - } - - if (resource.Parameters.Any()) - { -#> - public static string <#= resource.Name #>(<#= List("object ", resource.Parameters.Select(e => e.ParamString)) #>) - => string.Format( - GetString("<#= resource.Name #>", <#= List(resource.Parameters.Select(e => e.NameOfString)) #>), - <#= List(resource.Parameters.Select(e => e.ParamString)) #>); -<# - } - else - { -#> - public static string <#= resource.Name #> - => GetString("<#= resource.Name #>"); -<# - } - } -#> - - private static string GetString(string name, params string[] formatterNames) - { - var value = _resourceManager.GetString(name,_resourceCulture); - for (var i = 0; i < formatterNames.Length; i++) - { - value = value.Replace("{" + formatterNames[i] + "}", "{" + i + "}"); - } - - return value; - } - } -} - -<#+ - ResourceFile LoadResources() - { - var result = new ResourceFile(); - - if (Session.ContainsKey("AccessModifier")) - { - result.AccessModifier = (string)Session["AccessModifier"]; - }; - - var services = (IServiceProvider)Host; - var dte = (DTE)services.GetCOMService(typeof(DTE)); - if (!Session.TryGetValue("NoDiagnostics", out var noDiagnostics)) - { - noDiagnostics = false; - } - - result.NoDiagnostics = (bool)noDiagnostics; - - var resourceFile = (string)Session["ResourceFile"]; - if (!Path.IsPathRooted(resourceFile)) - { - resourceFile = Host.ResolvePath(resourceFile); - } - - var resourceProjectItem = dte.Solution.FindProjectItem(resourceFile); - var templateProjectItem = dte.Solution.FindProjectItem(Host.TemplateFile); - var project = templateProjectItem.ContainingProject; - var rootNamespace = (string)project.Properties.Item("RootNamespace").Value; - var resourceDir = Path.GetDirectoryName(resourceFile); - var projectDir = (string)project.Properties.Item("FullPath").Value; - var resourceNamespace = rootNamespace + "." + resourceDir.Substring(projectDir.Length) - .Replace(Path.DirectorySeparatorChar, '.'); - - result.Namespace = (string)resourceProjectItem.Properties.Item("CustomToolNamespace")?.Value; - if (string.IsNullOrEmpty(result.Namespace)) - { - result.Namespace = resourceNamespace; - } - - result.Class = Path.GetFileNameWithoutExtension(resourceFile); - - result.ResourceName = resourceNamespace + "." + result.Class; - if(File.Exists(resourceFile.Replace(".resx", ".zh-Hans.resx"))) - { - resourceFile = resourceFile.Replace(".resx", ".zh-Hans.resx"); - } - List sortedResources; - using (var reader = new ResXResourceReader(resourceFile)) - { - reader.UseResXDataNodes = true; - sortedResources = Enumerable.ToList( - from DictionaryEntry r in reader - orderby r.Key - select (ResXDataNode)r.Value); - - result.Resources = sortedResources - .Select(r => new Resource(r)) - .ToList(); - } - - using (var writer = new ResXResourceWriter(resourceFile)) - { - foreach (var node in sortedResources) - writer.AddResource(node); - - writer.Generate(); - } - - return result; - } - - IEnumerable Lines(string value) - => value.Split(new[] { Environment.NewLine }, StringSplitOptions.None); - - string Xml(string value) - => value.Replace("<", "<").Replace(">", ">"); - - string List(IEnumerable items) - => List(null, items); - - string List(string prefix, IEnumerable items, string suffix = null) - => string.Join(", ", items.Select(i => prefix + i + suffix)); - - class ResourceFile - { - public string Namespace { get; set; } - public string AccessModifier { get; set; } = "public"; - public string Class { get; set; } - public string ResourceName { get; set; } - public IEnumerable Resources { get; set; } - public bool NoDiagnostics { get; set; } - } - - class Resource - { - public Resource(ResXDataNode node) - { - Name = node.Name; - Value = (string)node.GetValue((ITypeResolutionService)null); - var parameters = Regex.Matches(Value, @"\{(\w+)\}") - .Cast() - .Select(m => m.Groups[1].Value) - .Distinct() - .Select(n => ("nameof(" + n + ")", n)) - .ToList(); - - foreach (var parameter in parameters.ToList()) - { - var rawString = parameter.Item2; - var underscoreIndex = rawString.IndexOf('_'); - if (underscoreIndex > 0) - { - var newIndex = int.Parse(rawString.Substring(0, underscoreIndex)); - parameters[newIndex] = ("\"" + rawString + "\"", rawString.Substring(underscoreIndex + 1)); - } - } - - Parameters = parameters; - - var eventInfo = node.Comment.Split(' '); - var argumentsRead = 0; - if (eventInfo.FirstOrDefault() == "Obsolete") - { - Obsolete = true; - argumentsRead++; - } - - Level = eventInfo.Skip(argumentsRead++).FirstOrDefault() ?? "BadLevel"; - EventId = eventInfo.Skip(argumentsRead++).FirstOrDefault() ?? "BadEventId"; - Types = eventInfo.Skip(argumentsRead++).ToList(); - } - - public string Name { get; } - public string Value { get; } - public string EventId { get; } - public string Level { get; } - public bool Obsolete { get; } - public IEnumerable<(string NameOfString, string ParamString)> Parameters { get; } - public IEnumerable Types { get; } - } -#> \ No newline at end of file diff --git a/Providers/FreeSql.Provider.ClickHouse/ClickHouseAdo/ClickHouseAdo.cs b/Providers/FreeSql.Provider.ClickHouse/ClickHouseAdo/ClickHouseAdo.cs index 2bd3ebd09..806beac12 100644 --- a/Providers/FreeSql.Provider.ClickHouse/ClickHouseAdo/ClickHouseAdo.cs +++ b/Providers/FreeSql.Provider.ClickHouse/ClickHouseAdo/ClickHouseAdo.cs @@ -30,14 +30,14 @@ public ClickHouseAdo(CommonUtils util, string masterConnectionString, string[] s if (isAdoPool) masterConnectionString = masterConnectionString.Substring("AdoConnectionPool,".Length); if (!string.IsNullOrEmpty(masterConnectionString)) MasterPool = isAdoPool ? - new DbConnectionStringPool(base.DataType, CoreStrings.S_MasterDatabase, () => new ClickHouseConnection(masterConnectionString)) as IObjectPool : - new ClickHouseConnectionPool(CoreStrings.S_MasterDatabase, masterConnectionString, null, null); + new DbConnectionStringPool(base.DataType, CoreErrorStrings.S_MasterDatabase, () => new ClickHouseConnection(masterConnectionString)) as IObjectPool : + new ClickHouseConnectionPool(CoreErrorStrings.S_MasterDatabase, masterConnectionString, null, null); slaveConnectionStrings?.ToList().ForEach(slaveConnectionString => { var slavePool = isAdoPool ? - new DbConnectionStringPool(base.DataType, $"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => new ClickHouseConnection(slaveConnectionString)) as IObjectPool : - new ClickHouseConnectionPool($"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables)); + new DbConnectionStringPool(base.DataType, $"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => new ClickHouseConnection(slaveConnectionString)) as IObjectPool : + new ClickHouseConnectionPool($"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables)); SlavePools.Add(slavePool); }); } diff --git a/Providers/FreeSql.Provider.ClickHouse/ClickHouseAdo/ClickHouseConnectionPool.cs b/Providers/FreeSql.Provider.ClickHouse/ClickHouseAdo/ClickHouseConnectionPool.cs index 62f8983b5..3c696259a 100644 --- a/Providers/FreeSql.Provider.ClickHouse/ClickHouseAdo/ClickHouseConnectionPool.cs +++ b/Providers/FreeSql.Provider.ClickHouse/ClickHouseAdo/ClickHouseConnectionPool.cs @@ -57,7 +57,7 @@ class ClickHouseConnectionPoolPolicy : IPolicy { internal ClickHouseConnectionPool _pool; - public string Name { get; set; } = $"ClickHouse ClickHouseConnection {CoreStrings.S_ObjectPool}"; + public string Name { get; set; } = $"ClickHouse ClickHouseConnection {CoreErrorStrings.S_ObjectPool}"; public int PoolSize { get; set; } = 100; public TimeSpan SyncGetTimeout { get; set; } = TimeSpan.FromSeconds(10); public TimeSpan IdleTimeout { get; set; } = TimeSpan.FromSeconds(20); @@ -131,8 +131,8 @@ public void OnGet(Object obj) { if (obj.Value == null) { - _pool.SetUnavailable(new Exception(CoreStrings.S_ConnectionStringError), obj.LastGetTimeCopy); - throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name)); + _pool.SetUnavailable(new Exception(CoreErrorStrings.S_ConnectionStringError), obj.LastGetTimeCopy); + throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name)); } if (obj.Value.State != ConnectionState.Open || DateTime.Now.Subtract(obj.LastReturnTime).TotalSeconds > 60 && obj.Value.Ping() == false) @@ -161,8 +161,8 @@ async public Task OnGetAsync(Object obj) { if (obj.Value == null) { - _pool.SetUnavailable(new Exception(CoreStrings.S_ConnectionStringError), obj.LastGetTimeCopy); - throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name)); + _pool.SetUnavailable(new Exception(CoreErrorStrings.S_ConnectionStringError), obj.LastGetTimeCopy); + throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name)); } if (obj.Value.State != ConnectionState.Open || DateTime.Now.Subtract(obj.LastReturnTime).TotalSeconds > 60 && (await obj.Value.PingAsync()) == false) diff --git a/Providers/FreeSql.Provider.ClickHouse/ClickHouseCodeFirst.cs b/Providers/FreeSql.Provider.ClickHouse/ClickHouseCodeFirst.cs index 16282cabd..642ee15fd 100644 --- a/Providers/FreeSql.Provider.ClickHouse/ClickHouseCodeFirst.cs +++ b/Providers/FreeSql.Provider.ClickHouse/ClickHouseCodeFirst.cs @@ -173,9 +173,9 @@ protected override string GetComparisonDDLStatements(params TypeSchemaAndName[] sb.Append("\r\n"); var tb = obj.tableSchema; if (tb == null) - throw new Exception(CoreStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); + throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); if (tb.Columns.Any() == false) - throw new Exception(CoreStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); + throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); var tbname = _commonUtils.SplitTableName(tb.DbName); if (tbname?.Length == 1) tbname = new[] { database, tbname[0] }; diff --git a/Providers/FreeSql.Provider.ClickHouse/ClickHouseExpression.cs b/Providers/FreeSql.Provider.ClickHouse/ClickHouseExpression.cs index d66028146..0938d2b1e 100644 --- a/Providers/FreeSql.Provider.ClickHouse/ClickHouseExpression.cs +++ b/Providers/FreeSql.Provider.ClickHouse/ClickHouseExpression.cs @@ -299,7 +299,7 @@ public override string ExpressionLambdaToSqlCallString(MethodCallExpression exp, return _common.StringConcat(concatNewArrExp.Expressions.Select(a => getExp(a)).ToArray(), null); return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null); case "Format": - if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); + if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreErrorStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); if (exp.Arguments.Count == 1) return ExpressionLambdaToSql(exp.Arguments[0], tsc); var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ? (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0); diff --git a/Providers/FreeSql.Provider.ClickHouse/Curd/ClickHouseDelete.cs b/Providers/FreeSql.Provider.ClickHouse/Curd/ClickHouseDelete.cs index 933253c5f..bc9e2f048 100644 --- a/Providers/FreeSql.Provider.ClickHouse/Curd/ClickHouseDelete.cs +++ b/Providers/FreeSql.Provider.ClickHouse/Curd/ClickHouseDelete.cs @@ -17,7 +17,7 @@ public ClickHouseDelete(IFreeSql orm, CommonUtils commonUtils, CommonExpression { } - public override List ExecuteDeleted() => throw new NotImplementedException($"FreeSql.Provider.ClickHouse {CoreStrings.S_Not_Implemented_Feature}"); + public override List ExecuteDeleted() => throw new NotImplementedException($"FreeSql.Provider.ClickHouse {CoreErrorStrings.S_Not_Implemented_Feature}"); public override string ToSql() { @@ -59,7 +59,7 @@ public override int ExecuteAffrows() #if net40 #else - public override Task> ExecuteDeletedAsync(CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Provider.ClickHouse {CoreStrings.S_Not_Implemented_Feature}"); + public override Task> ExecuteDeletedAsync(CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Provider.ClickHouse {CoreErrorStrings.S_Not_Implemented_Feature}"); async public override Task ExecuteAffrowsAsync(CancellationToken cancellationToken = default) { diff --git a/Providers/FreeSql.Provider.ClickHouse/Curd/ClickHouseUpdate.cs b/Providers/FreeSql.Provider.ClickHouse/Curd/ClickHouseUpdate.cs index d6654acad..4aa31bfad 100644 --- a/Providers/FreeSql.Provider.ClickHouse/Curd/ClickHouseUpdate.cs +++ b/Providers/FreeSql.Provider.ClickHouse/Curd/ClickHouseUpdate.cs @@ -30,7 +30,7 @@ public ClickHouseUpdate(IFreeSql orm, CommonUtils commonUtils, CommonExpression public override int ExecuteAffrows() => SplitExecuteAffrows(_batchRowsLimit > 0 ? _batchRowsLimit : 500, _batchParameterLimit > 0 ? _batchParameterLimit : 3000); protected override List ExecuteUpdated(IEnumerable columns) => base.SplitExecuteUpdated(_batchRowsLimit > 0 ? _batchRowsLimit : 500, _batchParameterLimit > 0 ? _batchParameterLimit : 3000, columns); - protected override List RawExecuteUpdated(IEnumerable columns) => throw new NotImplementedException($"FreeSql.Provider.ClickHouse {CoreStrings.S_Not_Implemented_Feature}"); + protected override List RawExecuteUpdated(IEnumerable columns) => throw new NotImplementedException($"FreeSql.Provider.ClickHouse {CoreErrorStrings.S_Not_Implemented_Feature}"); protected override void ToSqlCase(StringBuilder caseWhen, ColumnInfo[] primarys) { @@ -280,7 +280,7 @@ protected override void SplitExecute(int valuesLimit, int parameterLimit, string public override Task ExecuteAffrowsAsync(CancellationToken cancellationToken = default) => SplitExecuteAffrowsAsync(_batchRowsLimit > 0 ? _batchRowsLimit : 500, _batchParameterLimit > 0 ? _batchParameterLimit : 3000, cancellationToken); protected override Task> ExecuteUpdatedAsync(IEnumerable columns, CancellationToken cancellationToken = default) => base.SplitExecuteUpdatedAsync(_batchRowsLimit > 0 ? _batchRowsLimit : 500, _batchParameterLimit > 0 ? _batchParameterLimit : 3000, columns, cancellationToken); - protected override Task> RawExecuteUpdatedAsync(IEnumerable columns, CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Provider.ClickHouse {CoreStrings.S_Not_Implemented_Feature}"); + protected override Task> RawExecuteUpdatedAsync(IEnumerable columns, CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Provider.ClickHouse {CoreErrorStrings.S_Not_Implemented_Feature}"); async protected override Task SplitExecuteAsync(int valuesLimit, int parameterLimit, string traceName, Func executeAsync, CancellationToken cancellationToken = default) { diff --git a/Providers/FreeSql.Provider.Custom/Curd/CustomDelete.cs b/Providers/FreeSql.Provider.Custom/Curd/CustomDelete.cs index c5da7864c..67fbcdd39 100644 --- a/Providers/FreeSql.Provider.Custom/Curd/CustomDelete.cs +++ b/Providers/FreeSql.Provider.Custom/Curd/CustomDelete.cs @@ -16,11 +16,11 @@ public CustomDelete(IFreeSql orm, CommonUtils commonUtils, CommonExpression comm { } - public override List ExecuteDeleted() => throw new NotImplementedException($"FreeSql.Provider.Custom {CoreStrings.S_Not_Implemented_Feature}"); + public override List ExecuteDeleted() => throw new NotImplementedException($"FreeSql.Provider.Custom {CoreErrorStrings.S_Not_Implemented_Feature}"); #if net40 #else - public override Task> ExecuteDeletedAsync(CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Provider.Custom {CoreStrings.S_Not_Implemented_Feature}"); + public override Task> ExecuteDeletedAsync(CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Provider.Custom {CoreErrorStrings.S_Not_Implemented_Feature}"); #endif } } diff --git a/Providers/FreeSql.Provider.Custom/Curd/CustomInsert.cs b/Providers/FreeSql.Provider.Custom/Curd/CustomInsert.cs index 63fce94d4..0957e264a 100644 --- a/Providers/FreeSql.Provider.Custom/Curd/CustomInsert.cs +++ b/Providers/FreeSql.Provider.Custom/Curd/CustomInsert.cs @@ -62,7 +62,7 @@ protected override long RawExecuteIdentity() return ret; } - protected override List RawExecuteInserted() => throw new NotImplementedException($"FreeSql.Provider.Custom {CoreStrings.S_Not_Implemented_Feature}"); + protected override List RawExecuteInserted() => throw new NotImplementedException($"FreeSql.Provider.Custom {CoreErrorStrings.S_Not_Implemented_Feature}"); #if net40 #else @@ -107,7 +107,7 @@ async protected override Task RawExecuteIdentityAsync(CancellationToken ca } return ret; } - protected override Task> RawExecuteInsertedAsync(CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Provider.Custom {CoreStrings.S_Not_Implemented_Feature}"); + protected override Task> RawExecuteInsertedAsync(CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Provider.Custom {CoreErrorStrings.S_Not_Implemented_Feature}"); #endif } } \ No newline at end of file diff --git a/Providers/FreeSql.Provider.Custom/Curd/CustomSelect.cs b/Providers/FreeSql.Provider.Custom/Curd/CustomSelect.cs index d8dadbdb5..7379a1a9e 100644 --- a/Providers/FreeSql.Provider.Custom/Curd/CustomSelect.cs +++ b/Providers/FreeSql.Provider.Custom/Curd/CustomSelect.cs @@ -38,7 +38,7 @@ internal static string ToSqlStatic(CommonUtils _commonUtils, CommonExpression _c if (_limit > 0 && _utils.Adapter.SelectTopStyle == CustomAdapter.SelecTopStyle.Top) sb.Append("TOP ").Append(_skip + _limit).Append(" "); sb.Append(field); if (_skip > 0 && _utils.Adapter.SelectTopStyle == CustomAdapter.SelecTopStyle.Top) - throw new NotImplementedException(CoreStrings.S_NotImplementSkipOffset("Custom")); + throw new NotImplementedException(CoreErrorStrings.S_NotImplementSkipOffset("Custom")); sb.Append(" \r\nFROM "); var tbsjoin = _tables.Where(a => a.Type != SelectTableInfoType.From).ToArray(); diff --git a/Providers/FreeSql.Provider.Custom/Curd/CustomUpdate.cs b/Providers/FreeSql.Provider.Custom/Curd/CustomUpdate.cs index ee0f30d3a..d7cc5bee2 100644 --- a/Providers/FreeSql.Provider.Custom/Curd/CustomUpdate.cs +++ b/Providers/FreeSql.Provider.Custom/Curd/CustomUpdate.cs @@ -23,7 +23,7 @@ public CustomUpdate(IFreeSql orm, CommonUtils commonUtils, CommonExpression comm public override int ExecuteAffrows() => base.SplitExecuteAffrows(_batchRowsLimit > 0 ? _batchRowsLimit : _utils.Adapter.UpdateBatchSplitLimit, _batchParameterLimit > 0 ? _batchParameterLimit : 255); protected override List ExecuteUpdated(IEnumerable columns) => base.SplitExecuteUpdated(_batchRowsLimit > 0 ? _batchRowsLimit : _utils.Adapter.UpdateBatchSplitLimit, _batchParameterLimit > 0 ? _batchParameterLimit : 255, columns); - protected override List RawExecuteUpdated(IEnumerable columns) => throw new NotImplementedException($"FreeSql.Provider.Custom {CoreStrings.S_Not_Implemented_Feature}"); + protected override List RawExecuteUpdated(IEnumerable columns) => throw new NotImplementedException($"FreeSql.Provider.Custom {CoreErrorStrings.S_Not_Implemented_Feature}"); protected override void ToSqlCase(StringBuilder caseWhen, ColumnInfo[] primarys) { @@ -65,7 +65,7 @@ protected override void ToSqlWhen(StringBuilder sb, ColumnInfo[] primarys, objec public override Task ExecuteAffrowsAsync(CancellationToken cancellationToken = default) => base.SplitExecuteAffrowsAsync(_batchRowsLimit > 0 ? _batchRowsLimit : _utils.Adapter.UpdateBatchSplitLimit, _batchParameterLimit > 0 ? _batchParameterLimit : 255, cancellationToken); protected override Task> ExecuteUpdatedAsync(IEnumerable columns, CancellationToken cancellationToken = default) => base.SplitExecuteUpdatedAsync(_batchRowsLimit > 0 ? _batchRowsLimit : _utils.Adapter.UpdateBatchSplitLimit, _batchParameterLimit > 0 ? _batchParameterLimit : 255, columns, cancellationToken); - protected override Task> RawExecuteUpdatedAsync(IEnumerable columns, CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Provider.Custom {CoreStrings.S_Not_Implemented_Feature}"); + protected override Task> RawExecuteUpdatedAsync(IEnumerable columns, CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Provider.Custom {CoreErrorStrings.S_Not_Implemented_Feature}"); #endif } } diff --git a/Providers/FreeSql.Provider.Custom/CustomAdo/CustomAdo.cs b/Providers/FreeSql.Provider.Custom/CustomAdo/CustomAdo.cs index fa00d2fdd..2ffb15940 100644 --- a/Providers/FreeSql.Provider.Custom/CustomAdo/CustomAdo.cs +++ b/Providers/FreeSql.Provider.Custom/CustomAdo/CustomAdo.cs @@ -24,7 +24,7 @@ public CustomAdo(CommonUtils util, string masterConnectionString, string[] slave _CreateParameterCommand = CreateCommand(); return; } - throw new Exception(CoreStrings.S_CustomAdapter_OnlySuppport_UseConnectionFactory); + throw new Exception(CoreErrorStrings.S_CustomAdapter_OnlySuppport_UseConnectionFactory); } CustomAdapter Adapter => (_util == null ? FreeSqlCustomAdapterGlobalExtensions.DefaultAdapter : _util._orm.GetCustomAdapter()); @@ -68,7 +68,7 @@ public override DbCommand CreateCommand() cmd.Connection = null; return cmd; } - throw new Exception(CoreStrings.S_CustomAdapter_Cannot_Use_CreateCommand); + throw new Exception(CoreErrorStrings.S_CustomAdapter_Cannot_Use_CreateCommand); } public DbParameter CreateParameter() { diff --git a/Providers/FreeSql.Provider.Custom/CustomCodeFirst.cs b/Providers/FreeSql.Provider.Custom/CustomCodeFirst.cs index 1dc024c53..22d53754d 100644 --- a/Providers/FreeSql.Provider.Custom/CustomCodeFirst.cs +++ b/Providers/FreeSql.Provider.Custom/CustomCodeFirst.cs @@ -90,6 +90,6 @@ public override DbInfoResult GetDbInfo(Type type) return null; } - protected override string GetComparisonDDLStatements(params TypeSchemaAndName[] objects) => throw new NotImplementedException($"FreeSql.Provider.Custom {CoreStrings.S_Not_Implemented_Feature}"); + protected override string GetComparisonDDLStatements(params TypeSchemaAndName[] objects) => throw new NotImplementedException($"FreeSql.Provider.Custom {CoreErrorStrings.S_Not_Implemented_Feature}"); } } \ No newline at end of file diff --git a/Providers/FreeSql.Provider.Custom/CustomProvider.cs b/Providers/FreeSql.Provider.Custom/CustomProvider.cs index ce223f39a..db54cecb7 100644 --- a/Providers/FreeSql.Provider.Custom/CustomProvider.cs +++ b/Providers/FreeSql.Provider.Custom/CustomProvider.cs @@ -18,9 +18,9 @@ public class CustomProvider : BaseDbProvider, IFreeSql public override IInsert CreateInsertProvider() => new CustomInsert(this, this.InternalCommonUtils, this.InternalCommonExpression); public override IUpdate CreateUpdateProvider(object dywhere) => new CustomUpdate(this, this.InternalCommonUtils, this.InternalCommonExpression, dywhere); public override IDelete CreateDeleteProvider(object dywhere) => new CustomDelete(this, this.InternalCommonUtils, this.InternalCommonExpression, dywhere); - public override IInsertOrUpdate CreateInsertOrUpdateProvider() => throw new NotImplementedException($"FreeSql.Provider.Custom {CoreStrings.S_Not_Implemented_Feature}"); + public override IInsertOrUpdate CreateInsertOrUpdateProvider() => throw new NotImplementedException($"FreeSql.Provider.Custom {CoreErrorStrings.S_Not_Implemented_Feature}"); - public override IDbFirst DbFirst => throw new NotImplementedException($"FreeSql.Provider.Custom {CoreStrings.S_Not_Implemented_Feature}"); + public override IDbFirst DbFirst => throw new NotImplementedException($"FreeSql.Provider.Custom {CoreErrorStrings.S_Not_Implemented_Feature}"); public CustomProvider(string masterConnectionString, string[] slaveConnectionString, Func connectionFactory = null) { diff --git a/Providers/FreeSql.Provider.Custom/MySql/Curd/CustomMySqlInsertOrUpdate.cs b/Providers/FreeSql.Provider.Custom/MySql/Curd/CustomMySqlInsertOrUpdate.cs index bc6f4dc75..a645a8684 100644 --- a/Providers/FreeSql.Provider.Custom/MySql/Curd/CustomMySqlInsertOrUpdate.cs +++ b/Providers/FreeSql.Provider.Custom/MySql/Curd/CustomMySqlInsertOrUpdate.cs @@ -86,7 +86,7 @@ string getInsertSql(List data, bool flagInsert, bool noneParameter) } else { - if (_tempPrimarys.Any() == false) throw new Exception(CoreStrings.Entity_Must_Primary_Key("fsql.InsertOrUpdate + IfExistsDoNothing + MySql ", _table.CsName)); + if (_tempPrimarys.Any() == false) throw new Exception(CoreErrorStrings.Entity_Must_Primary_Key("fsql.InsertOrUpdate + IfExistsDoNothing + MySql ", _table.CsName)); sql = insert.ToSqlValuesOrSelectUnionAll(); if (sql?.StartsWith("INSERT INTO ") == true) sql = $"INSERT IGNORE INTO {sql.Substring(12)}"; diff --git a/Providers/FreeSql.Provider.Custom/MySql/Curd/CustomMySqlOnDuplicateKeyUpdate.cs b/Providers/FreeSql.Provider.Custom/MySql/Curd/CustomMySqlOnDuplicateKeyUpdate.cs index 3af6c7e11..495e306dc 100644 --- a/Providers/FreeSql.Provider.Custom/MySql/Curd/CustomMySqlOnDuplicateKeyUpdate.cs +++ b/Providers/FreeSql.Provider.Custom/MySql/Curd/CustomMySqlOnDuplicateKeyUpdate.cs @@ -17,7 +17,7 @@ public class CustomMySqlOnDuplicateKeyUpdate where T1 : class public CustomMySqlOnDuplicateKeyUpdate(IInsert insert) { _mysqlInsert = insert as CustomMySqlInsert; - if (_mysqlInsert == null) throw new Exception(CoreStrings.S_Features_Unique("OnDuplicateKeyUpdate", "Odbc/MySql")); + if (_mysqlInsert == null) throw new Exception(CoreErrorStrings.S_Features_Unique("OnDuplicateKeyUpdate", "Odbc/MySql")); if (_mysqlInsert._noneParameterFlag == "c") _mysqlInsert._noneParameterFlag = "cu"; } diff --git a/Providers/FreeSql.Provider.Custom/MySql/CustomMySqlAdo/CustomMySqlAdo.cs b/Providers/FreeSql.Provider.Custom/MySql/CustomMySqlAdo/CustomMySqlAdo.cs index 21f794f31..9dc1516d9 100644 --- a/Providers/FreeSql.Provider.Custom/MySql/CustomMySqlAdo/CustomMySqlAdo.cs +++ b/Providers/FreeSql.Provider.Custom/MySql/CustomMySqlAdo/CustomMySqlAdo.cs @@ -24,7 +24,7 @@ public CustomMySqlAdo(CommonUtils util, string masterConnectionString, string[] MasterPool = pool; return; } - throw new Exception(CoreStrings.S_CustomAdapter_OnlySuppport_UseConnectionFactory); + throw new Exception(CoreErrorStrings.S_CustomAdapter_OnlySuppport_UseConnectionFactory); } public override object AddslashesProcessParam(object param, Type mapType, ColumnInfo mapColumn) { diff --git a/Providers/FreeSql.Provider.Custom/MySql/CustomMySqlCodeFirst.cs b/Providers/FreeSql.Provider.Custom/MySql/CustomMySqlCodeFirst.cs index 1ecf43ef4..155ceccc6 100644 --- a/Providers/FreeSql.Provider.Custom/MySql/CustomMySqlCodeFirst.cs +++ b/Providers/FreeSql.Provider.Custom/MySql/CustomMySqlCodeFirst.cs @@ -89,8 +89,8 @@ protected override string GetComparisonDDLStatements(params TypeSchemaAndName[] { if (sb.Length > 0) sb.Append("\r\n"); var tb = obj.tableSchema; - if (tb == null) throw new Exception(CoreStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); - if (tb.Columns.Any() == false) throw new Exception(CoreStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); + if (tb == null) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); + if (tb.Columns.Any() == false) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); var tbname = _commonUtils.SplitTableName(tb.DbName); if (tbname?.Length == 1) tbname = new[] { database, tbname[0] }; diff --git a/Providers/FreeSql.Provider.Custom/MySql/CustomMySqlExpression.cs b/Providers/FreeSql.Provider.Custom/MySql/CustomMySqlExpression.cs index 702301d96..7076d9710 100644 --- a/Providers/FreeSql.Provider.Custom/MySql/CustomMySqlExpression.cs +++ b/Providers/FreeSql.Provider.Custom/MySql/CustomMySqlExpression.cs @@ -250,7 +250,7 @@ public override string ExpressionLambdaToSqlCallString(MethodCallExpression exp, return _common.StringConcat(concatNewArrExp.Expressions.Select(a => getExp(a)).ToArray(), null); return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null); case "Format": - if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); + if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreErrorStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); if (exp.Arguments.Count == 1) return ExpressionLambdaToSql(exp.Arguments[0], tsc); var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ? (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0); diff --git a/Providers/FreeSql.Provider.Custom/Oracle/Curd/CustomOracleDelete.cs b/Providers/FreeSql.Provider.Custom/Oracle/Curd/CustomOracleDelete.cs index cb0774591..bcc0191c7 100644 --- a/Providers/FreeSql.Provider.Custom/Oracle/Curd/CustomOracleDelete.cs +++ b/Providers/FreeSql.Provider.Custom/Oracle/Curd/CustomOracleDelete.cs @@ -16,11 +16,11 @@ public CustomOracleDelete(IFreeSql orm, CommonUtils commonUtils, CommonExpressio { } - public override List ExecuteDeleted() => throw new NotImplementedException($"FreeSql.Odbc.Oracle {CoreStrings.S_Not_Implemented_Feature}"); + public override List ExecuteDeleted() => throw new NotImplementedException($"FreeSql.Odbc.Oracle {CoreErrorStrings.S_Not_Implemented_Feature}"); #if net40 #else - public override Task> ExecuteDeletedAsync(CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Odbc.Oracle {CoreStrings.S_Not_Implemented_Feature}"); + public override Task> ExecuteDeletedAsync(CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Odbc.Oracle {CoreErrorStrings.S_Not_Implemented_Feature}"); #endif } } diff --git a/Providers/FreeSql.Provider.Custom/Oracle/Curd/CustomOracleInsertOrUpdate.cs b/Providers/FreeSql.Provider.Custom/Oracle/Curd/CustomOracleInsertOrUpdate.cs index 696fd8e53..98005f3b5 100644 --- a/Providers/FreeSql.Provider.Custom/Oracle/Curd/CustomOracleInsertOrUpdate.cs +++ b/Providers/FreeSql.Provider.Custom/Oracle/Curd/CustomOracleInsertOrUpdate.cs @@ -32,7 +32,7 @@ public override string ToSql() string getMergeSql(List data) { - if (_tempPrimarys.Any() == false) throw new Exception(CoreStrings.InsertOrUpdate_Must_Primary_Key(_table.CsName)); + if (_tempPrimarys.Any() == false) throw new Exception(CoreErrorStrings.InsertOrUpdate_Must_Primary_Key(_table.CsName)); var tempPrimaryIsIdentity = _tempPrimarys.Any(b => b.Attribute.IsIdentity); var sb = new StringBuilder().Append("MERGE INTO ").Append(_commonUtils.QuoteSqlName(TableRuleInvoke())).Append(" t1 \r\nUSING ("); diff --git a/Providers/FreeSql.Provider.Custom/Oracle/Curd/CustomOracleUpdate.cs b/Providers/FreeSql.Provider.Custom/Oracle/Curd/CustomOracleUpdate.cs index 73cbdd2c3..bfaf317fc 100644 --- a/Providers/FreeSql.Provider.Custom/Oracle/Curd/CustomOracleUpdate.cs +++ b/Providers/FreeSql.Provider.Custom/Oracle/Curd/CustomOracleUpdate.cs @@ -22,7 +22,7 @@ public CustomOracleUpdate(IFreeSql orm, CommonUtils commonUtils, CommonExpressio public override int ExecuteAffrows() => base.SplitExecuteAffrows(_batchRowsLimit > 0 ? _batchRowsLimit : 200, _batchParameterLimit > 0 ? _batchParameterLimit : 999); protected override List ExecuteUpdated(IEnumerable columns) => base.SplitExecuteUpdated(_batchRowsLimit > 0 ? _batchRowsLimit : 200, _batchParameterLimit > 0 ? _batchParameterLimit : 999, columns); - protected override List RawExecuteUpdated(IEnumerable columns) => throw new NotImplementedException($"FreeSql.Custom.Oracle {CoreStrings.S_Not_Implemented_Feature}"); + protected override List RawExecuteUpdated(IEnumerable columns) => throw new NotImplementedException($"FreeSql.Custom.Oracle {CoreErrorStrings.S_Not_Implemented_Feature}"); protected override void ToSqlCase(StringBuilder caseWhen, ColumnInfo[] primarys) { @@ -68,7 +68,7 @@ protected override void ToSqlWhen(StringBuilder sb, ColumnInfo[] primarys, objec public override Task ExecuteAffrowsAsync(CancellationToken cancellationToken = default) => base.SplitExecuteAffrowsAsync(_batchRowsLimit > 0 ? _batchRowsLimit : 200, _batchParameterLimit > 0 ? _batchParameterLimit : 999, cancellationToken); protected override Task> ExecuteUpdatedAsync(IEnumerable columns, CancellationToken cancellationToken = default) => base.SplitExecuteUpdatedAsync(_batchRowsLimit > 0 ? _batchRowsLimit : 200, _batchParameterLimit > 0 ? _batchParameterLimit : 999, columns, cancellationToken); - protected override Task> RawExecuteUpdatedAsync(IEnumerable columns, CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Custom.Oracle {CoreStrings.S_Not_Implemented_Feature}"); + protected override Task> RawExecuteUpdatedAsync(IEnumerable columns, CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Custom.Oracle {CoreErrorStrings.S_Not_Implemented_Feature}"); #endif } } diff --git a/Providers/FreeSql.Provider.Custom/Oracle/CustomOracleAdo/CustomOracleAdo.cs b/Providers/FreeSql.Provider.Custom/Oracle/CustomOracleAdo/CustomOracleAdo.cs index b58c3f41c..5bfd83d7f 100644 --- a/Providers/FreeSql.Provider.Custom/Oracle/CustomOracleAdo/CustomOracleAdo.cs +++ b/Providers/FreeSql.Provider.Custom/Oracle/CustomOracleAdo/CustomOracleAdo.cs @@ -27,7 +27,7 @@ public CustomOracleAdo(CommonUtils util, string masterConnectionString, string[] UserId = CustomOracleAdo.GetUserId(conn.Value.ConnectionString); return; } - throw new Exception(CoreStrings.S_CustomAdapter_OnlySuppport_UseConnectionFactory); + throw new Exception(CoreErrorStrings.S_CustomAdapter_OnlySuppport_UseConnectionFactory); } internal string UserId { get; set; } diff --git a/Providers/FreeSql.Provider.Custom/Oracle/CustomOracleCodeFirst.cs b/Providers/FreeSql.Provider.Custom/Oracle/CustomOracleCodeFirst.cs index 19a7f8e0b..645062265 100644 --- a/Providers/FreeSql.Provider.Custom/Oracle/CustomOracleCodeFirst.cs +++ b/Providers/FreeSql.Provider.Custom/Oracle/CustomOracleCodeFirst.cs @@ -91,8 +91,8 @@ protected override string GetComparisonDDLStatements(params TypeSchemaAndName[] { if (sb.Length > 0) sb.Append("\r\n"); var tb = obj.tableSchema; - if (tb == null) throw new Exception(CoreStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); - if (tb.Columns.Any() == false) throw new Exception(CoreStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); + if (tb == null) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); + if (tb.Columns.Any() == false) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); var tbname = _commonUtils.SplitTableName(tb.DbName); if (tbname?.Length == 1) tbname = new[] { userId, tbname[0] }; @@ -113,7 +113,7 @@ protected override string GetComparisonDDLStatements(params TypeSchemaAndName[] //codefirst 不支持表名中带 . if (string.Compare(tbname[0], userId) != 0 && _orm.Ado.ExecuteScalar(CommandType.Text, _commonUtils.FormatSql(" select 1 from sys.dba_users where username={0}", tbname[0])) == null) //创建数据库 - throw new NotImplementedException(CoreStrings.S_Oracle_NotSupport_TablespaceSchemas(tbname[0])); + throw new NotImplementedException(CoreErrorStrings.S_Oracle_NotSupport_TablespaceSchemas(tbname[0])); var sbalter = new StringBuilder(); var istmpatler = false; //创建临时表,导入数据,删除旧表,修改 diff --git a/Providers/FreeSql.Provider.Custom/Oracle/CustomOracleDbFirst.cs b/Providers/FreeSql.Provider.Custom/Oracle/CustomOracleDbFirst.cs index e3a9efc66..f7fc68553 100644 --- a/Providers/FreeSql.Provider.Custom/Oracle/CustomOracleDbFirst.cs +++ b/Providers/FreeSql.Provider.Custom/Oracle/CustomOracleDbFirst.cs @@ -112,7 +112,7 @@ DbType GetSqlDbType(DbColumnInfo column) if (dbfull != null) _dicDbToCs.TryAdd(dbfull, _dicDbToCs["nvarchar2(255)"]); return DbType.String; } - throw new NotImplementedException(CoreStrings.S_TypeMappingNotImplemented(column.DbTypeTextFull)); + throw new NotImplementedException(CoreErrorStrings.S_TypeMappingNotImplemented(column.DbTypeTextFull)); } static ConcurrentDictionary _dicDbToCs = new ConcurrentDictionary(StringComparer.CurrentCultureIgnoreCase); diff --git a/Providers/FreeSql.Provider.Custom/Oracle/CustomOracleExpression.cs b/Providers/FreeSql.Provider.Custom/Oracle/CustomOracleExpression.cs index 90821040d..603f8944e 100644 --- a/Providers/FreeSql.Provider.Custom/Oracle/CustomOracleExpression.cs +++ b/Providers/FreeSql.Provider.Custom/Oracle/CustomOracleExpression.cs @@ -254,7 +254,7 @@ public override string ExpressionLambdaToSqlCallString(MethodCallExpression exp, return _common.StringConcat(concatNewArrExp.Expressions.Select(a => getExp(a)).ToArray(), null); return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null); case "Format": - if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); + if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreErrorStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ? (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0); //3个 {} 时,Arguments 解析出来是分开的 diff --git a/Providers/FreeSql.Provider.Custom/PostgreSQL/Curd/CustomPostgreSQLOnConflictDoUpdate.cs b/Providers/FreeSql.Provider.Custom/PostgreSQL/Curd/CustomPostgreSQLOnConflictDoUpdate.cs index c81d5b512..e064982e1 100644 --- a/Providers/FreeSql.Provider.Custom/PostgreSQL/Curd/CustomPostgreSQLOnConflictDoUpdate.cs +++ b/Providers/FreeSql.Provider.Custom/PostgreSQL/Curd/CustomPostgreSQLOnConflictDoUpdate.cs @@ -24,7 +24,7 @@ public class CustomPostgreSQLOnConflictDoUpdate where T1 : class public CustomPostgreSQLOnConflictDoUpdate(IInsert insert, Expression> columns = null) { _pgsqlInsert = insert as CustomPostgreSQLInsert; - if (_pgsqlInsert == null) throw new Exception(CoreStrings.S_Features_Unique("OnConflictDoUpdate", "Custom/PostgreSQL")); + if (_pgsqlInsert == null) throw new Exception(CoreErrorStrings.S_Features_Unique("OnConflictDoUpdate", "Custom/PostgreSQL")); if (_pgsqlInsert._noneParameterFlag == "c") _pgsqlInsert._noneParameterFlag = "cu"; if (columns != null) @@ -38,7 +38,7 @@ public CustomPostgreSQLOnConflictDoUpdate(IInsert insert, Expression 0) sb.Append("\r\n"); var tb = obj.tableSchema; - if (tb == null) throw new Exception(CoreStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); - if (tb.Columns.Any() == false) throw new Exception(CoreStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); + if (tb == null) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); + if (tb.Columns.Any() == false) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); var tbname = _commonUtils.SplitTableName(tb.DbName); if (tbname?.Length == 1) tbname = new[] { "public", tbname[0] }; diff --git a/Providers/FreeSql.Provider.Custom/PostgreSQL/CustomPostgreSQLExpression.cs b/Providers/FreeSql.Provider.Custom/PostgreSQL/CustomPostgreSQLExpression.cs index eac9daef5..5453fbf04 100644 --- a/Providers/FreeSql.Provider.Custom/PostgreSQL/CustomPostgreSQLExpression.cs +++ b/Providers/FreeSql.Provider.Custom/PostgreSQL/CustomPostgreSQLExpression.cs @@ -338,7 +338,7 @@ public override string ExpressionLambdaToSqlCallString(MethodCallExpression exp, return _common.StringConcat(concatNewArrExp.Expressions.Select(a => getExp(a)).ToArray(), null); return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null); case "Format": - if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); + if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreErrorStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ? (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0); //3个 {} 时,Arguments 解析出来是分开的 diff --git a/Providers/FreeSql.Provider.Custom/SqlServer/Curd/CustomSqlServerDelete.cs b/Providers/FreeSql.Provider.Custom/SqlServer/Curd/CustomSqlServerDelete.cs index 939a20ae8..a904ba0f2 100644 --- a/Providers/FreeSql.Provider.Custom/SqlServer/Curd/CustomSqlServerDelete.cs +++ b/Providers/FreeSql.Provider.Custom/SqlServer/Curd/CustomSqlServerDelete.cs @@ -40,7 +40,7 @@ public override List ExecuteDeleted() } var sql = sb.ToString(); var validx = sql.IndexOf(" WHERE "); - if (validx == -1) throw new ArgumentException(CoreStrings.S_NotFound_Name("WHERE")); + if (validx == -1) throw new ArgumentException(CoreErrorStrings.S_NotFound_Name("WHERE")); sql = sb.Clear().Append(sql.Substring(0, validx)) .Append(sbret) .Append(sql.Substring(validx)).ToString(); @@ -97,7 +97,7 @@ await ToSqlFetchAsync(async sb => } var sql = sb.ToString(); var validx = sql.IndexOf(" WHERE "); - if (validx == -1) throw new ArgumentException(CoreStrings.S_NotFound_Name("WHERE")); + if (validx == -1) throw new ArgumentException(CoreErrorStrings.S_NotFound_Name("WHERE")); sql = sb.Clear().Append(sql.Substring(0, validx)) .Append(sbret) .Append(sql.Substring(validx)).ToString(); diff --git a/Providers/FreeSql.Provider.Custom/SqlServer/Curd/CustomSqlServerInsert.cs b/Providers/FreeSql.Provider.Custom/SqlServer/Curd/CustomSqlServerInsert.cs index 65d846896..0ad68699e 100644 --- a/Providers/FreeSql.Provider.Custom/SqlServer/Curd/CustomSqlServerInsert.cs +++ b/Providers/FreeSql.Provider.Custom/SqlServer/Curd/CustomSqlServerInsert.cs @@ -69,14 +69,14 @@ protected override List RawExecuteInserted() if ((_commonUtils as CustomSqlServerUtils).ServerVersion > 10) { var validx = sql.IndexOf(") VALUES"); - if (validx == -1) throw new ArgumentException(CoreStrings.S_NotFound_Name("VALUES")); + if (validx == -1) throw new ArgumentException(CoreErrorStrings.S_NotFound_Name("VALUES")); sb.Insert(0, sql.Substring(0, validx + 1)); sb.Append(sql.Substring(validx + 1)); } else { var validx = sql.IndexOf(") SELECT "); - if (validx == -1) throw new ArgumentException(CoreStrings.S_NotFound_Name("SELECT")); + if (validx == -1) throw new ArgumentException(CoreErrorStrings.S_NotFound_Name("SELECT")); sb.Insert(0, sql.Substring(0, validx + 1)); sb.Append(sql.Substring(validx + 1)); } @@ -153,14 +153,14 @@ async protected override Task> RawExecuteInsertedAsync(CancellationToke if ((_commonUtils as CustomSqlServerUtils).ServerVersion > 10) { var validx = sql.IndexOf(") VALUES"); - if (validx == -1) throw new ArgumentException(CoreStrings.S_NotFound_Name("VALUES")); + if (validx == -1) throw new ArgumentException(CoreErrorStrings.S_NotFound_Name("VALUES")); sb.Insert(0, sql.Substring(0, validx + 1)); sb.Append(sql.Substring(validx + 1)); } else { var validx = sql.IndexOf(") SELECT "); - if (validx == -1) throw new ArgumentException(CoreStrings.S_NotFound_Name("SELECT")); + if (validx == -1) throw new ArgumentException(CoreErrorStrings.S_NotFound_Name("SELECT")); sb.Insert(0, sql.Substring(0, validx + 1)); sb.Append(sql.Substring(validx + 1)); } diff --git a/Providers/FreeSql.Provider.Custom/SqlServer/Curd/CustomSqlServerInsertOrUpdate.cs b/Providers/FreeSql.Provider.Custom/SqlServer/Curd/CustomSqlServerInsertOrUpdate.cs index d862228a9..165a78438 100644 --- a/Providers/FreeSql.Provider.Custom/SqlServer/Curd/CustomSqlServerInsertOrUpdate.cs +++ b/Providers/FreeSql.Provider.Custom/SqlServer/Curd/CustomSqlServerInsertOrUpdate.cs @@ -32,7 +32,7 @@ public override string ToSql() string getMergeSql(List data) { - if (_tempPrimarys.Any() == false) throw new Exception(CoreStrings.InsertOrUpdate_Must_Primary_Key(_table.CsName)); + if (_tempPrimarys.Any() == false) throw new Exception(CoreErrorStrings.InsertOrUpdate_Must_Primary_Key(_table.CsName)); var tempPrimaryIsIdentity = _tempPrimarys.Any(b => b.Attribute.IsIdentity); var sb = new StringBuilder(); diff --git a/Providers/FreeSql.Provider.Custom/SqlServer/Curd/CustomSqlServerUpdate.cs b/Providers/FreeSql.Provider.Custom/SqlServer/Curd/CustomSqlServerUpdate.cs index 3811c04d8..48b50b4de 100644 --- a/Providers/FreeSql.Provider.Custom/SqlServer/Curd/CustomSqlServerUpdate.cs +++ b/Providers/FreeSql.Provider.Custom/SqlServer/Curd/CustomSqlServerUpdate.cs @@ -46,7 +46,7 @@ protected override List RawExecuteUpdated(IEnumerable } var sql = sb.ToString(); var validx = sql.IndexOf(" \r\nWHERE "); - if (validx == -1) throw new ArgumentException(CoreStrings.S_NotFound_Name("WHERE")); + if (validx == -1) throw new ArgumentException(CoreErrorStrings.S_NotFound_Name("WHERE")); sql = sb.Clear().Append(sql.Substring(0, validx)) .Append(sbret) .Append(sql.Substring(validx)).ToString(); diff --git a/Providers/FreeSql.Provider.Custom/SqlServer/CustomSqlServerAdo/CustomSqlServerAdo.cs b/Providers/FreeSql.Provider.Custom/SqlServer/CustomSqlServerAdo/CustomSqlServerAdo.cs index 72129f251..4b4014cef 100644 --- a/Providers/FreeSql.Provider.Custom/SqlServer/CustomSqlServerAdo/CustomSqlServerAdo.cs +++ b/Providers/FreeSql.Provider.Custom/SqlServer/CustomSqlServerAdo/CustomSqlServerAdo.cs @@ -25,7 +25,7 @@ public CustomSqlServerAdo(CommonUtils util, string masterConnectionString, strin MasterPool = pool; return; } - throw new Exception(CoreStrings.S_CustomAdapter_OnlySuppport_UseConnectionFactory); + throw new Exception(CoreErrorStrings.S_CustomAdapter_OnlySuppport_UseConnectionFactory); } string[] ncharDbTypes = new[] { "NVARCHAR", "NCHAR", "NTEXT" }; diff --git a/Providers/FreeSql.Provider.Custom/SqlServer/CustomSqlServerCodeFirst.cs b/Providers/FreeSql.Provider.Custom/SqlServer/CustomSqlServerCodeFirst.cs index 33a6525e6..47d07847b 100644 --- a/Providers/FreeSql.Provider.Custom/SqlServer/CustomSqlServerCodeFirst.cs +++ b/Providers/FreeSql.Provider.Custom/SqlServer/CustomSqlServerCodeFirst.cs @@ -149,8 +149,8 @@ protected override string GetComparisonDDLStatements(params TypeSchemaAndName[] { if (sb.Length > 0) sb.Append("\r\n"); var tb = obj.tableSchema; - if (tb == null) throw new Exception(CoreStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); - if (tb.Columns.Any() == false) throw new Exception(CoreStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); + if (tb == null) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); + if (tb.Columns.Any() == false) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); var tbname = _commonUtils.SplitTableName(tb.DbName); if (tbname?.Length == 1) tbname = new[] { database, "dbo", tbname[0] }; if (tbname?.Length == 2) tbname = new[] { database, tbname[0], tbname[1] }; diff --git a/Providers/FreeSql.Provider.Custom/SqlServer/CustomSqlServerExpression.cs b/Providers/FreeSql.Provider.Custom/SqlServer/CustomSqlServerExpression.cs index c9a37d419..97e829e86 100644 --- a/Providers/FreeSql.Provider.Custom/SqlServer/CustomSqlServerExpression.cs +++ b/Providers/FreeSql.Provider.Custom/SqlServer/CustomSqlServerExpression.cs @@ -260,7 +260,7 @@ public override string ExpressionLambdaToSqlCallString(MethodCallExpression exp, return _common.StringConcat(concatNewArrExp.Expressions.Select(a => getExp(a)).ToArray(), concatNewArrExp.Expressions.Select(a => a.Type).ToArray()); return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), exp.Arguments.Select(a => a.Type).ToArray()); case "Format": - if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); + if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreErrorStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); var expArgs0 = ExpressionLambdaToSql(exp.Arguments[0], tsc); if (exp.Arguments.Count == 1) return expArgs0; var nchar = expArgs0.StartsWith("N'") ? "N" : ""; diff --git a/Providers/FreeSql.Provider.Dameng/Curd/DamengDelete.cs b/Providers/FreeSql.Provider.Dameng/Curd/DamengDelete.cs index f9b81fcaf..562e43758 100644 --- a/Providers/FreeSql.Provider.Dameng/Curd/DamengDelete.cs +++ b/Providers/FreeSql.Provider.Dameng/Curd/DamengDelete.cs @@ -16,11 +16,11 @@ public DamengDelete(IFreeSql orm, CommonUtils commonUtils, CommonExpression comm { } - public override List ExecuteDeleted() => throw new NotImplementedException($"FreeSql.Provider.Dameng {CoreStrings.S_Not_Implemented_Feature}"); + public override List ExecuteDeleted() => throw new NotImplementedException($"FreeSql.Provider.Dameng {CoreErrorStrings.S_Not_Implemented_Feature}"); #if net40 #else - public override Task> ExecuteDeletedAsync(CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Provider.Dameng {CoreStrings.S_Not_Implemented_Feature}"); + public override Task> ExecuteDeletedAsync(CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Provider.Dameng {CoreErrorStrings.S_Not_Implemented_Feature}"); #endif } } diff --git a/Providers/FreeSql.Provider.Dameng/Curd/DamengInsertOrUpdate.cs b/Providers/FreeSql.Provider.Dameng/Curd/DamengInsertOrUpdate.cs index 1436b6fca..1c88bbc47 100644 --- a/Providers/FreeSql.Provider.Dameng/Curd/DamengInsertOrUpdate.cs +++ b/Providers/FreeSql.Provider.Dameng/Curd/DamengInsertOrUpdate.cs @@ -32,7 +32,7 @@ public override string ToSql() string getMergeSql(List data) { - if (_tempPrimarys.Any() == false) throw new Exception(CoreStrings.InsertOrUpdate_Must_Primary_Key(_table.CsName)); + if (_tempPrimarys.Any() == false) throw new Exception(CoreErrorStrings.InsertOrUpdate_Must_Primary_Key(_table.CsName)); var tempPrimaryIsIdentity = _tempPrimarys.Any(b => b.Attribute.IsIdentity); var sb = new StringBuilder().Append("MERGE INTO ").Append(_commonUtils.QuoteSqlName(TableRuleInvoke())).Append(" t1 \r\nUSING ("); diff --git a/Providers/FreeSql.Provider.Dameng/Curd/DamengUpdate.cs b/Providers/FreeSql.Provider.Dameng/Curd/DamengUpdate.cs index 17c0afd0d..a507dfaa8 100644 --- a/Providers/FreeSql.Provider.Dameng/Curd/DamengUpdate.cs +++ b/Providers/FreeSql.Provider.Dameng/Curd/DamengUpdate.cs @@ -21,7 +21,7 @@ public DamengUpdate(IFreeSql orm, CommonUtils commonUtils, CommonExpression comm public override int ExecuteAffrows() => base.SplitExecuteAffrows(_batchRowsLimit > 0 ? _batchRowsLimit : 200, _batchParameterLimit > 0 ? _batchParameterLimit : 999); protected override List ExecuteUpdated(IEnumerable columns) => base.SplitExecuteUpdated(_batchRowsLimit > 0 ? _batchRowsLimit : 200, _batchParameterLimit > 0 ? _batchParameterLimit : 999, columns); - protected override List RawExecuteUpdated(IEnumerable columns) => throw new NotImplementedException($"FreeSql.Provider.Dameng {CoreStrings.S_Not_Implemented_Feature}"); + protected override List RawExecuteUpdated(IEnumerable columns) => throw new NotImplementedException($"FreeSql.Provider.Dameng {CoreErrorStrings.S_Not_Implemented_Feature}"); protected override void ToSqlCase(StringBuilder caseWhen, ColumnInfo[] primarys) { @@ -65,7 +65,7 @@ protected override void ToSqlWhen(StringBuilder sb, ColumnInfo[] primarys, objec public override Task ExecuteAffrowsAsync(CancellationToken cancellationToken = default) => base.SplitExecuteAffrowsAsync(_batchRowsLimit > 0 ? _batchRowsLimit : 200, _batchParameterLimit > 0 ? _batchParameterLimit : 999, cancellationToken); protected override Task> ExecuteUpdatedAsync(IEnumerable columns, CancellationToken cancellationToken = default) => base.SplitExecuteUpdatedAsync(_batchRowsLimit > 0 ? _batchRowsLimit : 200, _batchParameterLimit > 0 ? _batchParameterLimit : 999, columns, cancellationToken); - protected override Task> RawExecuteUpdatedAsync(IEnumerable columns, CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Provider.Dameng {CoreStrings.S_Not_Implemented_Feature}"); + protected override Task> RawExecuteUpdatedAsync(IEnumerable columns, CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Provider.Dameng {CoreErrorStrings.S_Not_Implemented_Feature}"); #endif } } diff --git a/Providers/FreeSql.Provider.Dameng/DamengAdo/DamengAdo.cs b/Providers/FreeSql.Provider.Dameng/DamengAdo/DamengAdo.cs index 9497451fe..182c9246f 100644 --- a/Providers/FreeSql.Provider.Dameng/DamengAdo/DamengAdo.cs +++ b/Providers/FreeSql.Provider.Dameng/DamengAdo/DamengAdo.cs @@ -29,14 +29,14 @@ public DamengAdo(CommonUtils util, string masterConnectionString, string[] slave if (isAdoPool) masterConnectionString = masterConnectionString.Substring("AdoConnectionPool,".Length); if (!string.IsNullOrEmpty(masterConnectionString)) MasterPool = isAdoPool ? - new DbConnectionStringPool(base.DataType, CoreStrings.S_MasterDatabase, () => new DmConnection(masterConnectionString)) as IObjectPool : - new DamengConnectionPool(CoreStrings.S_MasterDatabase, masterConnectionString, null, null); + new DbConnectionStringPool(base.DataType, CoreErrorStrings.S_MasterDatabase, () => new DmConnection(masterConnectionString)) as IObjectPool : + new DamengConnectionPool(CoreErrorStrings.S_MasterDatabase, masterConnectionString, null, null); slaveConnectionStrings?.ToList().ForEach(slaveConnectionString => { var slavePool = isAdoPool ? - new DbConnectionStringPool(base.DataType, $"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => new DmConnection(slaveConnectionString)) as IObjectPool : - new DamengConnectionPool($"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables)); + new DbConnectionStringPool(base.DataType, $"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => new DmConnection(slaveConnectionString)) as IObjectPool : + new DamengConnectionPool($"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables)); SlavePools.Add(slavePool); }); } diff --git a/Providers/FreeSql.Provider.Dameng/DamengAdo/DamengConnectionPool.cs b/Providers/FreeSql.Provider.Dameng/DamengAdo/DamengConnectionPool.cs index 11a515317..07c8b7389 100644 --- a/Providers/FreeSql.Provider.Dameng/DamengAdo/DamengConnectionPool.cs +++ b/Providers/FreeSql.Provider.Dameng/DamengAdo/DamengConnectionPool.cs @@ -54,7 +54,7 @@ class DamengConnectionPoolPolicy : IPolicy { internal DamengConnectionPool _pool; - public string Name { get; set; } = $"Dameng DmConnection {CoreStrings.S_ObjectPool}"; + public string Name { get; set; } = $"Dameng DmConnection {CoreErrorStrings.S_ObjectPool}"; public int PoolSize { get; set; } = 100; public TimeSpan SyncGetTimeout { get; set; } = TimeSpan.FromSeconds(10); public TimeSpan IdleTimeout { get; set; } = TimeSpan.FromSeconds(20); @@ -130,8 +130,8 @@ public void OnGet(Object obj) { if (obj.Value == null) { - _pool.SetUnavailable(new Exception(CoreStrings.S_ConnectionStringError), obj.LastGetTimeCopy); - throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name)); + _pool.SetUnavailable(new Exception(CoreErrorStrings.S_ConnectionStringError), obj.LastGetTimeCopy); + throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name)); } if (obj.Value.State != ConnectionState.Open || DateTime.Now.Subtract(obj.LastReturnTime).TotalSeconds > 60 && obj.Value.Ping() == false) @@ -160,8 +160,8 @@ async public Task OnGetAsync(Object obj) { if (obj.Value == null) { - _pool.SetUnavailable(new Exception(CoreStrings.S_ConnectionStringError), obj.LastGetTimeCopy); - throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name)); + _pool.SetUnavailable(new Exception(CoreErrorStrings.S_ConnectionStringError), obj.LastGetTimeCopy); + throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name)); } if (obj.Value.State != ConnectionState.Open || DateTime.Now.Subtract(obj.LastReturnTime).TotalSeconds > 60 && (await obj.Value.PingAsync()) == false) diff --git a/Providers/FreeSql.Provider.Dameng/DamengCodeFirst.cs b/Providers/FreeSql.Provider.Dameng/DamengCodeFirst.cs index 73a29ee57..664ddb376 100644 --- a/Providers/FreeSql.Provider.Dameng/DamengCodeFirst.cs +++ b/Providers/FreeSql.Provider.Dameng/DamengCodeFirst.cs @@ -92,8 +92,8 @@ protected override string GetComparisonDDLStatements(params TypeSchemaAndName[] { if (sb.Length > 0) sb.Append("\r\n"); var tb = obj.tableSchema; - if (tb == null) throw new Exception(CoreStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); - if (tb.Columns.Any() == false) throw new Exception(CoreStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); + if (tb == null) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); + if (tb.Columns.Any() == false) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); var tbname = _commonUtils.SplitTableName(tb.DbName); if (tbname?.Length == 1) tbname = new[] { userId, tbname[0] }; @@ -114,7 +114,7 @@ protected override string GetComparisonDDLStatements(params TypeSchemaAndName[] //codefirst 不支持表名中带 . if (string.Compare(tbname[0], userId) != 0 && _orm.Ado.ExecuteScalar(CommandType.Text, _commonUtils.FormatSql(" select 1 from sys.dba_users where username={0}", tbname[0])) == null) //创建数据库 - throw new NotImplementedException(CoreStrings.S_Dameng_NotSupport_TablespaceSchemas(tbname[0])); + throw new NotImplementedException(CoreErrorStrings.S_Dameng_NotSupport_TablespaceSchemas(tbname[0])); var sbalter = new StringBuilder(); var istmpatler = false; //创建临时表,导入数据,删除旧表,修改 diff --git a/Providers/FreeSql.Provider.Dameng/DamengDbFirst.cs b/Providers/FreeSql.Provider.Dameng/DamengDbFirst.cs index d48d4219e..74e777e9c 100644 --- a/Providers/FreeSql.Provider.Dameng/DamengDbFirst.cs +++ b/Providers/FreeSql.Provider.Dameng/DamengDbFirst.cs @@ -165,7 +165,7 @@ DmDbType GetSqlDbType(DbColumnInfo column) if (dbfull != null) _dicDbToCs.TryAdd(dbfull, _dicDbToCs["nvarchar2(255)"]); return DmDbType.VarChar; } - throw new NotImplementedException(CoreStrings.S_TypeMappingNotImplemented(column.DbTypeTextFull)); + throw new NotImplementedException(CoreErrorStrings.S_TypeMappingNotImplemented(column.DbTypeTextFull)); } static ConcurrentDictionary _dicDbToCs = new ConcurrentDictionary(StringComparer.CurrentCultureIgnoreCase); diff --git a/Providers/FreeSql.Provider.Dameng/DamengExpression.cs b/Providers/FreeSql.Provider.Dameng/DamengExpression.cs index 8e2dbf577..f4b6c444b 100644 --- a/Providers/FreeSql.Provider.Dameng/DamengExpression.cs +++ b/Providers/FreeSql.Provider.Dameng/DamengExpression.cs @@ -254,7 +254,7 @@ public override string ExpressionLambdaToSqlCallString(MethodCallExpression exp, return _common.StringConcat(concatNewArrExp.Expressions.Select(a => getExp(a)).ToArray(), null); return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null); case "Format": - if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); + if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreErrorStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ? (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0); //3个 {} 时,Arguments 解析出来是分开的 diff --git a/Providers/FreeSql.Provider.Dameng/DamengExtensions.cs b/Providers/FreeSql.Provider.Dameng/DamengExtensions.cs index ebaa869db..62153bc82 100644 --- a/Providers/FreeSql.Provider.Dameng/DamengExtensions.cs +++ b/Providers/FreeSql.Provider.Dameng/DamengExtensions.cs @@ -133,7 +133,7 @@ static NativeTuple ExecuteDmBulkCopySt public static void ExecuteDmBulkCopy(this IInsert that, DmBulkCopyOptions copyOptions = DmBulkCopyOptions.Default, int? batchSize = null, int? bulkCopyTimeout = null) where T : class { var insert = that as FreeSql.Dameng.Curd.DamengInsert; - if (insert == null) throw new Exception(CoreStrings.S_Features_Unique("ExecuteDmBulkCopy", "Dameng")); + if (insert == null) throw new Exception(CoreErrorStrings.S_Features_Unique("ExecuteDmBulkCopy", "Dameng")); var dt = that.ToDataTable(); if (dt.Rows.Count == 0) return; @@ -199,7 +199,7 @@ public static void ExecuteDmBulkCopy(this IInsert that, DmBulkCopyOptions } else { - throw new NotImplementedException($"ExecuteDmBulkCopy {CoreStrings.S_Not_Implemented_FeedBack}"); + throw new NotImplementedException($"ExecuteDmBulkCopy {CoreErrorStrings.S_Not_Implemented_FeedBack}"); } } finally diff --git a/Providers/FreeSql.Provider.Duckdb/Curd/DuckdbDelete.cs b/Providers/FreeSql.Provider.Duckdb/Curd/DuckdbDelete.cs index 851d58a3b..03a46b3bf 100644 --- a/Providers/FreeSql.Provider.Duckdb/Curd/DuckdbDelete.cs +++ b/Providers/FreeSql.Provider.Duckdb/Curd/DuckdbDelete.cs @@ -16,11 +16,11 @@ public DuckdbDelete(IFreeSql orm, CommonUtils commonUtils, CommonExpression comm { } - public override List ExecuteDeleted() => throw new NotImplementedException($"FreeSql.Provider.Duckdb {CoreStrings.S_Not_Implemented_Feature}"); + public override List ExecuteDeleted() => throw new NotImplementedException($"FreeSql.Provider.Duckdb {CoreErrorStrings.S_Not_Implemented_Feature}"); #if net40 #else - public override Task> ExecuteDeletedAsync(CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Provider.Duckdb {CoreStrings.S_Not_Implemented_Feature}"); + public override Task> ExecuteDeletedAsync(CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Provider.Duckdb {CoreErrorStrings.S_Not_Implemented_Feature}"); #endif } } diff --git a/Providers/FreeSql.Provider.Duckdb/Curd/DuckdbUpdate.cs b/Providers/FreeSql.Provider.Duckdb/Curd/DuckdbUpdate.cs index 4451f8e4e..5426fe631 100644 --- a/Providers/FreeSql.Provider.Duckdb/Curd/DuckdbUpdate.cs +++ b/Providers/FreeSql.Provider.Duckdb/Curd/DuckdbUpdate.cs @@ -30,7 +30,7 @@ public DuckdbUpdate(IFreeSql orm, CommonUtils commonUtils, CommonExpression comm public override int ExecuteAffrows() => base.SplitExecuteAffrows(_batchRowsLimit > 0 ? _batchRowsLimit : 500, _batchParameterLimit > 0 ? _batchParameterLimit : 3000); protected override List ExecuteUpdated(IEnumerable columns) => base.SplitExecuteUpdated(_batchRowsLimit > 0 ? _batchRowsLimit : 500, _batchParameterLimit > 0 ? _batchParameterLimit : 3000, columns); - protected override List RawExecuteUpdated(IEnumerable columns) => throw new NotImplementedException($"FreeSql.Provider.Duckdb {CoreStrings.S_Not_Implemented_Feature}"); + protected override List RawExecuteUpdated(IEnumerable columns) => throw new NotImplementedException($"FreeSql.Provider.Duckdb {CoreErrorStrings.S_Not_Implemented_Feature}"); protected override void ToSqlCase(StringBuilder caseWhen, ColumnInfo[] primarys) { @@ -89,7 +89,7 @@ protected override void ToSqlCaseWhenEnd(StringBuilder sb, ColumnInfo col) #else public override Task ExecuteAffrowsAsync(CancellationToken cancellationToken = default) => base.SplitExecuteAffrowsAsync(_batchRowsLimit > 0 ? _batchRowsLimit : 500, _batchParameterLimit > 0 ? _batchParameterLimit : 3000, cancellationToken); protected override Task> ExecuteUpdatedAsync(IEnumerable columns, CancellationToken cancellationToken = default) => base.SplitExecuteUpdatedAsync(_batchRowsLimit > 0 ? _batchRowsLimit : 500, _batchParameterLimit > 0 ? _batchParameterLimit : 3000, columns, cancellationToken); - protected override Task> RawExecuteUpdatedAsync(IEnumerable columns, CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Provider.Duckdb {CoreStrings.S_Not_Implemented_Feature}"); + protected override Task> RawExecuteUpdatedAsync(IEnumerable columns, CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Provider.Duckdb {CoreErrorStrings.S_Not_Implemented_Feature}"); #endif } diff --git a/Providers/FreeSql.Provider.Duckdb/Curd/OnConflictDoUpdate.cs b/Providers/FreeSql.Provider.Duckdb/Curd/OnConflictDoUpdate.cs index 4df112d90..451d9ea36 100644 --- a/Providers/FreeSql.Provider.Duckdb/Curd/OnConflictDoUpdate.cs +++ b/Providers/FreeSql.Provider.Duckdb/Curd/OnConflictDoUpdate.cs @@ -24,7 +24,7 @@ public class OnConflictDoUpdate where T1 : class public OnConflictDoUpdate(IInsert insert, Expression> columns = null) { _duckdbInsert = insert as DuckdbInsert; - if (_duckdbInsert == null) throw new Exception(CoreStrings.S_Features_Unique("OnConflictDoUpdate", "Duckdb")); + if (_duckdbInsert == null) throw new Exception(CoreErrorStrings.S_Features_Unique("OnConflictDoUpdate", "Duckdb")); if (_duckdbInsert._noneParameterFlag == "c") _duckdbInsert._noneParameterFlag = "cu"; if (columns != null) @@ -38,7 +38,7 @@ public OnConflictDoUpdate(IInsert insert, Expression> colum } if (_tempPrimarys == null || _tempPrimarys.Any() == false) _tempPrimarys = _duckdbInsert.InternalTable.Primarys; - if (_tempPrimarys.Any() == false) throw new Exception(CoreStrings.S_OnConflictDoUpdate_MustIsPrimary); + if (_tempPrimarys.Any() == false) throw new Exception(CoreErrorStrings.S_OnConflictDoUpdate_MustIsPrimary); } protected void ClearData() diff --git a/Providers/FreeSql.Provider.Duckdb/DuckdbAdo/DuckdbAdo.cs b/Providers/FreeSql.Provider.Duckdb/DuckdbAdo/DuckdbAdo.cs index 5bb64a5ae..ae55f5817 100644 --- a/Providers/FreeSql.Provider.Duckdb/DuckdbAdo/DuckdbAdo.cs +++ b/Providers/FreeSql.Provider.Duckdb/DuckdbAdo/DuckdbAdo.cs @@ -32,14 +32,14 @@ public DuckdbAdo(CommonUtils util, string masterConnectionString, string[] slave if (isAdoPool) masterConnectionString = masterConnectionString.Substring("AdoConnectionPool,".Length); if (!string.IsNullOrEmpty(masterConnectionString)) MasterPool = isAdoPool ? - new DbConnectionStringPool(base.DataType, CoreStrings.S_MasterDatabase, () => DuckdbConnectionPool.CreateConnection(masterConnectionString)) as IObjectPool : - new DuckdbConnectionPool(CoreStrings.S_MasterDatabase, masterConnectionString, null, null); + new DbConnectionStringPool(base.DataType, CoreErrorStrings.S_MasterDatabase, () => DuckdbConnectionPool.CreateConnection(masterConnectionString)) as IObjectPool : + new DuckdbConnectionPool(CoreErrorStrings.S_MasterDatabase, masterConnectionString, null, null); slaveConnectionStrings?.ToList().ForEach(slaveConnectionString => { var slavePool = isAdoPool ? - new DbConnectionStringPool(base.DataType, $"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => DuckdbConnectionPool.CreateConnection(slaveConnectionString)) as IObjectPool : - new DuckdbConnectionPool($"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables)); + new DbConnectionStringPool(base.DataType, $"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => DuckdbConnectionPool.CreateConnection(slaveConnectionString)) as IObjectPool : + new DuckdbConnectionPool($"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables)); SlavePools.Add(slavePool); }); } diff --git a/Providers/FreeSql.Provider.Duckdb/DuckdbAdo/DuckdbConnectionPool.cs b/Providers/FreeSql.Provider.Duckdb/DuckdbAdo/DuckdbConnectionPool.cs index fd76a13dc..040474d77 100644 --- a/Providers/FreeSql.Provider.Duckdb/DuckdbAdo/DuckdbConnectionPool.cs +++ b/Providers/FreeSql.Provider.Duckdb/DuckdbAdo/DuckdbConnectionPool.cs @@ -48,7 +48,7 @@ class DuckdbConnectionPoolPolicy : IPolicy { internal DuckdbConnectionPool _pool; - public string Name { get; set; } = $"Duckdb DuckDBConnection {CoreStrings.S_ObjectPool}"; + public string Name { get; set; } = $"Duckdb DuckDBConnection {CoreErrorStrings.S_ObjectPool}"; public int PoolSize { get; set; } = 1; public TimeSpan SyncGetTimeout { get; set; } = TimeSpan.FromSeconds(10); public TimeSpan IdleTimeout { get; set; } = TimeSpan.Zero; @@ -117,7 +117,7 @@ public void OnGet(Object obj) if (_pool.IsAvailable) { if (obj.Value == null) - throw new Exception(CoreStrings.S_ConnectionStringError_CheckProjectConnection(this.Name)); + throw new Exception(CoreErrorStrings.S_ConnectionStringError_CheckProjectConnection(this.Name)); if (obj.Value.State != ConnectionState.Open) obj.Value.OpenAndAttach(Attaches); @@ -132,7 +132,7 @@ async public Task OnGetAsync(Object obj) if (_pool.IsAvailable) { if (obj.Value == null) - throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name)); + throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name)); if (obj.Value.State != ConnectionState.Open) await obj.Value.OpenAndAttachAsync(Attaches); diff --git a/Providers/FreeSql.Provider.Duckdb/DuckdbCodeFirst.cs b/Providers/FreeSql.Provider.Duckdb/DuckdbCodeFirst.cs index 597b26fa3..54176e6a9 100644 --- a/Providers/FreeSql.Provider.Duckdb/DuckdbCodeFirst.cs +++ b/Providers/FreeSql.Provider.Duckdb/DuckdbCodeFirst.cs @@ -120,8 +120,8 @@ protected override string GetComparisonDDLStatements(params TypeSchemaAndName[] { if (sb.Length > 0) sb.Append("\r\n"); var tb = obj.tableSchema; - if (tb == null) throw new Exception(CoreStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); - if (tb.Columns.Any() == false) throw new Exception(CoreStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); + if (tb == null) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); + if (tb.Columns.Any() == false) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); var tbname = _commonUtils.SplitTableName(tb.DbName); if (tbname?.Length == 1) tbname = new[] { "main", tbname[0] }; diff --git a/Providers/FreeSql.Provider.Duckdb/DuckdbExpression.cs b/Providers/FreeSql.Provider.Duckdb/DuckdbExpression.cs index 29b978781..07a8bc34c 100644 --- a/Providers/FreeSql.Provider.Duckdb/DuckdbExpression.cs +++ b/Providers/FreeSql.Provider.Duckdb/DuckdbExpression.cs @@ -314,7 +314,7 @@ public override string ExpressionLambdaToSqlCallString(MethodCallExpression exp, return _common.StringConcat(concatNewArrExp.Expressions.Select(a => getExp(a)).ToArray(), null); return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null); case "Format": - if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp, exp.Arguments[0])); + if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreErrorStrings.Not_Implemented_Expression_ParameterUseConstant(exp, exp.Arguments[0])); var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ? (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0); //3个 {} 时,Arguments 解析出来是分开的 diff --git a/Providers/FreeSql.Provider.Firebird/Curd/FirebirdInsertOrUpdate.cs b/Providers/FreeSql.Provider.Firebird/Curd/FirebirdInsertOrUpdate.cs index c2ffe8145..b2169067c 100644 --- a/Providers/FreeSql.Provider.Firebird/Curd/FirebirdInsertOrUpdate.cs +++ b/Providers/FreeSql.Provider.Firebird/Curd/FirebirdInsertOrUpdate.cs @@ -32,7 +32,7 @@ public override string ToSql() string getMergeSql(List data) { - if (_tempPrimarys.Any() == false) throw new Exception(CoreStrings.InsertOrUpdate_Must_Primary_Key(_table.CsName)); + if (_tempPrimarys.Any() == false) throw new Exception(CoreErrorStrings.InsertOrUpdate_Must_Primary_Key(_table.CsName)); var tempPrimaryIsIdentity = _tempPrimarys.Any(b => b.Attribute.IsIdentity); var sb = new StringBuilder().Append("MERGE INTO ").Append(_commonUtils.QuoteSqlName(TableRuleInvoke())).Append(" t1 \r\nUSING ("); diff --git a/Providers/FreeSql.Provider.Firebird/FirebirdAdo/FirebirdAdo.cs b/Providers/FreeSql.Provider.Firebird/FirebirdAdo/FirebirdAdo.cs index b1e889f03..8e0f68be8 100644 --- a/Providers/FreeSql.Provider.Firebird/FirebirdAdo/FirebirdAdo.cs +++ b/Providers/FreeSql.Provider.Firebird/FirebirdAdo/FirebirdAdo.cs @@ -31,14 +31,14 @@ public FirebirdAdo(CommonUtils util, string masterConnectionString, string[] sla if (isAdoPool) masterConnectionString = masterConnectionString.Substring("AdoConnectionPool,".Length); if (!string.IsNullOrEmpty(masterConnectionString)) MasterPool = isAdoPool ? - new DbConnectionStringPool(base.DataType, CoreStrings.S_MasterDatabase, () => new FbConnection(masterConnectionString)) as IObjectPool : - new FirebirdConnectionPool(CoreStrings.S_MasterDatabase, masterConnectionString, null, null); + new DbConnectionStringPool(base.DataType, CoreErrorStrings.S_MasterDatabase, () => new FbConnection(masterConnectionString)) as IObjectPool : + new FirebirdConnectionPool(CoreErrorStrings.S_MasterDatabase, masterConnectionString, null, null); slaveConnectionStrings?.ToList().ForEach(slaveConnectionString => { var slavePool = isAdoPool ? - new DbConnectionStringPool(base.DataType, $"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => new FbConnection(slaveConnectionString)) as IObjectPool : - new FirebirdConnectionPool($"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables)); + new DbConnectionStringPool(base.DataType, $"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => new FbConnection(slaveConnectionString)) as IObjectPool : + new FirebirdConnectionPool($"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables)); SlavePools.Add(slavePool); }); } diff --git a/Providers/FreeSql.Provider.Firebird/FirebirdAdo/FirebirdConnectionPool.cs b/Providers/FreeSql.Provider.Firebird/FirebirdAdo/FirebirdConnectionPool.cs index c674a45e1..8be15c361 100644 --- a/Providers/FreeSql.Provider.Firebird/FirebirdAdo/FirebirdConnectionPool.cs +++ b/Providers/FreeSql.Provider.Firebird/FirebirdAdo/FirebirdConnectionPool.cs @@ -40,7 +40,7 @@ class FirebirdConnectionPoolPolicy : IPolicy { internal FirebirdConnectionPool _pool; - public string Name { get; set; } = $"Firebird FbConnection {CoreStrings.S_ObjectPool}"; + public string Name { get; set; } = $"Firebird FbConnection {CoreErrorStrings.S_ObjectPool}"; public int PoolSize { get; set; } = 100; public TimeSpan SyncGetTimeout { get; set; } = TimeSpan.FromSeconds(10); public TimeSpan IdleTimeout { get; set; } = TimeSpan.FromSeconds(20); @@ -115,7 +115,7 @@ public void OnGet(Object obj) if (_pool.IsAvailable) { if (obj.Value == null) - throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name)); + throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name)); if (obj.Value.State != ConnectionState.Open) obj.Value.Open(); @@ -130,7 +130,7 @@ async public Task OnGetAsync(Object obj) if (_pool.IsAvailable) { if (obj.Value == null) - throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name)); + throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name)); if (obj.Value.State != ConnectionState.Open) await obj.Value.OpenAsync(); diff --git a/Providers/FreeSql.Provider.Firebird/FirebirdCodeFirst.cs b/Providers/FreeSql.Provider.Firebird/FirebirdCodeFirst.cs index 0a2d624a6..9994cc0cd 100644 --- a/Providers/FreeSql.Provider.Firebird/FirebirdCodeFirst.cs +++ b/Providers/FreeSql.Provider.Firebird/FirebirdCodeFirst.cs @@ -89,8 +89,8 @@ protected override string GetComparisonDDLStatements(params TypeSchemaAndName[] { if (sb.Length > 0) sb.Append("\r\n"); var tb = obj.tableSchema; - if (tb == null) throw new Exception(CoreStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); - if (tb.Columns.Any() == false) throw new Exception(CoreStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); + if (tb == null) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); + if (tb.Columns.Any() == false) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); var tbname = tb.DbName; var tboldname = tb.DbOldName; //旧表名 if (string.IsNullOrEmpty(obj.tableName) == false) diff --git a/Providers/FreeSql.Provider.Firebird/FirebirdExpression.cs b/Providers/FreeSql.Provider.Firebird/FirebirdExpression.cs index 59a4f1780..17a86f775 100644 --- a/Providers/FreeSql.Provider.Firebird/FirebirdExpression.cs +++ b/Providers/FreeSql.Provider.Firebird/FirebirdExpression.cs @@ -241,7 +241,7 @@ public override string ExpressionLambdaToSqlCallString(MethodCallExpression exp, return _common.StringConcat(concatNewArrExp.Expressions.Select(a => getExp(a)).ToArray(), null); return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null); case "Format": - if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); + if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreErrorStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ? (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0); //3个 {} 时,Arguments 解析出来是分开的 diff --git a/Providers/FreeSql.Provider.GBase/Curd/GBaseDelete.cs b/Providers/FreeSql.Provider.GBase/Curd/GBaseDelete.cs index d47b3e2b5..3040ff3c4 100644 --- a/Providers/FreeSql.Provider.GBase/Curd/GBaseDelete.cs +++ b/Providers/FreeSql.Provider.GBase/Curd/GBaseDelete.cs @@ -16,11 +16,11 @@ public GBaseDelete(IFreeSql orm, CommonUtils commonUtils, CommonExpression commo { } - public override List ExecuteDeleted() => throw new NotImplementedException($"FreeSql.Provider.GBase {CoreStrings.S_Not_Implemented_Feature}"); + public override List ExecuteDeleted() => throw new NotImplementedException($"FreeSql.Provider.GBase {CoreErrorStrings.S_Not_Implemented_Feature}"); #if net40 #else - public override Task> ExecuteDeletedAsync(CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Provider.GBase {CoreStrings.S_Not_Implemented_Feature}"); + public override Task> ExecuteDeletedAsync(CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Provider.GBase {CoreErrorStrings.S_Not_Implemented_Feature}"); #endif } } diff --git a/Providers/FreeSql.Provider.GBase/Curd/GBaseInsert.cs b/Providers/FreeSql.Provider.GBase/Curd/GBaseInsert.cs index d0b130f7d..880474745 100644 --- a/Providers/FreeSql.Provider.GBase/Curd/GBaseInsert.cs +++ b/Providers/FreeSql.Provider.GBase/Curd/GBaseInsert.cs @@ -28,7 +28,7 @@ public override string ToSql() if (_source?.Count <= 1) return base.ToSqlValuesOrSelectUnionAll(); var sql = base.ToSqlValuesOrSelectUnionAllExtension102(false, null, (rowd, idx, sb) => sb.Append(" FROM dual")); var validx = sql.IndexOf(") SELECT "); - if (validx == -1) throw new ArgumentException(CoreStrings.S_NotFound_Name("SELECT")); + if (validx == -1) throw new ArgumentException(CoreErrorStrings.S_NotFound_Name("SELECT")); return new StringBuilder() .Insert(0, sql.Substring(0, validx + 1)) .Append("\r\nSELECT * FROM (\r\n") diff --git a/Providers/FreeSql.Provider.GBase/Curd/GBaseInsertOrUpdate.cs b/Providers/FreeSql.Provider.GBase/Curd/GBaseInsertOrUpdate.cs index 66719f42d..ec3ddfe1a 100644 --- a/Providers/FreeSql.Provider.GBase/Curd/GBaseInsertOrUpdate.cs +++ b/Providers/FreeSql.Provider.GBase/Curd/GBaseInsertOrUpdate.cs @@ -32,7 +32,7 @@ public override string ToSql() string getMergeSql(List data) { - if (_tempPrimarys.Any() == false) throw new Exception(CoreStrings.InsertOrUpdate_Must_Primary_Key(_table.CsName)); + if (_tempPrimarys.Any() == false) throw new Exception(CoreErrorStrings.InsertOrUpdate_Must_Primary_Key(_table.CsName)); var tempPrimaryIsIdentity = _tempPrimarys.Any(b => b.Attribute.IsIdentity); var sb = new StringBuilder().Append("MERGE INTO ").Append(_commonUtils.QuoteSqlName(TableRuleInvoke())).Append(" t1 \r\nUSING ("); diff --git a/Providers/FreeSql.Provider.GBase/Curd/GBaseUpdate.cs b/Providers/FreeSql.Provider.GBase/Curd/GBaseUpdate.cs index 4ec6d1dec..dcda0853d 100644 --- a/Providers/FreeSql.Provider.GBase/Curd/GBaseUpdate.cs +++ b/Providers/FreeSql.Provider.GBase/Curd/GBaseUpdate.cs @@ -22,7 +22,7 @@ public GBaseUpdate(IFreeSql orm, CommonUtils commonUtils, CommonExpression commo public override int ExecuteAffrows() => base.SplitExecuteAffrows(_batchRowsLimit > 0 ? _batchRowsLimit : 200, _batchParameterLimit > 0 ? _batchParameterLimit : 999); protected override List ExecuteUpdated(IEnumerable columns) => base.SplitExecuteUpdated(_batchRowsLimit > 0 ? _batchRowsLimit : 200, _batchParameterLimit > 0 ? _batchParameterLimit : 999, columns); - protected override List RawExecuteUpdated(IEnumerable columns) => throw new NotImplementedException($"FreeSql.Provider.GBase {CoreStrings.S_Not_Implemented_Feature}"); + protected override List RawExecuteUpdated(IEnumerable columns) => throw new NotImplementedException($"FreeSql.Provider.GBase {CoreErrorStrings.S_Not_Implemented_Feature}"); protected override void ToSqlCase(StringBuilder caseWhen, ColumnInfo[] primarys) { @@ -66,7 +66,7 @@ protected override void ToSqlWhen(StringBuilder sb, ColumnInfo[] primarys, objec public override Task ExecuteAffrowsAsync(CancellationToken cancellationToken = default) => base.SplitExecuteAffrowsAsync(_batchRowsLimit > 0 ? _batchRowsLimit : 200, _batchParameterLimit > 0 ? _batchParameterLimit : 999, cancellationToken); protected override Task> ExecuteUpdatedAsync(IEnumerable columns, CancellationToken cancellationToken = default) => base.SplitExecuteUpdatedAsync(_batchRowsLimit > 0 ? _batchRowsLimit : 200, _batchParameterLimit > 0 ? _batchParameterLimit : 999, columns, cancellationToken); - protected override Task> RawExecuteUpdatedAsync(IEnumerable columns, CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Provider.GBase {CoreStrings.S_Not_Implemented_Feature}"); + protected override Task> RawExecuteUpdatedAsync(IEnumerable columns, CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Provider.GBase {CoreErrorStrings.S_Not_Implemented_Feature}"); #endif } } diff --git a/Providers/FreeSql.Provider.GBase/GBaseAdo/GBaseAdo.cs b/Providers/FreeSql.Provider.GBase/GBaseAdo/GBaseAdo.cs index adbb21985..9baac766c 100644 --- a/Providers/FreeSql.Provider.GBase/GBaseAdo/GBaseAdo.cs +++ b/Providers/FreeSql.Provider.GBase/GBaseAdo/GBaseAdo.cs @@ -31,14 +31,14 @@ public GBaseAdo(CommonUtils util, string masterConnectionString, string[] slaveC if (isAdoPool) masterConnectionString = masterConnectionString.Substring("AdoConnectionPool,".Length); if (!string.IsNullOrEmpty(masterConnectionString)) MasterPool = isAdoPool ? - new DbConnectionStringPool(base.DataType, CoreStrings.S_MasterDatabase, () => new OdbcConnection(masterConnectionString)) as IObjectPool : - new GBaseConnectionPool(CoreStrings.S_MasterDatabase, masterConnectionString, null, null); + new DbConnectionStringPool(base.DataType, CoreErrorStrings.S_MasterDatabase, () => new OdbcConnection(masterConnectionString)) as IObjectPool : + new GBaseConnectionPool(CoreErrorStrings.S_MasterDatabase, masterConnectionString, null, null); slaveConnectionStrings?.ToList().ForEach(slaveConnectionString => { var slavePool = isAdoPool ? - new DbConnectionStringPool(base.DataType, $"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => new OdbcConnection(slaveConnectionString)) as IObjectPool : - new GBaseConnectionPool($"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables)); + new DbConnectionStringPool(base.DataType, $"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => new OdbcConnection(slaveConnectionString)) as IObjectPool : + new GBaseConnectionPool($"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables)); SlavePools.Add(slavePool); }); } diff --git a/Providers/FreeSql.Provider.GBase/GBaseAdo/GBaseConnectionPool.cs b/Providers/FreeSql.Provider.GBase/GBaseAdo/GBaseConnectionPool.cs index 266eaa266..79ca7e75a 100644 --- a/Providers/FreeSql.Provider.GBase/GBaseAdo/GBaseConnectionPool.cs +++ b/Providers/FreeSql.Provider.GBase/GBaseAdo/GBaseConnectionPool.cs @@ -45,7 +45,7 @@ class GBaseConnectionPoolPolicy : IPolicy { internal GBaseConnectionPool _pool; - public string Name { get; set; } = $"GBase IfxConnection {CoreStrings.S_ObjectPool}"; + public string Name { get; set; } = $"GBase IfxConnection {CoreErrorStrings.S_ObjectPool}"; public int PoolSize { get; set; } = 100; public TimeSpan SyncGetTimeout { get; set; } = TimeSpan.FromSeconds(10); public TimeSpan IdleTimeout { get; set; } = TimeSpan.FromSeconds(20); @@ -120,8 +120,8 @@ public void OnGet(Object obj) { if (obj.Value == null) { - _pool.SetUnavailable(new Exception(CoreStrings.S_ConnectionStringError), obj.LastGetTimeCopy); - throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name)); + _pool.SetUnavailable(new Exception(CoreErrorStrings.S_ConnectionStringError), obj.LastGetTimeCopy); + throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name)); } if (obj.Value.State != ConnectionState.Open || DateTime.Now.Subtract(obj.LastReturnTime).TotalSeconds > 60 && obj.Value.Ping() == false) @@ -150,8 +150,8 @@ async public Task OnGetAsync(Object obj) { if (obj.Value == null) { - _pool.SetUnavailable(new Exception(CoreStrings.S_ConnectionStringError), obj.LastGetTimeCopy); - throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name)); + _pool.SetUnavailable(new Exception(CoreErrorStrings.S_ConnectionStringError), obj.LastGetTimeCopy); + throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name)); } if (obj.Value.State != ConnectionState.Open || DateTime.Now.Subtract(obj.LastReturnTime).TotalSeconds > 60 && (await obj.Value.PingAsync()) == false) diff --git a/Providers/FreeSql.Provider.GBase/GBaseCodeFirst.cs b/Providers/FreeSql.Provider.GBase/GBaseCodeFirst.cs index 53c02d105..349126340 100644 --- a/Providers/FreeSql.Provider.GBase/GBaseCodeFirst.cs +++ b/Providers/FreeSql.Provider.GBase/GBaseCodeFirst.cs @@ -92,8 +92,8 @@ protected override string GetComparisonDDLStatements(params TypeSchemaAndName[] { if (sb.Length > 0) sb.Append("\r\n"); var tb = obj.tableSchema; - if (tb == null) throw new Exception(CoreStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); - if (tb.Columns.Any() == false) throw new Exception(CoreStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); + if (tb == null) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); + if (tb.Columns.Any() == false) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); var tbname = _commonUtils.SplitTableName(tb.DbName); if (tbname?.Length == 1) tbname = new[] { database, tbname[0] }; diff --git a/Providers/FreeSql.Provider.GBase/GBaseExpression.cs b/Providers/FreeSql.Provider.GBase/GBaseExpression.cs index 573858421..8a77e2524 100644 --- a/Providers/FreeSql.Provider.GBase/GBaseExpression.cs +++ b/Providers/FreeSql.Provider.GBase/GBaseExpression.cs @@ -241,7 +241,7 @@ public override string ExpressionLambdaToSqlCallString(MethodCallExpression exp, return _common.StringConcat(concatNewArrExp.Expressions.Select(a => getExp(a)).ToArray(), null); return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null); case "Format": - if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); + if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreErrorStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ? (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0); //3个 {} 时,Arguments 解析出来是分开的 diff --git a/Providers/FreeSql.Provider.KingbaseES/Curd/KingbaseESOnConflictDoUpdate.cs b/Providers/FreeSql.Provider.KingbaseES/Curd/KingbaseESOnConflictDoUpdate.cs index ebe991fa6..fa99bfd47 100644 --- a/Providers/FreeSql.Provider.KingbaseES/Curd/KingbaseESOnConflictDoUpdate.cs +++ b/Providers/FreeSql.Provider.KingbaseES/Curd/KingbaseESOnConflictDoUpdate.cs @@ -24,7 +24,7 @@ public class KingbaseESOnConflictDoUpdate where T1 : class public KingbaseESOnConflictDoUpdate(IInsert insert, Expression> columns = null) { _insert = insert as KingbaseESInsert; - if (_insert == null) throw new Exception(CoreStrings.S_Features_Unique("OnConflictDoUpdate", "KingbaseES")); + if (_insert == null) throw new Exception(CoreErrorStrings.S_Features_Unique("OnConflictDoUpdate", "KingbaseES")); if (_insert._noneParameterFlag == "c") _insert._noneParameterFlag = "cu"; if (columns != null) @@ -38,7 +38,7 @@ public KingbaseESOnConflictDoUpdate(IInsert insert, Expression new KdbndpConnection(masterConnectionString)) as IObjectPool : - new KingbaseESConnectionPool(CoreStrings.S_MasterDatabase, masterConnectionString, null, null); + new DbConnectionStringPool(base.DataType, CoreErrorStrings.S_MasterDatabase, () => new KdbndpConnection(masterConnectionString)) as IObjectPool : + new KingbaseESConnectionPool(CoreErrorStrings.S_MasterDatabase, masterConnectionString, null, null); slaveConnectionStrings?.ToList().ForEach(slaveConnectionString => { var slavePool = isAdoPool ? - new DbConnectionStringPool(base.DataType, $"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => new KdbndpConnection(slaveConnectionString)) as IObjectPool : - new KingbaseESConnectionPool($"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables)); + new DbConnectionStringPool(base.DataType, $"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => new KdbndpConnection(slaveConnectionString)) as IObjectPool : + new KingbaseESConnectionPool($"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables)); SlavePools.Add(slavePool); }); } diff --git a/Providers/FreeSql.Provider.KingbaseES/KingbaseESAdo/KingbaseESConnectionPool.cs b/Providers/FreeSql.Provider.KingbaseES/KingbaseESAdo/KingbaseESConnectionPool.cs index 1a439a5b3..902739411 100644 --- a/Providers/FreeSql.Provider.KingbaseES/KingbaseESAdo/KingbaseESConnectionPool.cs +++ b/Providers/FreeSql.Provider.KingbaseES/KingbaseESAdo/KingbaseESConnectionPool.cs @@ -56,7 +56,7 @@ class KingbaseESConnectionPoolPolicy : IPolicy { internal KingbaseESConnectionPool _pool; - public string Name { get; set; } = $"KingbaseES KdbndpConnection {CoreStrings.S_ObjectPool}"; + public string Name { get; set; } = $"KingbaseES KdbndpConnection {CoreErrorStrings.S_ObjectPool}"; public int PoolSize { get; set; } = 100; public TimeSpan SyncGetTimeout { get; set; } = TimeSpan.FromSeconds(10); public TimeSpan IdleTimeout { get; set; } = TimeSpan.FromSeconds(20); @@ -131,8 +131,8 @@ public void OnGet(Object obj) { if (obj.Value == null) { - _pool.SetUnavailable(new Exception(CoreStrings.S_ConnectionStringError), obj.LastGetTimeCopy); - throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name)); + _pool.SetUnavailable(new Exception(CoreErrorStrings.S_ConnectionStringError), obj.LastGetTimeCopy); + throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name)); } if (obj.Value.State != ConnectionState.Open || DateTime.Now.Subtract(obj.LastReturnTime).TotalSeconds > 60 && obj.Value.Ping() == false) @@ -161,8 +161,8 @@ async public Task OnGetAsync(Object obj) { if (obj.Value == null) { - _pool.SetUnavailable(new Exception(CoreStrings.S_ConnectionStringError), obj.LastGetTimeCopy); - throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name)); + _pool.SetUnavailable(new Exception(CoreErrorStrings.S_ConnectionStringError), obj.LastGetTimeCopy); + throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name)); } if (obj.Value.State != ConnectionState.Open || DateTime.Now.Subtract(obj.LastReturnTime).TotalSeconds > 60 && (await obj.Value.PingAsync()) == false) diff --git a/Providers/FreeSql.Provider.KingbaseES/KingbaseESCodeFirst.cs b/Providers/FreeSql.Provider.KingbaseES/KingbaseESCodeFirst.cs index b8919a2cf..3a29fa8ee 100644 --- a/Providers/FreeSql.Provider.KingbaseES/KingbaseESCodeFirst.cs +++ b/Providers/FreeSql.Provider.KingbaseES/KingbaseESCodeFirst.cs @@ -152,8 +152,8 @@ protected override string GetComparisonDDLStatements(params TypeSchemaAndName[] { if (sb.Length > 0) sb.Append("\r\n"); var tb = obj.tableSchema; - if (tb == null) throw new Exception(CoreStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); - if (tb.Columns.Any() == false) throw new Exception(CoreStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); + if (tb == null) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); + if (tb.Columns.Any() == false) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); var tbname = _commonUtils.SplitTableName(tb.DbName); if (tbname?.Length == 1) tbname = new[] { public_, tbname[0] }; diff --git a/Providers/FreeSql.Provider.KingbaseES/KingbaseESExpression.cs b/Providers/FreeSql.Provider.KingbaseES/KingbaseESExpression.cs index d17c761f0..f67b7559f 100644 --- a/Providers/FreeSql.Provider.KingbaseES/KingbaseESExpression.cs +++ b/Providers/FreeSql.Provider.KingbaseES/KingbaseESExpression.cs @@ -369,7 +369,7 @@ public override string ExpressionLambdaToSqlCallString(MethodCallExpression exp, return _common.StringConcat(concatNewArrExp.Expressions.Select(a => getExp(a)).ToArray(), null); return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null); case "Format": - if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp, exp.Arguments[0])); + if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreErrorStrings.Not_Implemented_Expression_ParameterUseConstant(exp, exp.Arguments[0])); var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ? (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0); //3个 {} 时,Arguments 解析出来是分开的 diff --git a/Providers/FreeSql.Provider.KingbaseES/KingbaseESExtensions.cs b/Providers/FreeSql.Provider.KingbaseES/KingbaseESExtensions.cs index 372ba1116..998d63ca0 100644 --- a/Providers/FreeSql.Provider.KingbaseES/KingbaseESExtensions.cs +++ b/Providers/FreeSql.Provider.KingbaseES/KingbaseESExtensions.cs @@ -142,7 +142,7 @@ static NativeTuple ExecuteKdbCopyState public static void ExecuteKdbCopy(this IInsert that) where T : class { var insert = that as FreeSql.KingbaseES.KingbaseESInsert; - if (insert == null) throw new Exception(CoreStrings.S_Features_Unique("ExecuteKdbCopy", "KingbaseES")); + if (insert == null) throw new Exception(CoreErrorStrings.S_Features_Unique("ExecuteKdbCopy", "KingbaseES")); var dt = that.ToDataTable(); if (dt.Rows.Count == 0) return; @@ -200,7 +200,7 @@ public static void ExecuteKdbCopy(this IInsert that) where T : class } else { - throw new NotImplementedException($"ExecuteKdbCopy {CoreStrings.S_Not_Implemented_FeedBack}"); + throw new NotImplementedException($"ExecuteKdbCopy {CoreErrorStrings.S_Not_Implemented_FeedBack}"); } } finally diff --git a/Providers/FreeSql.Provider.MsAccess/Curd/MsAccessDelete.cs b/Providers/FreeSql.Provider.MsAccess/Curd/MsAccessDelete.cs index fa822e8a5..ceb5a9f8f 100644 --- a/Providers/FreeSql.Provider.MsAccess/Curd/MsAccessDelete.cs +++ b/Providers/FreeSql.Provider.MsAccess/Curd/MsAccessDelete.cs @@ -16,11 +16,11 @@ public MsAccessDelete(IFreeSql orm, CommonUtils commonUtils, CommonExpression co { } - public override List ExecuteDeleted() => throw new NotImplementedException($"FreeSql.Provider.MsAccess {CoreStrings.S_Not_Implemented_Feature}"); + public override List ExecuteDeleted() => throw new NotImplementedException($"FreeSql.Provider.MsAccess {CoreErrorStrings.S_Not_Implemented_Feature}"); #if net40 #else - public override Task> ExecuteDeletedAsync(CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Provider.MsAccess {CoreStrings.S_Not_Implemented_Feature}"); + public override Task> ExecuteDeletedAsync(CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Provider.MsAccess {CoreErrorStrings.S_Not_Implemented_Feature}"); #endif } } diff --git a/Providers/FreeSql.Provider.MsAccess/Curd/MsAccessInsert.cs b/Providers/FreeSql.Provider.MsAccess/Curd/MsAccessInsert.cs index 606c2b081..c5c9111a9 100644 --- a/Providers/FreeSql.Provider.MsAccess/Curd/MsAccessInsert.cs +++ b/Providers/FreeSql.Provider.MsAccess/Curd/MsAccessInsert.cs @@ -26,7 +26,7 @@ public MsAccessInsert(IFreeSql orm, CommonUtils commonUtils, CommonExpression co public override List ExecuteInserted() => base.SplitExecuteInserted(1, 1000); public override IInsert BatchOptions(int valuesLimit, int parameterLimit, bool autoTransaction = true) => - throw new NotImplementedException(CoreStrings.S_Access_InsertOnlyOneAtTime); + throw new NotImplementedException(CoreErrorStrings.S_Access_InsertOnlyOneAtTime); protected override int RawExecuteAffrows() { diff --git a/Providers/FreeSql.Provider.MsAccess/Curd/MsAccessSelect.cs b/Providers/FreeSql.Provider.MsAccess/Curd/MsAccessSelect.cs index b12fa6661..c7ad51033 100644 --- a/Providers/FreeSql.Provider.MsAccess/Curd/MsAccessSelect.cs +++ b/Providers/FreeSql.Provider.MsAccess/Curd/MsAccessSelect.cs @@ -39,7 +39,7 @@ internal static string ToSqlStatic(CommonUtils _commonUtils, CommonExpression _c if (_limit > 0) sb.Append("TOP ").Append(_skip + _limit).Append(" "); sb.Append(field); if (_skip > 0) - throw new NotImplementedException(CoreStrings.S_NotImplementSkipOffset("MsAccess")); + throw new NotImplementedException(CoreErrorStrings.S_NotImplementSkipOffset("MsAccess")); sb.Append(" \r\nFROM "); var fromIndex = sb.Length; var ioinCounter = 0; diff --git a/Providers/FreeSql.Provider.MsAccess/Curd/MsAccessUpdate.cs b/Providers/FreeSql.Provider.MsAccess/Curd/MsAccessUpdate.cs index e9c35db9d..657d08aef 100644 --- a/Providers/FreeSql.Provider.MsAccess/Curd/MsAccessUpdate.cs +++ b/Providers/FreeSql.Provider.MsAccess/Curd/MsAccessUpdate.cs @@ -20,12 +20,12 @@ public MsAccessUpdate(IFreeSql orm, CommonUtils commonUtils, CommonExpression co _batchAutoTransaction = false; } - public override IUpdate BatchOptions(int rowsLimit, int parameterLimit, bool autoTransaction = true) => throw new NotImplementedException(CoreStrings.S_Access_InsertOnlyOneAtTime); + public override IUpdate BatchOptions(int rowsLimit, int parameterLimit, bool autoTransaction = true) => throw new NotImplementedException(CoreErrorStrings.S_Access_InsertOnlyOneAtTime); //蛋疼的 access 更新只能一条一条执行,不支持 case .. when .. then .. end,也不支持事务 public override int ExecuteAffrows() => base.SplitExecuteAffrows(1, 1000); protected override List ExecuteUpdated(IEnumerable columns) => base.SplitExecuteUpdated(1, 1000, columns); - protected override List RawExecuteUpdated(IEnumerable columns) => throw new NotImplementedException($"FreeSql.Provider.MsAccess {CoreStrings.S_Not_Implemented_Feature}"); + protected override List RawExecuteUpdated(IEnumerable columns) => throw new NotImplementedException($"FreeSql.Provider.MsAccess {CoreErrorStrings.S_Not_Implemented_Feature}"); protected override void ToSqlCase(StringBuilder caseWhen, ColumnInfo[] primarys) { @@ -67,7 +67,7 @@ protected override void ToSqlWhen(StringBuilder sb, ColumnInfo[] primarys, objec public override Task ExecuteAffrowsAsync(CancellationToken cancellationToken = default) => base.SplitExecuteAffrowsAsync(1, 1000, cancellationToken); protected override Task> ExecuteUpdatedAsync(IEnumerable columns, CancellationToken cancellationToken = default) => base.SplitExecuteUpdatedAsync(1, 1000, columns, cancellationToken); - protected override Task> RawExecuteUpdatedAsync(IEnumerable columns, CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Provider.MsAccess {CoreStrings.S_Not_Implemented_Feature}"); + protected override Task> RawExecuteUpdatedAsync(IEnumerable columns, CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Provider.MsAccess {CoreErrorStrings.S_Not_Implemented_Feature}"); #endif } } diff --git a/Providers/FreeSql.Provider.MsAccess/MsAccessAdo/MsAccessAdo.cs b/Providers/FreeSql.Provider.MsAccess/MsAccessAdo/MsAccessAdo.cs index 8b484e280..deff747a6 100644 --- a/Providers/FreeSql.Provider.MsAccess/MsAccessAdo/MsAccessAdo.cs +++ b/Providers/FreeSql.Provider.MsAccess/MsAccessAdo/MsAccessAdo.cs @@ -29,14 +29,14 @@ public MsAccessAdo(CommonUtils util, string masterConnectionString, string[] sla if (isAdoPool) masterConnectionString = masterConnectionString.Substring("AdoConnectionPool,".Length); if (!string.IsNullOrEmpty(masterConnectionString)) MasterPool = isAdoPool ? - new DbConnectionStringPool(base.DataType, CoreStrings.S_MasterDatabase, () => new OleDbConnection(masterConnectionString)) as IObjectPool : - new MsAccessConnectionPool(CoreStrings.S_MasterDatabase, masterConnectionString, null, null); + new DbConnectionStringPool(base.DataType, CoreErrorStrings.S_MasterDatabase, () => new OleDbConnection(masterConnectionString)) as IObjectPool : + new MsAccessConnectionPool(CoreErrorStrings.S_MasterDatabase, masterConnectionString, null, null); slaveConnectionStrings?.ToList().ForEach(slaveConnectionString => { var slavePool = isAdoPool ? - new DbConnectionStringPool(base.DataType, $"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => new OleDbConnection(slaveConnectionString)) as IObjectPool : - new MsAccessConnectionPool($"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables)); + new DbConnectionStringPool(base.DataType, $"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => new OleDbConnection(slaveConnectionString)) as IObjectPool : + new MsAccessConnectionPool($"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables)); SlavePools.Add(slavePool); }); } diff --git a/Providers/FreeSql.Provider.MsAccess/MsAccessAdo/MsAccessConnectionPool.cs b/Providers/FreeSql.Provider.MsAccess/MsAccessAdo/MsAccessConnectionPool.cs index 3a432163e..ba5cade0d 100644 --- a/Providers/FreeSql.Provider.MsAccess/MsAccessAdo/MsAccessConnectionPool.cs +++ b/Providers/FreeSql.Provider.MsAccess/MsAccessAdo/MsAccessConnectionPool.cs @@ -40,7 +40,7 @@ class AccessConnectionPoolPolicy : IPolicy { internal MsAccessConnectionPool _pool; - public string Name { get; set; } = $"Microsoft Access OleDbConnection {CoreStrings.S_ObjectPool}"; + public string Name { get; set; } = $"Microsoft Access OleDbConnection {CoreErrorStrings.S_ObjectPool}"; public int PoolSize { get; set; } = 100; public TimeSpan SyncGetTimeout { get; set; } = TimeSpan.FromSeconds(30); public TimeSpan IdleTimeout { get; set; } = TimeSpan.Zero; @@ -114,7 +114,7 @@ public void OnGet(Object obj) { if (obj.Value == null) - throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name)); + throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name)); if (obj.Value.State != ConnectionState.Open) obj.Value.Open(); @@ -130,7 +130,7 @@ async public Task OnGetAsync(Object obj) { if (obj.Value == null) - throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name)); + throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name)); if (obj.Value.State != ConnectionState.Open) await obj.Value.OpenAsync(); diff --git a/Providers/FreeSql.Provider.MsAccess/MsAccessCodeFirst.cs b/Providers/FreeSql.Provider.MsAccess/MsAccessCodeFirst.cs index 39b60da2e..fd9ec101f 100644 --- a/Providers/FreeSql.Provider.MsAccess/MsAccessCodeFirst.cs +++ b/Providers/FreeSql.Provider.MsAccess/MsAccessCodeFirst.cs @@ -80,8 +80,8 @@ protected override string GetComparisonDDLStatements(params TypeSchemaAndName[] { if (sb.Length > 0) sb.Append("\r\n"); var tb = obj.tableSchema; - if (tb == null) throw new Exception(CoreStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); - if (tb.Columns.Any() == false) throw new Exception(CoreStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); + if (tb == null) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); + if (tb.Columns.Any() == false) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); var tbname = tb.DbName; var tboldname = tb.DbOldName; //旧表名 if (string.Compare(tbname, tboldname, true) == 0) tboldname = null; @@ -177,7 +177,7 @@ protected override string GetComparisonDDLStatements(params TypeSchemaAndName[] istmpatler = true; } if (tboldname != null && isexistsTb == true) - throw new Exception(CoreStrings.S_OldTableExists(tboldname, tbname)); + throw new Exception(CoreErrorStrings.S_OldTableExists(tboldname, tbname)); DataTable schemaColumns = null; DataTable schemaDataTypes = null; diff --git a/Providers/FreeSql.Provider.MsAccess/MsAccessExpression.cs b/Providers/FreeSql.Provider.MsAccess/MsAccessExpression.cs index e878986c5..ec66c329a 100644 --- a/Providers/FreeSql.Provider.MsAccess/MsAccessExpression.cs +++ b/Providers/FreeSql.Provider.MsAccess/MsAccessExpression.cs @@ -224,7 +224,7 @@ public override string ExpressionLambdaToSqlCallString(MethodCallExpression exp, return _common.StringConcat(concatNewArrExp.Expressions.Select(a => getExp(a)).ToArray(), concatNewArrExp.Expressions.Select(a => a.Type).ToArray()); return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), exp.Arguments.Select(a => a.Type).ToArray()); case "Format": - if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); + if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreErrorStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ? (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0); //3个 {} 时,Arguments 解析出来是分开的 diff --git a/Providers/FreeSql.Provider.MsAccess/MsAccessProvider.cs b/Providers/FreeSql.Provider.MsAccess/MsAccessProvider.cs index 28ea24747..45f40a13d 100644 --- a/Providers/FreeSql.Provider.MsAccess/MsAccessProvider.cs +++ b/Providers/FreeSql.Provider.MsAccess/MsAccessProvider.cs @@ -15,7 +15,7 @@ public class MsAccessProvider : BaseDbProvider, IFreeSql public override IDelete CreateDeleteProvider(object dywhere) => new MsAccessDelete(this, this.InternalCommonUtils, this.InternalCommonExpression, dywhere); public override IInsertOrUpdate CreateInsertOrUpdateProvider() => throw new NotImplementedException(); - public override IDbFirst DbFirst => throw new NotImplementedException($"FreeSql.Provider.MsAccess {CoreStrings.S_Not_Implemented_Feature}"); + public override IDbFirst DbFirst => throw new NotImplementedException($"FreeSql.Provider.MsAccess {CoreErrorStrings.S_Not_Implemented_Feature}"); public MsAccessProvider(string masterConnectionString, string[] slaveConnectionString, Func connectionFactory = null) { this.InternalCommonUtils = new MsAccessUtils(this); diff --git a/Providers/FreeSql.Provider.MySql/Curd/MySqlInsertOrUpdate.cs b/Providers/FreeSql.Provider.MySql/Curd/MySqlInsertOrUpdate.cs index 1a4a0c651..ab9e227d1 100644 --- a/Providers/FreeSql.Provider.MySql/Curd/MySqlInsertOrUpdate.cs +++ b/Providers/FreeSql.Provider.MySql/Curd/MySqlInsertOrUpdate.cs @@ -86,7 +86,7 @@ string getInsertSql(List data, bool flagInsert, bool noneParameter) } else { - if (_tempPrimarys.Any() == false) throw new Exception(CoreStrings.Entity_Must_Primary_Key("fsql.InsertOrUpdate + IfExistsDoNothing + MySql ", _table.CsName)); + if (_tempPrimarys.Any() == false) throw new Exception(CoreErrorStrings.Entity_Must_Primary_Key("fsql.InsertOrUpdate + IfExistsDoNothing + MySql ", _table.CsName)); sql = insert.ToSqlValuesOrSelectUnionAll(); if (sql?.StartsWith("INSERT INTO ") == true) sql = $"INSERT IGNORE INTO {sql.Substring(12)}"; diff --git a/Providers/FreeSql.Provider.MySql/Curd/OnDuplicateKeyUpdate.cs b/Providers/FreeSql.Provider.MySql/Curd/OnDuplicateKeyUpdate.cs index 5cdccc178..83ea687ef 100644 --- a/Providers/FreeSql.Provider.MySql/Curd/OnDuplicateKeyUpdate.cs +++ b/Providers/FreeSql.Provider.MySql/Curd/OnDuplicateKeyUpdate.cs @@ -17,7 +17,7 @@ public class OnDuplicateKeyUpdate where T1 : class public OnDuplicateKeyUpdate(IInsert insert) { _mysqlInsert = insert as MySqlInsert; - if (_mysqlInsert == null) throw new Exception(CoreStrings.S_Features_Unique("OnDuplicateKeyUpdate", "MySql/FreeSql.Provider.MySqlConnector")); + if (_mysqlInsert == null) throw new Exception(CoreErrorStrings.S_Features_Unique("OnDuplicateKeyUpdate", "MySql/FreeSql.Provider.MySqlConnector")); if (_mysqlInsert._noneParameterFlag == "c") _mysqlInsert._noneParameterFlag = "cu"; } diff --git a/Providers/FreeSql.Provider.MySql/MySqlAdo/MySqlAdo.cs b/Providers/FreeSql.Provider.MySql/MySqlAdo/MySqlAdo.cs index 5c36ffd0d..831f74b5d 100644 --- a/Providers/FreeSql.Provider.MySql/MySqlAdo/MySqlAdo.cs +++ b/Providers/FreeSql.Provider.MySql/MySqlAdo/MySqlAdo.cs @@ -34,14 +34,14 @@ public MySqlAdo(CommonUtils util, string masterConnectionString, string[] slaveC if (isAdoPool) masterConnectionString = masterConnectionString.Substring("AdoConnectionPool,".Length); if (!string.IsNullOrEmpty(masterConnectionString)) MasterPool = isAdoPool ? - new DbConnectionStringPool(base.DataType, CoreStrings.S_MasterDatabase, () => new MySqlConnection(masterConnectionString)) as IObjectPool : - new MySqlConnectionPool(CoreStrings.S_MasterDatabase, masterConnectionString, null, null); + new DbConnectionStringPool(base.DataType, CoreErrorStrings.S_MasterDatabase, () => new MySqlConnection(masterConnectionString)) as IObjectPool : + new MySqlConnectionPool(CoreErrorStrings.S_MasterDatabase, masterConnectionString, null, null); slaveConnectionStrings?.ToList().ForEach(slaveConnectionString => { var slavePool = isAdoPool ? - new DbConnectionStringPool(base.DataType, $"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => new MySqlConnection(slaveConnectionString)) as IObjectPool : - new MySqlConnectionPool($"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables)); + new DbConnectionStringPool(base.DataType, $"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => new MySqlConnection(slaveConnectionString)) as IObjectPool : + new MySqlConnectionPool($"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables)); SlavePools.Add(slavePool); }); } diff --git a/Providers/FreeSql.Provider.MySql/MySqlAdo/MySqlConnectionPool.cs b/Providers/FreeSql.Provider.MySql/MySqlAdo/MySqlConnectionPool.cs index e4488b584..4a8d42d24 100644 --- a/Providers/FreeSql.Provider.MySql/MySqlAdo/MySqlConnectionPool.cs +++ b/Providers/FreeSql.Provider.MySql/MySqlAdo/MySqlConnectionPool.cs @@ -49,7 +49,7 @@ class MySqlConnectionPoolPolicy : IPolicy { internal MySqlConnectionPool _pool; - public string Name { get; set; } = $"MySql MySqlConnection {CoreStrings.S_ObjectPool}"; + public string Name { get; set; } = $"MySql MySqlConnection {CoreErrorStrings.S_ObjectPool}"; public int PoolSize { get; set; } = 100; public TimeSpan SyncGetTimeout { get; set; } = TimeSpan.FromSeconds(10); public TimeSpan IdleTimeout { get; set; } = TimeSpan.FromSeconds(20); @@ -125,8 +125,8 @@ public void OnGet(Object obj) { if (obj.Value == null) { - _pool.SetUnavailable(new Exception(CoreStrings.S_ConnectionStringError), obj.LastGetTimeCopy); - throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name)); + _pool.SetUnavailable(new Exception(CoreErrorStrings.S_ConnectionStringError), obj.LastGetTimeCopy); + throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name)); } if (obj.Value.State != ConnectionState.Open || DateTime.Now.Subtract(obj.LastReturnTime).TotalSeconds > 60 && obj.Value.Ping() == false) @@ -155,8 +155,8 @@ async public Task OnGetAsync(Object obj) { if (obj.Value == null) { - _pool.SetUnavailable(new Exception(CoreStrings.S_ConnectionStringError), obj.LastGetTimeCopy); - throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name)); + _pool.SetUnavailable(new Exception(CoreErrorStrings.S_ConnectionStringError), obj.LastGetTimeCopy); + throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name)); } if (obj.Value.State != ConnectionState.Open || DateTime.Now.Subtract(obj.LastReturnTime).TotalSeconds > 60 && (await obj.Value.PingAsync()) == false) diff --git a/Providers/FreeSql.Provider.MySql/MySqlAdo/MygisTypes.cs b/Providers/FreeSql.Provider.MySql/MySqlAdo/MygisTypes.cs index 338a68d89..abfa42d88 100644 --- a/Providers/FreeSql.Provider.MySql/MySqlAdo/MygisTypes.cs +++ b/Providers/FreeSql.Provider.MySql/MySqlAdo/MygisTypes.cs @@ -72,7 +72,7 @@ public static MygisGeometry Parse(string wkt) else if (wkt.StartsWith("multipoint", StringComparison.CurrentCultureIgnoreCase)) return new MygisMultiPoint(ParseLineString(wkt.Substring(10).Trim('(', ')'))); else if (wkt.StartsWith("multilinestring", StringComparison.CurrentCultureIgnoreCase)) return new MygisMultiLineString(ParseMultiLineString(wkt.Substring(15).Trim('(', ')'))); else if (wkt.StartsWith("multipolygon", StringComparison.CurrentCultureIgnoreCase)) return new MygisMultiPolygon(ParseMultiPolygon(wkt.Substring(12).Trim('(', ')'))); - throw new NotImplementedException(CoreStrings.S_MygisGeometry_NotImplement(wkt)); + throw new NotImplementedException(CoreErrorStrings.S_MygisGeometry_NotImplement(wkt)); } static MygisPoint ParsePoint(string str) { diff --git a/Providers/FreeSql.Provider.MySql/MySqlCodeFirst.cs b/Providers/FreeSql.Provider.MySql/MySqlCodeFirst.cs index 046f5602f..ade0e6533 100644 --- a/Providers/FreeSql.Provider.MySql/MySqlCodeFirst.cs +++ b/Providers/FreeSql.Provider.MySql/MySqlCodeFirst.cs @@ -106,8 +106,8 @@ protected override string GetComparisonDDLStatements(params TypeSchemaAndName[] { if (sb.Length > 0) sb.Append("\r\n"); var tb = obj.tableSchema; - if (tb == null) throw new Exception(CoreStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); - if (tb.Columns.Any() == false) throw new Exception(CoreStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); + if (tb == null) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); + if (tb.Columns.Any() == false) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); var tbname = _commonUtils.SplitTableName(tb.DbName); if (tbname?.Length == 1) tbname = new[] { database, tbname[0] }; diff --git a/Providers/FreeSql.Provider.MySql/MySqlExpression.cs b/Providers/FreeSql.Provider.MySql/MySqlExpression.cs index 4800911d5..c92eb7206 100644 --- a/Providers/FreeSql.Provider.MySql/MySqlExpression.cs +++ b/Providers/FreeSql.Provider.MySql/MySqlExpression.cs @@ -252,7 +252,7 @@ public override string ExpressionLambdaToSqlCallString(MethodCallExpression exp, return _common.StringConcat(concatNewArrExp.Expressions.Select(a => getExp(a)).ToArray(), null); return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null); case "Format": - if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); + if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreErrorStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); if (exp.Arguments.Count == 1) return ExpressionLambdaToSql(exp.Arguments[0], tsc); var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ? (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0); diff --git a/Providers/FreeSql.Provider.MySql/MySqlExtensions.cs b/Providers/FreeSql.Provider.MySql/MySqlExtensions.cs index 48a72c1c8..32ad25937 100644 --- a/Providers/FreeSql.Provider.MySql/MySqlExtensions.cs +++ b/Providers/FreeSql.Provider.MySql/MySqlExtensions.cs @@ -32,7 +32,7 @@ public static partial class FreeSqlMySqlGlobalExtensions public static IInsert MySqlIgnoreInto(this IInsert that) where T1 : class { var _mysqlInsert = that as MySqlInsert; - if (_mysqlInsert == null) throw new Exception(CoreStrings.S_Features_Unique("MySqlIgnoreInto", "MySql/FreeSql.Provider.MySqlConnector")); + if (_mysqlInsert == null) throw new Exception(CoreErrorStrings.S_Features_Unique("MySqlIgnoreInto", "MySql/FreeSql.Provider.MySqlConnector")); _mysqlInsert.InternalIsIgnoreInto = true; return that; } diff --git a/Providers/FreeSql.Provider.MySqlConnector/FreeSqlMySqlConnectorGlobalExtensions.cs b/Providers/FreeSql.Provider.MySqlConnector/FreeSqlMySqlConnectorGlobalExtensions.cs index 57a4706fc..58c2e8629 100644 --- a/Providers/FreeSql.Provider.MySqlConnector/FreeSqlMySqlConnectorGlobalExtensions.cs +++ b/Providers/FreeSql.Provider.MySqlConnector/FreeSqlMySqlConnectorGlobalExtensions.cs @@ -138,7 +138,7 @@ static NativeTuple ExecuteMySqlBulkCop public static void ExecuteMySqlBulkCopy(this IInsert that, int? bulkCopyTimeout = null) where T : class { var insert = that as FreeSql.MySql.Curd.MySqlInsert; - if (insert == null) throw new Exception(CoreStrings.S_Features_Unique("ExecuteMySqlBulkCopy", "MySqlConnector")); + if (insert == null) throw new Exception(CoreErrorStrings.S_Features_Unique("ExecuteMySqlBulkCopy", "MySqlConnector")); var dt = that.ToDataTable(); if (dt.Rows.Count == 0) return; @@ -187,7 +187,7 @@ public static void ExecuteMySqlBulkCopy(this IInsert that, int? bulkCopyTi } else { - throw new NotImplementedException($"ExecuteMySqlBulkCopy {CoreStrings.S_Not_Implemented_FeedBack}"); + throw new NotImplementedException($"ExecuteMySqlBulkCopy {CoreErrorStrings.S_Not_Implemented_FeedBack}"); } } finally @@ -214,7 +214,7 @@ public static Task ExecuteMySqlBulkCopyAsync(this IUpdate that, int? async public static Task ExecuteMySqlBulkCopyAsync(this IInsert that, int? bulkCopyTimeout = null, CancellationToken cancellationToken = default) where T : class { var insert = that as FreeSql.MySql.Curd.MySqlInsert; - if (insert == null) throw new Exception(CoreStrings.S_Features_Unique("ExecuteMySqlBulkCopyAsync", "MySqlConnector")); + if (insert == null) throw new Exception(CoreErrorStrings.S_Features_Unique("ExecuteMySqlBulkCopyAsync", "MySqlConnector")); var dt = that.ToDataTable(); if (dt.Rows.Count == 0) return; @@ -263,7 +263,7 @@ async public static Task ExecuteMySqlBulkCopyAsync(this IInsert that, int? } else { - throw new NotImplementedException($"ExecuteMySqlBulkCopyAsync {CoreStrings.S_Not_Implemented_FeedBack}"); + throw new NotImplementedException($"ExecuteMySqlBulkCopyAsync {CoreErrorStrings.S_Not_Implemented_FeedBack}"); } } finally diff --git a/Providers/FreeSql.Provider.Odbc/Default/Curd/OdbcDelete.cs b/Providers/FreeSql.Provider.Odbc/Default/Curd/OdbcDelete.cs index 671564ff7..0e0af7222 100644 --- a/Providers/FreeSql.Provider.Odbc/Default/Curd/OdbcDelete.cs +++ b/Providers/FreeSql.Provider.Odbc/Default/Curd/OdbcDelete.cs @@ -16,11 +16,11 @@ public OdbcDelete(IFreeSql orm, CommonUtils commonUtils, CommonExpression common { } - public override List ExecuteDeleted() => throw new NotImplementedException($"FreeSql.Odbc.Default {CoreStrings.S_Not_Implemented_Feature}"); + public override List ExecuteDeleted() => throw new NotImplementedException($"FreeSql.Odbc.Default {CoreErrorStrings.S_Not_Implemented_Feature}"); #if net40 #else - public override Task> ExecuteDeletedAsync(CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Odbc.Default {CoreStrings.S_Not_Implemented_Feature}"); + public override Task> ExecuteDeletedAsync(CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Odbc.Default {CoreErrorStrings.S_Not_Implemented_Feature}"); #endif } } diff --git a/Providers/FreeSql.Provider.Odbc/Default/Curd/OdbcInsert.cs b/Providers/FreeSql.Provider.Odbc/Default/Curd/OdbcInsert.cs index 681362cb8..c6f517e1b 100644 --- a/Providers/FreeSql.Provider.Odbc/Default/Curd/OdbcInsert.cs +++ b/Providers/FreeSql.Provider.Odbc/Default/Curd/OdbcInsert.cs @@ -62,7 +62,7 @@ protected override long RawExecuteIdentity() return ret; } - protected override List RawExecuteInserted() => throw new NotImplementedException($"FreeSql.Odbc.Default {CoreStrings.S_Not_Implemented_Feature}"); + protected override List RawExecuteInserted() => throw new NotImplementedException($"FreeSql.Odbc.Default {CoreErrorStrings.S_Not_Implemented_Feature}"); #if net40 #else @@ -107,7 +107,7 @@ async protected override Task RawExecuteIdentityAsync(CancellationToken ca } return ret; } - protected override Task> RawExecuteInsertedAsync(CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Odbc.Default {CoreStrings.S_Not_Implemented_Feature}"); + protected override Task> RawExecuteInsertedAsync(CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Odbc.Default {CoreErrorStrings.S_Not_Implemented_Feature}"); #endif } } \ No newline at end of file diff --git a/Providers/FreeSql.Provider.Odbc/Default/Curd/OdbcSelect.cs b/Providers/FreeSql.Provider.Odbc/Default/Curd/OdbcSelect.cs index b966c2f49..1f88f4d5f 100644 --- a/Providers/FreeSql.Provider.Odbc/Default/Curd/OdbcSelect.cs +++ b/Providers/FreeSql.Provider.Odbc/Default/Curd/OdbcSelect.cs @@ -38,7 +38,7 @@ internal static string ToSqlStatic(CommonUtils _commonUtils, CommonExpression _c if (_limit > 0 && _utils.Adapter.SelectTopStyle == OdbcAdapter.SelecTopStyle.Top) sb.Append("TOP ").Append(_skip + _limit).Append(" "); sb.Append(field); if (_skip > 0 && _utils.Adapter.SelectTopStyle == OdbcAdapter.SelecTopStyle.Top) - throw new NotImplementedException(CoreStrings.S_NotImplementSkipOffset("Default")); + throw new NotImplementedException(CoreErrorStrings.S_NotImplementSkipOffset("Default")); sb.Append(" \r\nFROM "); var tbsjoin = _tables.Where(a => a.Type != SelectTableInfoType.From).ToArray(); diff --git a/Providers/FreeSql.Provider.Odbc/Default/Curd/OdbcUpdate.cs b/Providers/FreeSql.Provider.Odbc/Default/Curd/OdbcUpdate.cs index 41f84c879..d6adc612b 100644 --- a/Providers/FreeSql.Provider.Odbc/Default/Curd/OdbcUpdate.cs +++ b/Providers/FreeSql.Provider.Odbc/Default/Curd/OdbcUpdate.cs @@ -23,7 +23,7 @@ public OdbcUpdate(IFreeSql orm, CommonUtils commonUtils, CommonExpression common public override int ExecuteAffrows() => base.SplitExecuteAffrows(_batchRowsLimit > 0 ? _batchRowsLimit : _utils.Adapter.UpdateBatchSplitLimit, _batchParameterLimit > 0 ? _batchParameterLimit : 255); protected override List ExecuteUpdated(IEnumerable columns) => base.SplitExecuteUpdated(_batchRowsLimit > 0 ? _batchRowsLimit : _utils.Adapter.UpdateBatchSplitLimit, _batchParameterLimit > 0 ? _batchParameterLimit : 255, columns); - protected override List RawExecuteUpdated(IEnumerable columns) => throw new NotImplementedException($"FreeSql.Odbc.Default {CoreStrings.S_Not_Implemented_Feature}"); + protected override List RawExecuteUpdated(IEnumerable columns) => throw new NotImplementedException($"FreeSql.Odbc.Default {CoreErrorStrings.S_Not_Implemented_Feature}"); protected override void ToSqlCase(StringBuilder caseWhen, ColumnInfo[] primarys) { @@ -65,7 +65,7 @@ protected override void ToSqlWhen(StringBuilder sb, ColumnInfo[] primarys, objec public override Task ExecuteAffrowsAsync(CancellationToken cancellationToken = default) => base.SplitExecuteAffrowsAsync(_batchRowsLimit > 0 ? _batchRowsLimit : _utils.Adapter.UpdateBatchSplitLimit, _batchParameterLimit > 0 ? _batchParameterLimit : 255, cancellationToken); protected override Task> ExecuteUpdatedAsync(IEnumerable columns, CancellationToken cancellationToken = default) => base.SplitExecuteUpdatedAsync(_batchRowsLimit > 0 ? _batchRowsLimit : _utils.Adapter.UpdateBatchSplitLimit, _batchParameterLimit > 0 ? _batchParameterLimit : 255, columns, cancellationToken); - protected override Task> RawExecuteUpdatedAsync(IEnumerable columns, CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Odbc.Default {CoreStrings.S_Not_Implemented_Feature}"); + protected override Task> RawExecuteUpdatedAsync(IEnumerable columns, CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Odbc.Default {CoreErrorStrings.S_Not_Implemented_Feature}"); #endif } } diff --git a/Providers/FreeSql.Provider.Odbc/Default/OdbcAdo/OdbcAdo.cs b/Providers/FreeSql.Provider.Odbc/Default/OdbcAdo/OdbcAdo.cs index 8875e6549..1ee450783 100644 --- a/Providers/FreeSql.Provider.Odbc/Default/OdbcAdo/OdbcAdo.cs +++ b/Providers/FreeSql.Provider.Odbc/Default/OdbcAdo/OdbcAdo.cs @@ -30,14 +30,14 @@ public OdbcAdo(CommonUtils util, string masterConnectionString, string[] slaveCo if (isAdoPool) masterConnectionString = masterConnectionString.Substring("AdoConnectionPool,".Length); if (!string.IsNullOrEmpty(masterConnectionString)) MasterPool = isAdoPool ? - new DbConnectionStringPool(base.DataType, CoreStrings.S_MasterDatabase, () => new OdbcConnection(masterConnectionString)) as IObjectPool : - new OdbcConnectionPool(CoreStrings.S_MasterDatabase, masterConnectionString, null, null); + new DbConnectionStringPool(base.DataType, CoreErrorStrings.S_MasterDatabase, () => new OdbcConnection(masterConnectionString)) as IObjectPool : + new OdbcConnectionPool(CoreErrorStrings.S_MasterDatabase, masterConnectionString, null, null); slaveConnectionStrings?.ToList().ForEach(slaveConnectionString => { var slavePool = isAdoPool ? - new DbConnectionStringPool(base.DataType, $"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => new OdbcConnection(slaveConnectionString)) as IObjectPool : - new OdbcConnectionPool($"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables)); + new DbConnectionStringPool(base.DataType, $"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => new OdbcConnection(slaveConnectionString)) as IObjectPool : + new OdbcConnectionPool($"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables)); SlavePools.Add(slavePool); }); } diff --git a/Providers/FreeSql.Provider.Odbc/Default/OdbcAdo/OdbcConnectionPool.cs b/Providers/FreeSql.Provider.Odbc/Default/OdbcAdo/OdbcConnectionPool.cs index ad43c4062..721fd9004 100644 --- a/Providers/FreeSql.Provider.Odbc/Default/OdbcAdo/OdbcConnectionPool.cs +++ b/Providers/FreeSql.Provider.Odbc/Default/OdbcAdo/OdbcConnectionPool.cs @@ -45,7 +45,7 @@ class OdbcConnectionPoolPolicy : IPolicy { internal OdbcConnectionPool _pool; - public string Name { get; set; } = $"Default OdbcConnection {CoreStrings.S_ObjectPool}"; + public string Name { get; set; } = $"Default OdbcConnection {CoreErrorStrings.S_ObjectPool}"; public int PoolSize { get; set; } = 100; public TimeSpan SyncGetTimeout { get; set; } = TimeSpan.FromSeconds(10); public TimeSpan IdleTimeout { get; set; } = TimeSpan.FromSeconds(20); @@ -121,8 +121,8 @@ public void OnGet(Object obj) if (obj.Value == null) { - _pool.SetUnavailable(new Exception(CoreStrings.S_ConnectionStringError), obj.LastGetTimeCopy); - throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name)); + _pool.SetUnavailable(new Exception(CoreErrorStrings.S_ConnectionStringError), obj.LastGetTimeCopy); + throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name)); } if (obj.Value.State != ConnectionState.Open || DateTime.Now.Subtract(obj.LastReturnTime).TotalSeconds > 60 && obj.Value.Ping() == false) @@ -152,8 +152,8 @@ async public Task OnGetAsync(Object obj) if (obj.Value == null) { - _pool.SetUnavailable(new Exception(CoreStrings.S_ConnectionStringError), obj.LastGetTimeCopy); - throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name)); + _pool.SetUnavailable(new Exception(CoreErrorStrings.S_ConnectionStringError), obj.LastGetTimeCopy); + throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name)); } if (obj.Value.State != ConnectionState.Open || DateTime.Now.Subtract(obj.LastReturnTime).TotalSeconds > 60 && (await obj.Value.PingAsync()) == false) diff --git a/Providers/FreeSql.Provider.Odbc/Default/OdbcCodeFirst.cs b/Providers/FreeSql.Provider.Odbc/Default/OdbcCodeFirst.cs index 6f7c5de5f..b463c8646 100644 --- a/Providers/FreeSql.Provider.Odbc/Default/OdbcCodeFirst.cs +++ b/Providers/FreeSql.Provider.Odbc/Default/OdbcCodeFirst.cs @@ -90,6 +90,6 @@ public override DbInfoResult GetDbInfo(Type type) return null; } - protected override string GetComparisonDDLStatements(params TypeSchemaAndName[] objects) => throw new NotImplementedException($"FreeSql.Odbc.Default {CoreStrings.S_Not_Implemented_Feature}"); + protected override string GetComparisonDDLStatements(params TypeSchemaAndName[] objects) => throw new NotImplementedException($"FreeSql.Odbc.Default {CoreErrorStrings.S_Not_Implemented_Feature}"); } } \ No newline at end of file diff --git a/Providers/FreeSql.Provider.Odbc/Default/OdbcProvider.cs b/Providers/FreeSql.Provider.Odbc/Default/OdbcProvider.cs index 152b5e018..af4992204 100644 --- a/Providers/FreeSql.Provider.Odbc/Default/OdbcProvider.cs +++ b/Providers/FreeSql.Provider.Odbc/Default/OdbcProvider.cs @@ -20,7 +20,7 @@ public class OdbcProvider : BaseDbProvider, IFreeSql public override IDelete CreateDeleteProvider(object dywhere) => new OdbcDelete(this, this.InternalCommonUtils, this.InternalCommonExpression, dywhere); public override IInsertOrUpdate CreateInsertOrUpdateProvider() => throw new NotImplementedException(); - public override IDbFirst DbFirst => throw new NotImplementedException($"FreeSql.Odbc.Default {CoreStrings.S_Not_Implemented_Feature}"); + public override IDbFirst DbFirst => throw new NotImplementedException($"FreeSql.Odbc.Default {CoreErrorStrings.S_Not_Implemented_Feature}"); /// /// 生成一个普通访问功能的 IFreeSql 对象,用来访问 odbc diff --git a/Providers/FreeSql.Provider.Odbc/MySql/Curd/OdbcMySqlInsertOrUpdate.cs b/Providers/FreeSql.Provider.Odbc/MySql/Curd/OdbcMySqlInsertOrUpdate.cs index f7bad9d63..3c7c2b94b 100644 --- a/Providers/FreeSql.Provider.Odbc/MySql/Curd/OdbcMySqlInsertOrUpdate.cs +++ b/Providers/FreeSql.Provider.Odbc/MySql/Curd/OdbcMySqlInsertOrUpdate.cs @@ -86,7 +86,7 @@ string getInsertSql(List data, bool flagInsert, bool noneParameter) } else { - if (_tempPrimarys.Any() == false) throw new Exception(CoreStrings.Entity_Must_Primary_Key("fsql.InsertOrUpdate + IfExistsDoNothing + MySql ", _table.CsName)); + if (_tempPrimarys.Any() == false) throw new Exception(CoreErrorStrings.Entity_Must_Primary_Key("fsql.InsertOrUpdate + IfExistsDoNothing + MySql ", _table.CsName)); sql = insert.ToSqlValuesOrSelectUnionAll(); if (sql?.StartsWith("INSERT INTO ") == true) sql = $"INSERT IGNORE INTO {sql.Substring(12)}"; diff --git a/Providers/FreeSql.Provider.Odbc/MySql/Curd/OdbcMySqlOnDuplicateKeyUpdate.cs b/Providers/FreeSql.Provider.Odbc/MySql/Curd/OdbcMySqlOnDuplicateKeyUpdate.cs index 79bec80f4..8d689597f 100644 --- a/Providers/FreeSql.Provider.Odbc/MySql/Curd/OdbcMySqlOnDuplicateKeyUpdate.cs +++ b/Providers/FreeSql.Provider.Odbc/MySql/Curd/OdbcMySqlOnDuplicateKeyUpdate.cs @@ -17,7 +17,7 @@ public class OdbcMySqlOnDuplicateKeyUpdate where T1 : class public OdbcMySqlOnDuplicateKeyUpdate(IInsert insert) { _mysqlInsert = insert as OdbcMySqlInsert; - if (_mysqlInsert == null) throw new Exception(CoreStrings.S_Features_Unique("OnDuplicateKeyUpdate", "Odbc/MySql")); + if (_mysqlInsert == null) throw new Exception(CoreErrorStrings.S_Features_Unique("OnDuplicateKeyUpdate", "Odbc/MySql")); if (_mysqlInsert._noneParameterFlag == "c") _mysqlInsert._noneParameterFlag = "cu"; } diff --git a/Providers/FreeSql.Provider.Odbc/MySql/OdbcMySqlAdo/OdbcMySqlAdo.cs b/Providers/FreeSql.Provider.Odbc/MySql/OdbcMySqlAdo/OdbcMySqlAdo.cs index 9cce6250d..618f3008c 100644 --- a/Providers/FreeSql.Provider.Odbc/MySql/OdbcMySqlAdo/OdbcMySqlAdo.cs +++ b/Providers/FreeSql.Provider.Odbc/MySql/OdbcMySqlAdo/OdbcMySqlAdo.cs @@ -31,14 +31,14 @@ public OdbcMySqlAdo(CommonUtils util, string masterConnectionString, string[] sl if (isAdoPool) masterConnectionString = masterConnectionString.Substring("AdoConnectionPool,".Length); if (!string.IsNullOrEmpty(masterConnectionString)) MasterPool = isAdoPool ? - new DbConnectionStringPool(base.DataType, CoreStrings.S_MasterDatabase, () => new OdbcConnection(masterConnectionString)) as IObjectPool : - new OdbcMySqlConnectionPool(CoreStrings.S_MasterDatabase, masterConnectionString, null, null); + new DbConnectionStringPool(base.DataType, CoreErrorStrings.S_MasterDatabase, () => new OdbcConnection(masterConnectionString)) as IObjectPool : + new OdbcMySqlConnectionPool(CoreErrorStrings.S_MasterDatabase, masterConnectionString, null, null); slaveConnectionStrings?.ToList().ForEach(slaveConnectionString => { var slavePool = isAdoPool ? - new DbConnectionStringPool(base.DataType, $"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => new OdbcConnection(slaveConnectionString)) as IObjectPool : - new OdbcMySqlConnectionPool($"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables)); + new DbConnectionStringPool(base.DataType, $"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => new OdbcConnection(slaveConnectionString)) as IObjectPool : + new OdbcMySqlConnectionPool($"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables)); SlavePools.Add(slavePool); }); } diff --git a/Providers/FreeSql.Provider.Odbc/MySql/OdbcMySqlAdo/OdbcMySqlConnectionPool.cs b/Providers/FreeSql.Provider.Odbc/MySql/OdbcMySqlAdo/OdbcMySqlConnectionPool.cs index ee2854e54..99e946438 100644 --- a/Providers/FreeSql.Provider.Odbc/MySql/OdbcMySqlAdo/OdbcMySqlConnectionPool.cs +++ b/Providers/FreeSql.Provider.Odbc/MySql/OdbcMySqlAdo/OdbcMySqlConnectionPool.cs @@ -45,7 +45,7 @@ class OdbcMySqlConnectionPoolPolicy : IPolicy { internal OdbcMySqlConnectionPool _pool; - public string Name { get; set; } = $"MySql OdbcConnection {CoreStrings.S_ObjectPool}"; + public string Name { get; set; } = $"MySql OdbcConnection {CoreErrorStrings.S_ObjectPool}"; public int PoolSize { get; set; } = 100; public TimeSpan SyncGetTimeout { get; set; } = TimeSpan.FromSeconds(10); public TimeSpan IdleTimeout { get; set; } = TimeSpan.FromSeconds(20); @@ -120,8 +120,8 @@ public void OnGet(Object obj) { if (obj.Value == null) { - _pool.SetUnavailable(new Exception(CoreStrings.S_ConnectionStringError), obj.LastGetTimeCopy); - throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name)); + _pool.SetUnavailable(new Exception(CoreErrorStrings.S_ConnectionStringError), obj.LastGetTimeCopy); + throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name)); } if (obj.Value.State != ConnectionState.Open || DateTime.Now.Subtract(obj.LastReturnTime).TotalSeconds > 60 && obj.Value.Ping() == false) @@ -150,8 +150,8 @@ async public Task OnGetAsync(Object obj) { if (obj.Value == null) { - _pool.SetUnavailable(new Exception(CoreStrings.S_ConnectionStringError), obj.LastGetTimeCopy); - throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name)); + _pool.SetUnavailable(new Exception(CoreErrorStrings.S_ConnectionStringError), obj.LastGetTimeCopy); + throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name)); } if (obj.Value.State != ConnectionState.Open || DateTime.Now.Subtract(obj.LastReturnTime).TotalSeconds > 60 && (await obj.Value.PingAsync()) == false) diff --git a/Providers/FreeSql.Provider.Odbc/MySql/OdbcMySqlCodeFirst.cs b/Providers/FreeSql.Provider.Odbc/MySql/OdbcMySqlCodeFirst.cs index 569b5f8fe..885c18253 100644 --- a/Providers/FreeSql.Provider.Odbc/MySql/OdbcMySqlCodeFirst.cs +++ b/Providers/FreeSql.Provider.Odbc/MySql/OdbcMySqlCodeFirst.cs @@ -90,8 +90,8 @@ protected override string GetComparisonDDLStatements(params TypeSchemaAndName[] { if (sb.Length > 0) sb.Append("\r\n"); var tb = obj.tableSchema; - if (tb == null) throw new Exception(CoreStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); - if (tb.Columns.Any() == false) throw new Exception(CoreStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); + if (tb == null) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); + if (tb.Columns.Any() == false) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); var tbname = _commonUtils.SplitTableName(tb.DbName); if (tbname?.Length == 1) tbname = new[] { database, tbname[0] }; diff --git a/Providers/FreeSql.Provider.Odbc/MySql/OdbcMySqlExpression.cs b/Providers/FreeSql.Provider.Odbc/MySql/OdbcMySqlExpression.cs index a82cc4bfd..063f548b3 100644 --- a/Providers/FreeSql.Provider.Odbc/MySql/OdbcMySqlExpression.cs +++ b/Providers/FreeSql.Provider.Odbc/MySql/OdbcMySqlExpression.cs @@ -250,7 +250,7 @@ public override string ExpressionLambdaToSqlCallString(MethodCallExpression exp, return _common.StringConcat(concatNewArrExp.Expressions.Select(a => getExp(a)).ToArray(), null); return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null); case "Format": - if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); + if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreErrorStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); if (exp.Arguments.Count == 1) return ExpressionLambdaToSql(exp.Arguments[0], tsc); var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ? (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0); diff --git a/Providers/FreeSql.Provider.Odbc/Oracle/Curd/OdbcOracleDelete.cs b/Providers/FreeSql.Provider.Odbc/Oracle/Curd/OdbcOracleDelete.cs index daea93653..11e35f3db 100644 --- a/Providers/FreeSql.Provider.Odbc/Oracle/Curd/OdbcOracleDelete.cs +++ b/Providers/FreeSql.Provider.Odbc/Oracle/Curd/OdbcOracleDelete.cs @@ -16,11 +16,11 @@ public OdbcOracleDelete(IFreeSql orm, CommonUtils commonUtils, CommonExpression { } - public override List ExecuteDeleted() => throw new NotImplementedException($"FreeSql.Odbc.Oracle {CoreStrings.S_Not_Implemented_Feature}"); + public override List ExecuteDeleted() => throw new NotImplementedException($"FreeSql.Odbc.Oracle {CoreErrorStrings.S_Not_Implemented_Feature}"); #if net40 #else - public override Task> ExecuteDeletedAsync(CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Odbc.Oracle {CoreStrings.S_Not_Implemented_Feature}"); + public override Task> ExecuteDeletedAsync(CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Odbc.Oracle {CoreErrorStrings.S_Not_Implemented_Feature}"); #endif } } diff --git a/Providers/FreeSql.Provider.Odbc/Oracle/Curd/OdbcOracleInsertOrUpdate.cs b/Providers/FreeSql.Provider.Odbc/Oracle/Curd/OdbcOracleInsertOrUpdate.cs index 72da5a972..fe9c8769d 100644 --- a/Providers/FreeSql.Provider.Odbc/Oracle/Curd/OdbcOracleInsertOrUpdate.cs +++ b/Providers/FreeSql.Provider.Odbc/Oracle/Curd/OdbcOracleInsertOrUpdate.cs @@ -32,7 +32,7 @@ public override string ToSql() string getMergeSql(List data) { - if (_tempPrimarys.Any() == false) throw new Exception(CoreStrings.InsertOrUpdate_Must_Primary_Key(_table.CsName)); + if (_tempPrimarys.Any() == false) throw new Exception(CoreErrorStrings.InsertOrUpdate_Must_Primary_Key(_table.CsName)); var tempPrimaryIsIdentity = _tempPrimarys.Any(b => b.Attribute.IsIdentity); var sb = new StringBuilder().Append("MERGE INTO ").Append(_commonUtils.QuoteSqlName(TableRuleInvoke())).Append(" t1 \r\nUSING ("); diff --git a/Providers/FreeSql.Provider.Odbc/Oracle/Curd/OdbcOracleUpdate.cs b/Providers/FreeSql.Provider.Odbc/Oracle/Curd/OdbcOracleUpdate.cs index c03859260..8df04ab3d 100644 --- a/Providers/FreeSql.Provider.Odbc/Oracle/Curd/OdbcOracleUpdate.cs +++ b/Providers/FreeSql.Provider.Odbc/Oracle/Curd/OdbcOracleUpdate.cs @@ -22,7 +22,7 @@ public OdbcOracleUpdate(IFreeSql orm, CommonUtils commonUtils, CommonExpression public override int ExecuteAffrows() => base.SplitExecuteAffrows(_batchRowsLimit > 0 ? _batchRowsLimit : 200, _batchParameterLimit > 0 ? _batchParameterLimit : 999); protected override List ExecuteUpdated(IEnumerable columns) => base.SplitExecuteUpdated(_batchRowsLimit > 0 ? _batchRowsLimit : 200, _batchParameterLimit > 0 ? _batchParameterLimit : 999, columns); - protected override List RawExecuteUpdated(IEnumerable columns) => throw new NotImplementedException($"FreeSql.Odbc.Oracle {CoreStrings.S_Not_Implemented_Feature}"); + protected override List RawExecuteUpdated(IEnumerable columns) => throw new NotImplementedException($"FreeSql.Odbc.Oracle {CoreErrorStrings.S_Not_Implemented_Feature}"); protected override void ToSqlCase(StringBuilder caseWhen, ColumnInfo[] primarys) { @@ -68,7 +68,7 @@ protected override void ToSqlWhen(StringBuilder sb, ColumnInfo[] primarys, objec public override Task ExecuteAffrowsAsync(CancellationToken cancellationToken = default) => base.SplitExecuteAffrowsAsync(_batchRowsLimit > 0 ? _batchRowsLimit : 200, _batchParameterLimit > 0 ? _batchParameterLimit : 999, cancellationToken); protected override Task> ExecuteUpdatedAsync(IEnumerable columns, CancellationToken cancellationToken = default) => base.SplitExecuteUpdatedAsync(_batchRowsLimit > 0 ? _batchRowsLimit : 200, _batchParameterLimit > 0 ? _batchParameterLimit : 999, columns, cancellationToken); - protected override Task> RawExecuteUpdatedAsync(IEnumerable columns, CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Odbc.Oracle {CoreStrings.S_Not_Implemented_Feature}"); + protected override Task> RawExecuteUpdatedAsync(IEnumerable columns, CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Odbc.Oracle {CoreErrorStrings.S_Not_Implemented_Feature}"); #endif } } diff --git a/Providers/FreeSql.Provider.Odbc/Oracle/OdbcOracleAdo/OdbcOracleAdo.cs b/Providers/FreeSql.Provider.Odbc/Oracle/OdbcOracleAdo/OdbcOracleAdo.cs index 789f96f4a..e5ec0a496 100644 --- a/Providers/FreeSql.Provider.Odbc/Oracle/OdbcOracleAdo/OdbcOracleAdo.cs +++ b/Providers/FreeSql.Provider.Odbc/Oracle/OdbcOracleAdo/OdbcOracleAdo.cs @@ -30,14 +30,14 @@ public OdbcOracleAdo(CommonUtils util, string masterConnectionString, string[] s if (isAdoPool) masterConnectionString = masterConnectionString.Substring("AdoConnectionPool,".Length); if (!string.IsNullOrEmpty(masterConnectionString)) MasterPool = isAdoPool ? - new DbConnectionStringPool(base.DataType, CoreStrings.S_MasterDatabase, () => new OdbcConnection(masterConnectionString)) as IObjectPool : - new OdbcOracleConnectionPool(CoreStrings.S_MasterDatabase, masterConnectionString, null, null); + new DbConnectionStringPool(base.DataType, CoreErrorStrings.S_MasterDatabase, () => new OdbcConnection(masterConnectionString)) as IObjectPool : + new OdbcOracleConnectionPool(CoreErrorStrings.S_MasterDatabase, masterConnectionString, null, null); slaveConnectionStrings?.ToList().ForEach(slaveConnectionString => { var slavePool = isAdoPool ? - new DbConnectionStringPool(base.DataType, $"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => new OdbcConnection(slaveConnectionString)) as IObjectPool : - new OdbcOracleConnectionPool($"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables)); + new DbConnectionStringPool(base.DataType, $"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => new OdbcConnection(slaveConnectionString)) as IObjectPool : + new OdbcOracleConnectionPool($"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables)); SlavePools.Add(slavePool); }); } diff --git a/Providers/FreeSql.Provider.Odbc/Oracle/OdbcOracleAdo/OdbcOracleConnectionPool.cs b/Providers/FreeSql.Provider.Odbc/Oracle/OdbcOracleAdo/OdbcOracleConnectionPool.cs index 30bc350c5..d279d94cd 100644 --- a/Providers/FreeSql.Provider.Odbc/Oracle/OdbcOracleAdo/OdbcOracleConnectionPool.cs +++ b/Providers/FreeSql.Provider.Odbc/Oracle/OdbcOracleAdo/OdbcOracleConnectionPool.cs @@ -56,7 +56,7 @@ class OdbcOracleConnectionPoolPolicy : IPolicy { internal OdbcOracleConnectionPool _pool; - public string Name { get; set; } = $"Oracle OdbcConnection {CoreStrings.S_ObjectPool}"; + public string Name { get; set; } = $"Oracle OdbcConnection {CoreErrorStrings.S_ObjectPool}"; public int PoolSize { get; set; } = 100; public TimeSpan SyncGetTimeout { get; set; } = TimeSpan.FromSeconds(10); public TimeSpan IdleTimeout { get; set; } = TimeSpan.FromSeconds(20); @@ -131,8 +131,8 @@ public void OnGet(Object obj) { if (obj.Value == null) { - _pool.SetUnavailable(new Exception(CoreStrings.S_ConnectionStringError), obj.LastGetTimeCopy); - throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name)); + _pool.SetUnavailable(new Exception(CoreErrorStrings.S_ConnectionStringError), obj.LastGetTimeCopy); + throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name)); } if (obj.Value.State != ConnectionState.Open || DateTime.Now.Subtract(obj.LastReturnTime).TotalSeconds > 60 && obj.Value.Ping() == false) @@ -161,8 +161,8 @@ async public Task OnGetAsync(Object obj) { if (obj.Value == null) { - _pool.SetUnavailable(new Exception(CoreStrings.S_ConnectionStringError), obj.LastGetTimeCopy); - throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name)); + _pool.SetUnavailable(new Exception(CoreErrorStrings.S_ConnectionStringError), obj.LastGetTimeCopy); + throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name)); } if (obj.Value.State != ConnectionState.Open || DateTime.Now.Subtract(obj.LastReturnTime).TotalSeconds > 60 && (await obj.Value.PingAsync()) == false) diff --git a/Providers/FreeSql.Provider.Odbc/Oracle/OdbcOracleCodeFirst.cs b/Providers/FreeSql.Provider.Odbc/Oracle/OdbcOracleCodeFirst.cs index 35fb0fd9b..3996e9a5a 100644 --- a/Providers/FreeSql.Provider.Odbc/Oracle/OdbcOracleCodeFirst.cs +++ b/Providers/FreeSql.Provider.Odbc/Oracle/OdbcOracleCodeFirst.cs @@ -93,8 +93,8 @@ protected override string GetComparisonDDLStatements(params TypeSchemaAndName[] { if (sb.Length > 0) sb.Append("\r\n"); var tb = obj.tableSchema; - if (tb == null) throw new Exception(CoreStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); - if (tb.Columns.Any() == false) throw new Exception(CoreStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); + if (tb == null) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); + if (tb.Columns.Any() == false) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); var tbname = _commonUtils.SplitTableName(tb.DbName); if (tbname?.Length == 1) tbname = new[] { userId, tbname[0] }; @@ -115,7 +115,7 @@ protected override string GetComparisonDDLStatements(params TypeSchemaAndName[] //codefirst 不支持表名中带 . if (string.Compare(tbname[0], userId) != 0 && _orm.Ado.ExecuteScalar(CommandType.Text, _commonUtils.FormatSql(" select 1 from sys.dba_users where username={0}", tbname[0])) == null) //创建数据库 - throw new NotImplementedException(CoreStrings.S_Oracle_NotSupport_TablespaceSchemas(tbname[0])); + throw new NotImplementedException(CoreErrorStrings.S_Oracle_NotSupport_TablespaceSchemas(tbname[0])); var sbalter = new StringBuilder(); var istmpatler = false; //创建临时表,导入数据,删除旧表,修改 diff --git a/Providers/FreeSql.Provider.Odbc/Oracle/OdbcOracleDbFirst.cs b/Providers/FreeSql.Provider.Odbc/Oracle/OdbcOracleDbFirst.cs index 8037ee9e8..78fc7e913 100644 --- a/Providers/FreeSql.Provider.Odbc/Oracle/OdbcOracleDbFirst.cs +++ b/Providers/FreeSql.Provider.Odbc/Oracle/OdbcOracleDbFirst.cs @@ -113,7 +113,7 @@ OdbcType GetSqlDbType(DbColumnInfo column) if (dbfull != null) _dicDbToCs.TryAdd(dbfull, _dicDbToCs["nvarchar2(255)"]); return OdbcType.NVarChar; } - throw new NotImplementedException(CoreStrings.S_TypeMappingNotImplemented(column.DbTypeTextFull)); + throw new NotImplementedException(CoreErrorStrings.S_TypeMappingNotImplemented(column.DbTypeTextFull)); } static ConcurrentDictionary _dicDbToCs = new ConcurrentDictionary(StringComparer.CurrentCultureIgnoreCase); diff --git a/Providers/FreeSql.Provider.Odbc/Oracle/OdbcOracleExpression.cs b/Providers/FreeSql.Provider.Odbc/Oracle/OdbcOracleExpression.cs index dabb589a0..bd6a1c9c7 100644 --- a/Providers/FreeSql.Provider.Odbc/Oracle/OdbcOracleExpression.cs +++ b/Providers/FreeSql.Provider.Odbc/Oracle/OdbcOracleExpression.cs @@ -254,7 +254,7 @@ public override string ExpressionLambdaToSqlCallString(MethodCallExpression exp, return _common.StringConcat(concatNewArrExp.Expressions.Select(a => getExp(a)).ToArray(), null); return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null); case "Format": - if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); + if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreErrorStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ? (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0); //3个 {} 时,Arguments 解析出来是分开的 diff --git a/Providers/FreeSql.Provider.Odbc/PostgreSQL/Curd/OdbcPostgreSQLOnConflictDoUpdate.cs b/Providers/FreeSql.Provider.Odbc/PostgreSQL/Curd/OdbcPostgreSQLOnConflictDoUpdate.cs index 23562c66a..416929922 100644 --- a/Providers/FreeSql.Provider.Odbc/PostgreSQL/Curd/OdbcPostgreSQLOnConflictDoUpdate.cs +++ b/Providers/FreeSql.Provider.Odbc/PostgreSQL/Curd/OdbcPostgreSQLOnConflictDoUpdate.cs @@ -24,7 +24,7 @@ public class OdbcPostgreSQLOnConflictDoUpdate where T1 : class public OdbcPostgreSQLOnConflictDoUpdate(IInsert insert, Expression> columns = null) { _pgsqlInsert = insert as OdbcPostgreSQLInsert; - if (_pgsqlInsert == null) throw new Exception(CoreStrings.S_Features_Unique("OnConflictDoUpdate", "Odbc/PostgreSQL")); + if (_pgsqlInsert == null) throw new Exception(CoreErrorStrings.S_Features_Unique("OnConflictDoUpdate", "Odbc/PostgreSQL")); if (_pgsqlInsert._noneParameterFlag == "c") _pgsqlInsert._noneParameterFlag = "cu"; if (columns != null) @@ -38,7 +38,7 @@ public OdbcPostgreSQLOnConflictDoUpdate(IInsert insert, Expression new OdbcConnection(masterConnectionString)) as IObjectPool : - new OdbcPostgreSQLConnectionPool(CoreStrings.S_MasterDatabase, masterConnectionString, null, null); + new DbConnectionStringPool(base.DataType, CoreErrorStrings.S_MasterDatabase, () => new OdbcConnection(masterConnectionString)) as IObjectPool : + new OdbcPostgreSQLConnectionPool(CoreErrorStrings.S_MasterDatabase, masterConnectionString, null, null); slaveConnectionStrings?.ToList().ForEach(slaveConnectionString => { var slavePool = isAdoPool ? - new DbConnectionStringPool(base.DataType, $"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => new OdbcConnection(slaveConnectionString)) as IObjectPool : - new OdbcPostgreSQLConnectionPool($"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables)); + new DbConnectionStringPool(base.DataType, $"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => new OdbcConnection(slaveConnectionString)) as IObjectPool : + new OdbcPostgreSQLConnectionPool($"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables)); SlavePools.Add(slavePool); }); } diff --git a/Providers/FreeSql.Provider.Odbc/PostgreSQL/OdbcPostgreSQLAdo/OdbcPostgreSQLConnectionPool.cs b/Providers/FreeSql.Provider.Odbc/PostgreSQL/OdbcPostgreSQLAdo/OdbcPostgreSQLConnectionPool.cs index b1797fba7..4154e7cac 100644 --- a/Providers/FreeSql.Provider.Odbc/PostgreSQL/OdbcPostgreSQLAdo/OdbcPostgreSQLConnectionPool.cs +++ b/Providers/FreeSql.Provider.Odbc/PostgreSQL/OdbcPostgreSQLAdo/OdbcPostgreSQLConnectionPool.cs @@ -46,7 +46,7 @@ class OdbcPostgreSQLConnectionPoolPolicy : IPolicy { internal OdbcPostgreSQLConnectionPool _pool; - public string Name { get; set; } = $"PostgreSQL OdbcConnection {CoreStrings.S_ObjectPool}"; + public string Name { get; set; } = $"PostgreSQL OdbcConnection {CoreErrorStrings.S_ObjectPool}"; public int PoolSize { get; set; } = 50; public TimeSpan SyncGetTimeout { get; set; } = TimeSpan.FromSeconds(10); public TimeSpan IdleTimeout { get; set; } = TimeSpan.FromSeconds(20); @@ -121,8 +121,8 @@ public void OnGet(Object obj) { if (obj.Value == null) { - _pool.SetUnavailable(new Exception(CoreStrings.S_ConnectionStringError), obj.LastGetTimeCopy); - throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name)); + _pool.SetUnavailable(new Exception(CoreErrorStrings.S_ConnectionStringError), obj.LastGetTimeCopy); + throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name)); } if (obj.Value.State != ConnectionState.Open || DateTime.Now.Subtract(obj.LastReturnTime).TotalSeconds > 60 && obj.Value.Ping() == false) @@ -151,8 +151,8 @@ async public Task OnGetAsync(Object obj) { if (obj.Value == null) { - _pool.SetUnavailable(new Exception(CoreStrings.S_ConnectionStringError), obj.LastGetTimeCopy); - throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name)); + _pool.SetUnavailable(new Exception(CoreErrorStrings.S_ConnectionStringError), obj.LastGetTimeCopy); + throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name)); } if (obj.Value.State != ConnectionState.Open || DateTime.Now.Subtract(obj.LastReturnTime).TotalSeconds > 60 && (await obj.Value.PingAsync()) == false) diff --git a/Providers/FreeSql.Provider.Odbc/PostgreSQL/OdbcPostgreSQLCodeFirst.cs b/Providers/FreeSql.Provider.Odbc/PostgreSQL/OdbcPostgreSQLCodeFirst.cs index 07ab82e9a..4e9284a91 100644 --- a/Providers/FreeSql.Provider.Odbc/PostgreSQL/OdbcPostgreSQLCodeFirst.cs +++ b/Providers/FreeSql.Provider.Odbc/PostgreSQL/OdbcPostgreSQLCodeFirst.cs @@ -93,8 +93,8 @@ protected override string GetComparisonDDLStatements(params TypeSchemaAndName[] { if (sb.Length > 0) sb.Append("\r\n"); var tb = obj.tableSchema; - if (tb == null) throw new Exception(CoreStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); - if (tb.Columns.Any() == false) throw new Exception(CoreStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); + if (tb == null) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); + if (tb.Columns.Any() == false) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); var tbname = _commonUtils.SplitTableName(tb.DbName); if (tbname?.Length == 1) tbname = new[] { "public", tbname[0] }; diff --git a/Providers/FreeSql.Provider.Odbc/PostgreSQL/OdbcPostgreSQLExpression.cs b/Providers/FreeSql.Provider.Odbc/PostgreSQL/OdbcPostgreSQLExpression.cs index 4427a5a46..10b5ccf78 100644 --- a/Providers/FreeSql.Provider.Odbc/PostgreSQL/OdbcPostgreSQLExpression.cs +++ b/Providers/FreeSql.Provider.Odbc/PostgreSQL/OdbcPostgreSQLExpression.cs @@ -338,7 +338,7 @@ public override string ExpressionLambdaToSqlCallString(MethodCallExpression exp, return _common.StringConcat(concatNewArrExp.Expressions.Select(a => getExp(a)).ToArray(), null); return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null); case "Format": - if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); + if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreErrorStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ? (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0); //3个 {} 时,Arguments 解析出来是分开的 diff --git a/Providers/FreeSql.Provider.Odbc/SqlServer/Curd/OdbcSqlServerDelete.cs b/Providers/FreeSql.Provider.Odbc/SqlServer/Curd/OdbcSqlServerDelete.cs index 868f463b6..c3d63222e 100644 --- a/Providers/FreeSql.Provider.Odbc/SqlServer/Curd/OdbcSqlServerDelete.cs +++ b/Providers/FreeSql.Provider.Odbc/SqlServer/Curd/OdbcSqlServerDelete.cs @@ -40,7 +40,7 @@ public override List ExecuteDeleted() } var sql = sb.ToString(); var validx = sql.IndexOf(" WHERE "); - if (validx == -1) throw new ArgumentException(CoreStrings.S_NotFound_Name("WHERE")); + if (validx == -1) throw new ArgumentException(CoreErrorStrings.S_NotFound_Name("WHERE")); sql = sb.Clear().Append(sql.Substring(0, validx)) .Append(sbret) .Append(sql.Substring(validx)).ToString(); @@ -97,7 +97,7 @@ await ToSqlFetchAsync(async sb => } var sql = sb.ToString(); var validx = sql.IndexOf(" WHERE "); - if (validx == -1) throw new ArgumentException(CoreStrings.S_NotFound_Name("WHERE")); + if (validx == -1) throw new ArgumentException(CoreErrorStrings.S_NotFound_Name("WHERE")); sql = sb.Clear().Append(sql.Substring(0, validx)) .Append(sbret) .Append(sql.Substring(validx)).ToString(); diff --git a/Providers/FreeSql.Provider.Odbc/SqlServer/Curd/OdbcSqlServerInsert.cs b/Providers/FreeSql.Provider.Odbc/SqlServer/Curd/OdbcSqlServerInsert.cs index e4650e9ea..325aa4aad 100644 --- a/Providers/FreeSql.Provider.Odbc/SqlServer/Curd/OdbcSqlServerInsert.cs +++ b/Providers/FreeSql.Provider.Odbc/SqlServer/Curd/OdbcSqlServerInsert.cs @@ -69,14 +69,14 @@ protected override List RawExecuteInserted() if ((_commonUtils as OdbcSqlServerUtils).ServerVersion > 10) { var validx = sql.IndexOf(") VALUES"); - if (validx == -1) throw new ArgumentException(CoreStrings.S_NotFound_Name("VALUES")); + if (validx == -1) throw new ArgumentException(CoreErrorStrings.S_NotFound_Name("VALUES")); sb.Insert(0, sql.Substring(0, validx + 1)); sb.Append(sql.Substring(validx + 1)); } else { var validx = sql.IndexOf(") SELECT "); - if (validx == -1) throw new ArgumentException(CoreStrings.S_NotFound_Name("SELECT")); + if (validx == -1) throw new ArgumentException(CoreErrorStrings.S_NotFound_Name("SELECT")); sb.Insert(0, sql.Substring(0, validx + 1)); sb.Append(sql.Substring(validx + 1)); } @@ -153,14 +153,14 @@ async protected override Task> RawExecuteInsertedAsync(CancellationToke if ((_commonUtils as OdbcSqlServerUtils).ServerVersion > 10) { var validx = sql.IndexOf(") VALUES"); - if (validx == -1) throw new ArgumentException(CoreStrings.S_NotFound_Name("VALUES")); + if (validx == -1) throw new ArgumentException(CoreErrorStrings.S_NotFound_Name("VALUES")); sb.Insert(0, sql.Substring(0, validx + 1)); sb.Append(sql.Substring(validx + 1)); } else { var validx = sql.IndexOf(") SELECT "); - if (validx == -1) throw new ArgumentException(CoreStrings.S_NotFound_Name("SELECT")); + if (validx == -1) throw new ArgumentException(CoreErrorStrings.S_NotFound_Name("SELECT")); sb.Insert(0, sql.Substring(0, validx + 1)); sb.Append(sql.Substring(validx + 1)); } diff --git a/Providers/FreeSql.Provider.Odbc/SqlServer/Curd/OdbcSqlServerInsertOrUpdate.cs b/Providers/FreeSql.Provider.Odbc/SqlServer/Curd/OdbcSqlServerInsertOrUpdate.cs index 8db1590f7..919c063fc 100644 --- a/Providers/FreeSql.Provider.Odbc/SqlServer/Curd/OdbcSqlServerInsertOrUpdate.cs +++ b/Providers/FreeSql.Provider.Odbc/SqlServer/Curd/OdbcSqlServerInsertOrUpdate.cs @@ -32,7 +32,7 @@ public override string ToSql() string getMergeSql(List data) { - if (_tempPrimarys.Any() == false) throw new Exception(CoreStrings.InsertOrUpdate_Must_Primary_Key(_table.CsName)); + if (_tempPrimarys.Any() == false) throw new Exception(CoreErrorStrings.InsertOrUpdate_Must_Primary_Key(_table.CsName)); var tempPrimaryIsIdentity = _tempPrimarys.Any(b => b.Attribute.IsIdentity); var sb = new StringBuilder(); diff --git a/Providers/FreeSql.Provider.Odbc/SqlServer/Curd/OdbcSqlServerUpdate.cs b/Providers/FreeSql.Provider.Odbc/SqlServer/Curd/OdbcSqlServerUpdate.cs index b131cf71a..43c9e5064 100644 --- a/Providers/FreeSql.Provider.Odbc/SqlServer/Curd/OdbcSqlServerUpdate.cs +++ b/Providers/FreeSql.Provider.Odbc/SqlServer/Curd/OdbcSqlServerUpdate.cs @@ -46,7 +46,7 @@ protected override List RawExecuteUpdated(IEnumerable } var sql = sb.ToString(); var validx = sql.IndexOf(" \r\nWHERE "); - if (validx == -1) throw new ArgumentException(CoreStrings.S_NotFound_Name("WHERE")); + if (validx == -1) throw new ArgumentException(CoreErrorStrings.S_NotFound_Name("WHERE")); sql = sb.Clear().Append(sql.Substring(0, validx)) .Append(sbret) .Append(sql.Substring(validx)).ToString(); diff --git a/Providers/FreeSql.Provider.Odbc/SqlServer/OdbcSqlServerAdo/OdbcSqlServerAdo.cs b/Providers/FreeSql.Provider.Odbc/SqlServer/OdbcSqlServerAdo/OdbcSqlServerAdo.cs index e1aa4038a..931e6377b 100644 --- a/Providers/FreeSql.Provider.Odbc/SqlServer/OdbcSqlServerAdo/OdbcSqlServerAdo.cs +++ b/Providers/FreeSql.Provider.Odbc/SqlServer/OdbcSqlServerAdo/OdbcSqlServerAdo.cs @@ -30,14 +30,14 @@ public OdbcSqlServerAdo(CommonUtils util, string masterConnectionString, string[ if (isAdoPool) masterConnectionString = masterConnectionString.Substring("AdoConnectionPool,".Length); if (!string.IsNullOrEmpty(masterConnectionString)) MasterPool = isAdoPool ? - new DbConnectionStringPool(base.DataType, CoreStrings.S_MasterDatabase, () => new OdbcConnection(masterConnectionString)) as IObjectPool : - new OdbcSqlServerConnectionPool(CoreStrings.S_MasterDatabase, masterConnectionString, null, null); + new DbConnectionStringPool(base.DataType, CoreErrorStrings.S_MasterDatabase, () => new OdbcConnection(masterConnectionString)) as IObjectPool : + new OdbcSqlServerConnectionPool(CoreErrorStrings.S_MasterDatabase, masterConnectionString, null, null); slaveConnectionStrings?.ToList().ForEach(slaveConnectionString => { var slavePool = isAdoPool ? - new DbConnectionStringPool(base.DataType, $"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => new OdbcConnection(slaveConnectionString)) as IObjectPool : - new OdbcSqlServerConnectionPool($"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables)); + new DbConnectionStringPool(base.DataType, $"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => new OdbcConnection(slaveConnectionString)) as IObjectPool : + new OdbcSqlServerConnectionPool($"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables)); SlavePools.Add(slavePool); }); } diff --git a/Providers/FreeSql.Provider.Odbc/SqlServer/OdbcSqlServerAdo/OdbcSqlServerConnectionPool.cs b/Providers/FreeSql.Provider.Odbc/SqlServer/OdbcSqlServerAdo/OdbcSqlServerConnectionPool.cs index 9b2e0a3cd..5474bddce 100644 --- a/Providers/FreeSql.Provider.Odbc/SqlServer/OdbcSqlServerAdo/OdbcSqlServerConnectionPool.cs +++ b/Providers/FreeSql.Provider.Odbc/SqlServer/OdbcSqlServerAdo/OdbcSqlServerConnectionPool.cs @@ -45,7 +45,7 @@ class OdbcSqlServerConnectionPoolPolicy : IPolicy { internal OdbcSqlServerConnectionPool _pool; - public string Name { get; set; } = $"SqlServer OdbcConnection {CoreStrings.S_ObjectPool}"; + public string Name { get; set; } = $"SqlServer OdbcConnection {CoreErrorStrings.S_ObjectPool}"; public int PoolSize { get; set; } = 100; public TimeSpan SyncGetTimeout { get; set; } = TimeSpan.FromSeconds(10); public TimeSpan IdleTimeout { get; set; } = TimeSpan.FromSeconds(20); @@ -121,8 +121,8 @@ public void OnGet(Object obj) if (obj.Value == null) { - _pool.SetUnavailable(new Exception(CoreStrings.S_ConnectionStringError), obj.LastGetTimeCopy); - throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name)); + _pool.SetUnavailable(new Exception(CoreErrorStrings.S_ConnectionStringError), obj.LastGetTimeCopy); + throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name)); } if (obj.Value.State != ConnectionState.Open || DateTime.Now.Subtract(obj.LastReturnTime).TotalSeconds > 60 && obj.Value.Ping() == false) @@ -152,8 +152,8 @@ async public Task OnGetAsync(Object obj) if (obj.Value == null) { - _pool.SetUnavailable(new Exception(CoreStrings.S_ConnectionStringError), obj.LastGetTimeCopy); - throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name)); + _pool.SetUnavailable(new Exception(CoreErrorStrings.S_ConnectionStringError), obj.LastGetTimeCopy); + throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name)); } if (obj.Value.State != ConnectionState.Open || DateTime.Now.Subtract(obj.LastReturnTime).TotalSeconds > 60 && (await obj.Value.PingAsync()) == false) diff --git a/Providers/FreeSql.Provider.Odbc/SqlServer/OdbcSqlServerCodeFirst.cs b/Providers/FreeSql.Provider.Odbc/SqlServer/OdbcSqlServerCodeFirst.cs index 470a30016..eca943764 100644 --- a/Providers/FreeSql.Provider.Odbc/SqlServer/OdbcSqlServerCodeFirst.cs +++ b/Providers/FreeSql.Provider.Odbc/SqlServer/OdbcSqlServerCodeFirst.cs @@ -150,8 +150,8 @@ protected override string GetComparisonDDLStatements(params TypeSchemaAndName[] { if (sb.Length > 0) sb.Append("\r\n"); var tb = obj.tableSchema; - if (tb == null) throw new Exception(CoreStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); - if (tb.Columns.Any() == false) throw new Exception(CoreStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); + if (tb == null) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); + if (tb.Columns.Any() == false) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); var tbname = _commonUtils.SplitTableName(tb.DbName); if (tbname?.Length == 1) tbname = new[] { database, "dbo", tbname[0] }; if (tbname?.Length == 2) tbname = new[] { database, tbname[0], tbname[1] }; diff --git a/Providers/FreeSql.Provider.Odbc/SqlServer/OdbcSqlServerExpression.cs b/Providers/FreeSql.Provider.Odbc/SqlServer/OdbcSqlServerExpression.cs index 6720d1c75..073a377f0 100644 --- a/Providers/FreeSql.Provider.Odbc/SqlServer/OdbcSqlServerExpression.cs +++ b/Providers/FreeSql.Provider.Odbc/SqlServer/OdbcSqlServerExpression.cs @@ -260,7 +260,7 @@ public override string ExpressionLambdaToSqlCallString(MethodCallExpression exp, return _common.StringConcat(concatNewArrExp.Expressions.Select(a => getExp(a)).ToArray(), concatNewArrExp.Expressions.Select(a => a.Type).ToArray()); return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), exp.Arguments.Select(a => a.Type).ToArray()); case "Format": - if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); + if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreErrorStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); var expArgs0 = ExpressionLambdaToSql(exp.Arguments[0], tsc); if (exp.Arguments.Count == 1) return expArgs0; var nchar = expArgs0.StartsWith("N'") ? "N" : ""; diff --git a/Providers/FreeSql.Provider.Oracle/Curd/OracleDelete.cs b/Providers/FreeSql.Provider.Oracle/Curd/OracleDelete.cs index b823251ae..e0605a375 100644 --- a/Providers/FreeSql.Provider.Oracle/Curd/OracleDelete.cs +++ b/Providers/FreeSql.Provider.Oracle/Curd/OracleDelete.cs @@ -16,11 +16,11 @@ public OracleDelete(IFreeSql orm, CommonUtils commonUtils, CommonExpression comm { } - public override List ExecuteDeleted() => throw new NotImplementedException($"FreeSql.Provider.Oracle {CoreStrings.S_Not_Implemented_Feature}"); + public override List ExecuteDeleted() => throw new NotImplementedException($"FreeSql.Provider.Oracle {CoreErrorStrings.S_Not_Implemented_Feature}"); #if net40 #else - public override Task> ExecuteDeletedAsync(CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Provider.Oracle {CoreStrings.S_Not_Implemented_Feature}"); + public override Task> ExecuteDeletedAsync(CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Provider.Oracle {CoreErrorStrings.S_Not_Implemented_Feature}"); #endif } } diff --git a/Providers/FreeSql.Provider.Oracle/Curd/OracleInsertOrUpdate.cs b/Providers/FreeSql.Provider.Oracle/Curd/OracleInsertOrUpdate.cs index f2612dbbb..1b2e3147d 100644 --- a/Providers/FreeSql.Provider.Oracle/Curd/OracleInsertOrUpdate.cs +++ b/Providers/FreeSql.Provider.Oracle/Curd/OracleInsertOrUpdate.cs @@ -32,7 +32,7 @@ public override string ToSql() string getMergeSql(List data) { - if (_tempPrimarys.Any() == false) throw new Exception(CoreStrings.InsertOrUpdate_Must_Primary_Key(_table.CsName)); + if (_tempPrimarys.Any() == false) throw new Exception(CoreErrorStrings.InsertOrUpdate_Must_Primary_Key(_table.CsName)); var tempPrimaryIsIdentity = _tempPrimarys.Any(b => b.Attribute.IsIdentity); var sb = new StringBuilder().Append("MERGE INTO ").Append(_commonUtils.QuoteSqlName(TableRuleInvoke())).Append(" t1 \r\nUSING ("); diff --git a/Providers/FreeSql.Provider.Oracle/Curd/OracleUpdate.cs b/Providers/FreeSql.Provider.Oracle/Curd/OracleUpdate.cs index 2ec4df710..c6afbe246 100644 --- a/Providers/FreeSql.Provider.Oracle/Curd/OracleUpdate.cs +++ b/Providers/FreeSql.Provider.Oracle/Curd/OracleUpdate.cs @@ -22,7 +22,7 @@ public OracleUpdate(IFreeSql orm, CommonUtils commonUtils, CommonExpression comm public override int ExecuteAffrows() => base.SplitExecuteAffrows(_batchRowsLimit > 0 ? _batchRowsLimit : 200, _batchParameterLimit > 0 ? _batchParameterLimit : 999); protected override List ExecuteUpdated(IEnumerable columns) => base.SplitExecuteUpdated(_batchRowsLimit > 0 ? _batchRowsLimit : 200, _batchParameterLimit > 0 ? _batchParameterLimit : 999, columns); - protected override List RawExecuteUpdated(IEnumerable columns) => throw new NotImplementedException($"FreeSql.Provider.Oracle {CoreStrings.S_Not_Implemented_Feature}"); + protected override List RawExecuteUpdated(IEnumerable columns) => throw new NotImplementedException($"FreeSql.Provider.Oracle {CoreErrorStrings.S_Not_Implemented_Feature}"); protected override void ToSqlCase(StringBuilder caseWhen, ColumnInfo[] primarys) { @@ -68,7 +68,7 @@ protected override void ToSqlWhen(StringBuilder sb, ColumnInfo[] primarys, objec public override Task ExecuteAffrowsAsync(CancellationToken cancellationToken = default) => base.SplitExecuteAffrowsAsync(_batchRowsLimit > 0 ? _batchRowsLimit : 200, _batchParameterLimit > 0 ? _batchParameterLimit : 999, cancellationToken); protected override Task> ExecuteUpdatedAsync(IEnumerable columns, CancellationToken cancellationToken = default) => base.SplitExecuteUpdatedAsync(_batchRowsLimit > 0 ? _batchRowsLimit : 200, _batchParameterLimit > 0 ? _batchParameterLimit : 999, columns, cancellationToken); - protected override Task> RawExecuteUpdatedAsync(IEnumerable columns, CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Provider.Oracle {CoreStrings.S_Not_Implemented_Feature}"); + protected override Task> RawExecuteUpdatedAsync(IEnumerable columns, CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Provider.Oracle {CoreErrorStrings.S_Not_Implemented_Feature}"); #endif } } diff --git a/Providers/FreeSql.Provider.Oracle/OracleAdo/OracleAdo.cs b/Providers/FreeSql.Provider.Oracle/OracleAdo/OracleAdo.cs index d238df703..ec855a8ee 100644 --- a/Providers/FreeSql.Provider.Oracle/OracleAdo/OracleAdo.cs +++ b/Providers/FreeSql.Provider.Oracle/OracleAdo/OracleAdo.cs @@ -30,14 +30,14 @@ public OracleAdo(CommonUtils util, string masterConnectionString, string[] slave if (isAdoPool) masterConnectionString = masterConnectionString.Substring("AdoConnectionPool,".Length); if (!string.IsNullOrEmpty(masterConnectionString)) MasterPool = isAdoPool ? - new DbConnectionStringPool(base.DataType, CoreStrings.S_MasterDatabase, () => OracleConnectionPool.CreateConnection(masterConnectionString)) as IObjectPool : - new OracleConnectionPool(CoreStrings.S_MasterDatabase, masterConnectionString, null, null); + new DbConnectionStringPool(base.DataType, CoreErrorStrings.S_MasterDatabase, () => OracleConnectionPool.CreateConnection(masterConnectionString)) as IObjectPool : + new OracleConnectionPool(CoreErrorStrings.S_MasterDatabase, masterConnectionString, null, null); slaveConnectionStrings?.ToList().ForEach(slaveConnectionString => { var slavePool = isAdoPool ? - new DbConnectionStringPool(base.DataType, $"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => OracleConnectionPool.CreateConnection(slaveConnectionString)) as IObjectPool : - new OracleConnectionPool($"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables)); + new DbConnectionStringPool(base.DataType, $"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => OracleConnectionPool.CreateConnection(slaveConnectionString)) as IObjectPool : + new OracleConnectionPool($"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables)); SlavePools.Add(slavePool); }); } diff --git a/Providers/FreeSql.Provider.Oracle/OracleAdo/OracleConnectionPool.cs b/Providers/FreeSql.Provider.Oracle/OracleAdo/OracleConnectionPool.cs index 628a0a6f2..f1dd621c9 100644 --- a/Providers/FreeSql.Provider.Oracle/OracleAdo/OracleConnectionPool.cs +++ b/Providers/FreeSql.Provider.Oracle/OracleAdo/OracleConnectionPool.cs @@ -66,7 +66,7 @@ class OracleConnectionPoolPolicy : IPolicy { internal OracleConnectionPool _pool; - public string Name { get; set; } = $"Oracle Connection {CoreStrings.S_ObjectPool}"; + public string Name { get; set; } = $"Oracle Connection {CoreErrorStrings.S_ObjectPool}"; public int PoolSize { get; set; } = 100; public TimeSpan SyncGetTimeout { get; set; } = TimeSpan.FromSeconds(10); public TimeSpan IdleTimeout { get; set; } = TimeSpan.FromSeconds(20); @@ -141,8 +141,8 @@ public void OnGet(Object obj) { if (obj.Value == null) { - _pool.SetUnavailable(new Exception(CoreStrings.S_ConnectionStringError), obj.LastGetTimeCopy); - throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name)); + _pool.SetUnavailable(new Exception(CoreErrorStrings.S_ConnectionStringError), obj.LastGetTimeCopy); + throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name)); } if (obj.Value.State != ConnectionState.Open || DateTime.Now.Subtract(obj.LastReturnTime).TotalSeconds > 60 && obj.Value.Ping() == false) @@ -171,8 +171,8 @@ async public Task OnGetAsync(Object obj) { if (obj.Value == null) { - _pool.SetUnavailable(new Exception(CoreStrings.S_ConnectionStringError), obj.LastGetTimeCopy); - throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name)); + _pool.SetUnavailable(new Exception(CoreErrorStrings.S_ConnectionStringError), obj.LastGetTimeCopy); + throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name)); } if (obj.Value.State != ConnectionState.Open || DateTime.Now.Subtract(obj.LastReturnTime).TotalSeconds > 60 && (await obj.Value.PingAsync()) == false) diff --git a/Providers/FreeSql.Provider.Oracle/OracleCodeFirst.cs b/Providers/FreeSql.Provider.Oracle/OracleCodeFirst.cs index c788b97da..ee0a77126 100644 --- a/Providers/FreeSql.Provider.Oracle/OracleCodeFirst.cs +++ b/Providers/FreeSql.Provider.Oracle/OracleCodeFirst.cs @@ -128,8 +128,8 @@ protected override string GetComparisonDDLStatements(params TypeSchemaAndName[] { if (sb.Length > 0) sb.Append("\r\n"); var tb = obj.tableSchema; - if (tb == null) throw new Exception(CoreStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); - if (tb.Columns.Any() == false) throw new Exception(CoreStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); + if (tb == null) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); + if (tb.Columns.Any() == false) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); var tbname = _commonUtils.SplitTableName(tb.DbName); if (tbname?.Length == 1) tbname = new[] { userId, tbname[0] }; @@ -150,7 +150,7 @@ protected override string GetComparisonDDLStatements(params TypeSchemaAndName[] //codefirst 不支持表名中带 . if (string.Compare(tbname[0], userId) != 0 && _orm.Ado.ExecuteScalar(CommandType.Text, _commonUtils.FormatSql(" select 1 from sys.dba_users where username={0}", tbname[0])) == null) //创建数据库 - throw new NotImplementedException(CoreStrings.S_Oracle_NotSupport_TablespaceSchemas(tbname[0])); + throw new NotImplementedException(CoreErrorStrings.S_Oracle_NotSupport_TablespaceSchemas(tbname[0])); var sbalter = new StringBuilder(); var istmpatler = false; //创建临时表,导入数据,删除旧表,修改 diff --git a/Providers/FreeSql.Provider.Oracle/OracleDbFirst.cs b/Providers/FreeSql.Provider.Oracle/OracleDbFirst.cs index 98b7e57b6..18831dab9 100644 --- a/Providers/FreeSql.Provider.Oracle/OracleDbFirst.cs +++ b/Providers/FreeSql.Provider.Oracle/OracleDbFirst.cs @@ -118,7 +118,7 @@ OleDbType GetSqlDbType(DbColumnInfo column) if (dbfull != null) _dicDbToCs.TryAdd(dbfull, _dicDbToCs["nvarchar2(255)"]); return OleDbType.VarChar; } - throw new NotImplementedException(CoreStrings.S_TypeMappingNotImplemented(column.DbTypeTextFull)); + throw new NotImplementedException(CoreErrorStrings.S_TypeMappingNotImplemented(column.DbTypeTextFull)); } #else OracleDbType GetSqlDbType(DbColumnInfo column) @@ -209,7 +209,7 @@ OracleDbType GetSqlDbType(DbColumnInfo column) if (dbfull != null) _dicDbToCs.TryAdd(dbfull, _dicDbToCs["nvarchar2(255)"]); return OracleDbType.NVarchar2; } - throw new NotImplementedException(CoreStrings.S_TypeMappingNotImplemented(column.DbTypeTextFull)); + throw new NotImplementedException(CoreErrorStrings.S_TypeMappingNotImplemented(column.DbTypeTextFull)); } #endif diff --git a/Providers/FreeSql.Provider.Oracle/OracleExpression.cs b/Providers/FreeSql.Provider.Oracle/OracleExpression.cs index 3d5535f5c..827e794b6 100644 --- a/Providers/FreeSql.Provider.Oracle/OracleExpression.cs +++ b/Providers/FreeSql.Provider.Oracle/OracleExpression.cs @@ -254,7 +254,7 @@ public override string ExpressionLambdaToSqlCallString(MethodCallExpression exp, return _common.StringConcat(concatNewArrExp.Expressions.Select(a => getExp(a)).ToArray(), null); return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null); case "Format": - if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); + if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreErrorStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ? (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0); //3个 {} 时,Arguments 解析出来是分开的 diff --git a/Providers/FreeSql.Provider.Oracle/OracleExtensions.cs b/Providers/FreeSql.Provider.Oracle/OracleExtensions.cs index acf824a05..0077d879c 100644 --- a/Providers/FreeSql.Provider.Oracle/OracleExtensions.cs +++ b/Providers/FreeSql.Provider.Oracle/OracleExtensions.cs @@ -139,7 +139,7 @@ static NativeTuple ExecuteOracleBulkCo public static void ExecuteOracleBulkCopy(this IInsert that, OracleBulkCopyOptions copyOptions = OracleBulkCopyOptions.Default, int? batchSize = null, int? bulkCopyTimeout = null) where T : class { var insert = that as FreeSql.Oracle.Curd.OracleInsert; - if (insert == null) throw new Exception(CoreStrings.S_Features_Unique("ExecuteOracleBulkCopy", "Oracle")); + if (insert == null) throw new Exception(CoreErrorStrings.S_Features_Unique("ExecuteOracleBulkCopy", "Oracle")); var dt = that.ToDataTable(); if (dt.Rows.Count == 0) return; @@ -207,7 +207,7 @@ public static void ExecuteOracleBulkCopy(this IInsert that, OracleBulkCopy } else { - throw new NotImplementedException($"ExecuteOracleBulkCopy {CoreStrings.S_Not_Implemented_FeedBack}"); + throw new NotImplementedException($"ExecuteOracleBulkCopy {CoreErrorStrings.S_Not_Implemented_FeedBack}"); } } finally diff --git a/Providers/FreeSql.Provider.PostgreSQL/Curd/OnConflictDoUpdate.cs b/Providers/FreeSql.Provider.PostgreSQL/Curd/OnConflictDoUpdate.cs index 03113e000..230e056d2 100644 --- a/Providers/FreeSql.Provider.PostgreSQL/Curd/OnConflictDoUpdate.cs +++ b/Providers/FreeSql.Provider.PostgreSQL/Curd/OnConflictDoUpdate.cs @@ -24,7 +24,7 @@ public class OnConflictDoUpdate where T1 : class public OnConflictDoUpdate(IInsert insert, Expression> columns = null) { _pgsqlInsert = insert as PostgreSQLInsert; - if (_pgsqlInsert == null) throw new Exception(CoreStrings.S_Features_Unique("OnConflictDoUpdate", "PostgreSQL")); + if (_pgsqlInsert == null) throw new Exception(CoreErrorStrings.S_Features_Unique("OnConflictDoUpdate", "PostgreSQL")); if (_pgsqlInsert._noneParameterFlag == "c") _pgsqlInsert._noneParameterFlag = "cu"; if (columns != null) @@ -38,7 +38,7 @@ public OnConflictDoUpdate(IInsert insert, Expression> colum } if (_tempPrimarys == null || _tempPrimarys.Any() == false) _tempPrimarys = _pgsqlInsert.InternalTable.Primarys; - if (_tempPrimarys.Any() == false) throw new Exception(CoreStrings.S_OnConflictDoUpdate_MustIsPrimary); + if (_tempPrimarys.Any() == false) throw new Exception(CoreErrorStrings.S_OnConflictDoUpdate_MustIsPrimary); } protected void ClearData() diff --git a/Providers/FreeSql.Provider.PostgreSQL/PostgreSQLAdo/PostgreSQLAdo.cs b/Providers/FreeSql.Provider.PostgreSQL/PostgreSQLAdo/PostgreSQLAdo.cs index 7a22f98e9..feb748ce6 100644 --- a/Providers/FreeSql.Provider.PostgreSQL/PostgreSQLAdo/PostgreSQLAdo.cs +++ b/Providers/FreeSql.Provider.PostgreSQL/PostgreSQLAdo/PostgreSQLAdo.cs @@ -32,14 +32,14 @@ public PostgreSQLAdo(CommonUtils util, string masterConnectionString, string[] s if (isAdoPool) masterConnectionString = masterConnectionString.Substring("AdoConnectionPool,".Length); if (!string.IsNullOrEmpty(masterConnectionString)) MasterPool = isAdoPool ? - new DbConnectionStringPool(base.DataType, CoreStrings.S_MasterDatabase, () => new NpgsqlConnection(masterConnectionString)) as IObjectPool : - new PostgreSQLConnectionPool(CoreStrings.S_MasterDatabase, masterConnectionString, null, null); + new DbConnectionStringPool(base.DataType, CoreErrorStrings.S_MasterDatabase, () => new NpgsqlConnection(masterConnectionString)) as IObjectPool : + new PostgreSQLConnectionPool(CoreErrorStrings.S_MasterDatabase, masterConnectionString, null, null); slaveConnectionStrings?.ToList().ForEach(slaveConnectionString => { var slavePool = isAdoPool ? - new DbConnectionStringPool(base.DataType, $"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => new NpgsqlConnection(slaveConnectionString)) as IObjectPool : - new PostgreSQLConnectionPool($"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables)); + new DbConnectionStringPool(base.DataType, $"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => new NpgsqlConnection(slaveConnectionString)) as IObjectPool : + new PostgreSQLConnectionPool($"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables)); SlavePools.Add(slavePool); }); } diff --git a/Providers/FreeSql.Provider.PostgreSQL/PostgreSQLAdo/PostgreSQLConnectionPool.cs b/Providers/FreeSql.Provider.PostgreSQL/PostgreSQLAdo/PostgreSQLConnectionPool.cs index 890b9bcd6..0845d2c71 100644 --- a/Providers/FreeSql.Provider.PostgreSQL/PostgreSQLAdo/PostgreSQLConnectionPool.cs +++ b/Providers/FreeSql.Provider.PostgreSQL/PostgreSQLAdo/PostgreSQLConnectionPool.cs @@ -46,7 +46,7 @@ class PostgreSQLConnectionPoolPolicy : IPolicy { internal PostgreSQLConnectionPool _pool; - public string Name { get; set; } = $"PostgreSQL NpgsqlConnection {CoreStrings.S_ObjectPool}"; + public string Name { get; set; } = $"PostgreSQL NpgsqlConnection {CoreErrorStrings.S_ObjectPool}"; public int PoolSize { get; set; } = 50; public TimeSpan SyncGetTimeout { get; set; } = TimeSpan.FromSeconds(10); public TimeSpan IdleTimeout { get; set; } = TimeSpan.FromSeconds(20); @@ -122,8 +122,8 @@ public void OnGet(Object obj) { if (obj.Value == null) { - _pool.SetUnavailable(new Exception(CoreStrings.S_ConnectionStringError), obj.LastGetTimeCopy); - throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name)); + _pool.SetUnavailable(new Exception(CoreErrorStrings.S_ConnectionStringError), obj.LastGetTimeCopy); + throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name)); } if (obj.Value.State != ConnectionState.Open || DateTime.Now.Subtract(obj.LastReturnTime).TotalSeconds > 60 && obj.Value.Ping() == false) @@ -152,8 +152,8 @@ async public Task OnGetAsync(Object obj) { if (obj.Value == null) { - _pool.SetUnavailable(new Exception(CoreStrings.S_ConnectionStringError), obj.LastGetTimeCopy); - throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name)); + _pool.SetUnavailable(new Exception(CoreErrorStrings.S_ConnectionStringError), obj.LastGetTimeCopy); + throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name)); } if (obj.Value.State != ConnectionState.Open || DateTime.Now.Subtract(obj.LastReturnTime).TotalSeconds > 60 && (await obj.Value.PingAsync()) == false) diff --git a/Providers/FreeSql.Provider.PostgreSQL/PostgreSQLCodeFirst.cs b/Providers/FreeSql.Provider.PostgreSQL/PostgreSQLCodeFirst.cs index af3942fda..c51427084 100644 --- a/Providers/FreeSql.Provider.PostgreSQL/PostgreSQLCodeFirst.cs +++ b/Providers/FreeSql.Provider.PostgreSQL/PostgreSQLCodeFirst.cs @@ -148,8 +148,8 @@ protected override string GetComparisonDDLStatements(params TypeSchemaAndName[] { if (sb.Length > 0) sb.Append("\r\n"); var tb = obj.tableSchema; - if (tb == null) throw new Exception(CoreStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); - if (tb.Columns.Any() == false) throw new Exception(CoreStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); + if (tb == null) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); + if (tb.Columns.Any() == false) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); var tbname = _commonUtils.SplitTableName(tb.DbName); if (tbname?.Length == 1) tbname = new[] { "public", tbname[0] }; diff --git a/Providers/FreeSql.Provider.PostgreSQL/PostgreSQLExpression.cs b/Providers/FreeSql.Provider.PostgreSQL/PostgreSQLExpression.cs index 2e6927321..184b5a31e 100644 --- a/Providers/FreeSql.Provider.PostgreSQL/PostgreSQLExpression.cs +++ b/Providers/FreeSql.Provider.PostgreSQL/PostgreSQLExpression.cs @@ -369,7 +369,7 @@ public override string ExpressionLambdaToSqlCallString(MethodCallExpression exp, return _common.StringConcat(concatNewArrExp.Expressions.Select(a => getExp(a)).ToArray(), null); return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null); case "Format": - if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); + if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreErrorStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ? (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0); //3个 {} 时,Arguments 解析出来是分开的 diff --git a/Providers/FreeSql.Provider.PostgreSQL/PostgreSQLExtensions.cs b/Providers/FreeSql.Provider.PostgreSQL/PostgreSQLExtensions.cs index 3007178f2..5256bfd8f 100644 --- a/Providers/FreeSql.Provider.PostgreSQL/PostgreSQLExtensions.cs +++ b/Providers/FreeSql.Provider.PostgreSQL/PostgreSQLExtensions.cs @@ -182,7 +182,7 @@ static NativeTuple ExecutePgCopyState< public static void ExecutePgCopy(this IInsert that) where T : class { var insert = that as FreeSql.PostgreSQL.Curd.PostgreSQLInsert; - if (insert == null) throw new Exception(CoreStrings.S_Features_Unique("ExecutePgCopy", "PostgreSQL")); + if (insert == null) throw new Exception(CoreErrorStrings.S_Features_Unique("ExecutePgCopy", "PostgreSQL")); var dt = that.ToDataTable(); if (dt.Rows.Count == 0) return; @@ -254,7 +254,7 @@ public static void ExecutePgCopy(this IInsert that) where T : class } else { - throw new NotImplementedException($"ExecutePgCopy {CoreStrings.S_Not_Implemented_FeedBack}"); + throw new NotImplementedException($"ExecutePgCopy {CoreErrorStrings.S_Not_Implemented_FeedBack}"); } } finally @@ -282,7 +282,7 @@ public static Task ExecutePgCopyAsync(this IUpdate that, Cancellation async public static Task ExecutePgCopyAsync(this IInsert that, CancellationToken cancellationToken = default) where T : class { var insert = that as FreeSql.PostgreSQL.Curd.PostgreSQLInsert; - if (insert == null) throw new Exception(CoreStrings.S_Features_Unique("ExecutePgCopyAsync", "PostgreSQL")); + if (insert == null) throw new Exception(CoreErrorStrings.S_Features_Unique("ExecutePgCopyAsync", "PostgreSQL")); var dt = that.ToDataTable(); if (dt.Rows.Count == 0) return; @@ -353,7 +353,7 @@ async public static Task ExecutePgCopyAsync(this IInsert that, Cancellatio } else { - throw new NotImplementedException($"ExecutePgCopyAsync {CoreStrings.S_Not_Implemented_FeedBack}"); + throw new NotImplementedException($"ExecutePgCopyAsync {CoreErrorStrings.S_Not_Implemented_FeedBack}"); } } finally diff --git a/Providers/FreeSql.Provider.QuestDb/Curd/OnConflictDoUpdate.cs b/Providers/FreeSql.Provider.QuestDb/Curd/OnConflictDoUpdate.cs index 53ebe1a68..7a33faeb9 100644 --- a/Providers/FreeSql.Provider.QuestDb/Curd/OnConflictDoUpdate.cs +++ b/Providers/FreeSql.Provider.QuestDb/Curd/OnConflictDoUpdate.cs @@ -24,7 +24,7 @@ public class OnConflictDoUpdate where T1 : class public OnConflictDoUpdate(IInsert insert, Expression> columns = null) { _pgsqlInsert = insert as QuestDbInsert; - if (_pgsqlInsert == null) throw new Exception(CoreStrings.S_Features_Unique("OnConflictDoUpdate", "QuestDb")); + if (_pgsqlInsert == null) throw new Exception(CoreErrorStrings.S_Features_Unique("OnConflictDoUpdate", "QuestDb")); if (_pgsqlInsert._noneParameterFlag == "c") _pgsqlInsert._noneParameterFlag = "cu"; if (columns != null) @@ -38,7 +38,7 @@ public OnConflictDoUpdate(IInsert insert, Expression> colum } if (_tempPrimarys == null || _tempPrimarys.Any() == false) _tempPrimarys = _pgsqlInsert.InternalTable.Primarys; - if (_tempPrimarys.Any() == false) throw new Exception(CoreStrings.S_OnConflictDoUpdate_MustIsPrimary); + if (_tempPrimarys.Any() == false) throw new Exception(CoreErrorStrings.S_OnConflictDoUpdate_MustIsPrimary); } protected void ClearData() diff --git a/Providers/FreeSql.Provider.QuestDb/QuestDbAdo/QuestDbAdo.cs b/Providers/FreeSql.Provider.QuestDb/QuestDbAdo/QuestDbAdo.cs index 90b8a4561..a9dd24252 100644 --- a/Providers/FreeSql.Provider.QuestDb/QuestDbAdo/QuestDbAdo.cs +++ b/Providers/FreeSql.Provider.QuestDb/QuestDbAdo/QuestDbAdo.cs @@ -32,14 +32,14 @@ public QuestDbAdo(CommonUtils util, string masterConnectionString, string[] slav if (isAdoPool) masterConnectionString = masterConnectionString.Substring("AdoConnectionPool,".Length); if (!string.IsNullOrEmpty(masterConnectionString)) MasterPool = isAdoPool ? - new DbConnectionStringPool(base.DataType, CoreStrings.S_MasterDatabase, () => new NpgsqlConnection(masterConnectionString)) as IObjectPool : - new QuestDbConnectionPool(CoreStrings.S_MasterDatabase, masterConnectionString, null, null); + new DbConnectionStringPool(base.DataType, CoreErrorStrings.S_MasterDatabase, () => new NpgsqlConnection(masterConnectionString)) as IObjectPool : + new QuestDbConnectionPool(CoreErrorStrings.S_MasterDatabase, masterConnectionString, null, null); slaveConnectionStrings?.ToList().ForEach(slaveConnectionString => { var slavePool = isAdoPool ? - new DbConnectionStringPool(base.DataType, $"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => new NpgsqlConnection(slaveConnectionString)) as IObjectPool : - new QuestDbConnectionPool($"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables)); + new DbConnectionStringPool(base.DataType, $"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => new NpgsqlConnection(slaveConnectionString)) as IObjectPool : + new QuestDbConnectionPool($"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables)); SlavePools.Add(slavePool); }); } diff --git a/Providers/FreeSql.Provider.QuestDb/QuestDbAdo/QuestDbConnectionPool.cs b/Providers/FreeSql.Provider.QuestDb/QuestDbAdo/QuestDbConnectionPool.cs index 8308c677d..eeb544119 100644 --- a/Providers/FreeSql.Provider.QuestDb/QuestDbAdo/QuestDbConnectionPool.cs +++ b/Providers/FreeSql.Provider.QuestDb/QuestDbAdo/QuestDbConnectionPool.cs @@ -46,7 +46,7 @@ class QuestDbConnectionPoolPolicy : IPolicy { internal QuestDbConnectionPool _pool; - public string Name { get; set; } = $"QuestDb NpgsqlConnection {CoreStrings.S_ObjectPool}"; + public string Name { get; set; } = $"QuestDb NpgsqlConnection {CoreErrorStrings.S_ObjectPool}"; public int PoolSize { get; set; } = 50; public TimeSpan SyncGetTimeout { get; set; } = TimeSpan.FromSeconds(10); public TimeSpan IdleTimeout { get; set; } = TimeSpan.FromSeconds(20); @@ -122,8 +122,8 @@ public void OnGet(Object obj) { if (obj.Value == null) { - _pool.SetUnavailable(new Exception(CoreStrings.S_ConnectionStringError), obj.LastGetTimeCopy); - throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name)); + _pool.SetUnavailable(new Exception(CoreErrorStrings.S_ConnectionStringError), obj.LastGetTimeCopy); + throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name)); } if (obj.Value.State != ConnectionState.Open || DateTime.Now.Subtract(obj.LastReturnTime).TotalSeconds > 60 && obj.Value.Ping() == false) @@ -152,8 +152,8 @@ async public Task OnGetAsync(Object obj) { if (obj.Value == null) { - _pool.SetUnavailable(new Exception(CoreStrings.S_ConnectionStringError), obj.LastGetTimeCopy); - throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name)); + _pool.SetUnavailable(new Exception(CoreErrorStrings.S_ConnectionStringError), obj.LastGetTimeCopy); + throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name)); } if (obj.Value.State != ConnectionState.Open || DateTime.Now.Subtract(obj.LastReturnTime).TotalSeconds > 60 && (await obj.Value.PingAsync()) == false) diff --git a/Providers/FreeSql.Provider.QuestDb/QuestDbCodeFirst.cs b/Providers/FreeSql.Provider.QuestDb/QuestDbCodeFirst.cs index 2bdc9a4b0..5e31497ef 100644 --- a/Providers/FreeSql.Provider.QuestDb/QuestDbCodeFirst.cs +++ b/Providers/FreeSql.Provider.QuestDb/QuestDbCodeFirst.cs @@ -88,9 +88,9 @@ protected override string GetComparisonDDLStatements(params TypeSchemaAndName[] { if (sb.Length > 0) sb.Append("\r\n"); var tb = obj.tableSchema; - if (tb == null) throw new Exception(CoreStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); + if (tb == null) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); if (tb.Columns.Any() == false) - throw new Exception(CoreStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); + throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); var tbname = tb.DbName; var tboldname = tb.DbOldName; if (string.IsNullOrEmpty(obj.tableName) == false) diff --git a/Providers/FreeSql.Provider.QuestDb/QuestDbExpression.cs b/Providers/FreeSql.Provider.QuestDb/QuestDbExpression.cs index f1d85ec43..cbd1e2a8c 100644 --- a/Providers/FreeSql.Provider.QuestDb/QuestDbExpression.cs +++ b/Providers/FreeSql.Provider.QuestDb/QuestDbExpression.cs @@ -267,7 +267,7 @@ public override string ExpressionLambdaToSqlCallString(MethodCallExpression exp, case "Format": if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception( - CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp, exp.Arguments[0])); + CoreErrorStrings.Not_Implemented_Expression_ParameterUseConstant(exp, exp.Arguments[0])); var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ? (exp.Arguments[1] as NewArrayExpression).Expressions diff --git a/Providers/FreeSql.Provider.ShenTong/Curd/ShenTongInsertOrUpdate.cs b/Providers/FreeSql.Provider.ShenTong/Curd/ShenTongInsertOrUpdate.cs index 009f3287c..ae055b05c 100644 --- a/Providers/FreeSql.Provider.ShenTong/Curd/ShenTongInsertOrUpdate.cs +++ b/Providers/FreeSql.Provider.ShenTong/Curd/ShenTongInsertOrUpdate.cs @@ -32,7 +32,7 @@ public override string ToSql() string getMergeSql(List data) { - if (_tempPrimarys.Any() == false) throw new Exception(CoreStrings.InsertOrUpdate_Must_Primary_Key(_table.CsName)); + if (_tempPrimarys.Any() == false) throw new Exception(CoreErrorStrings.InsertOrUpdate_Must_Primary_Key(_table.CsName)); var tempPrimaryIsIdentity = _tempPrimarys.Any(b => b.Attribute.IsIdentity); var sb = new StringBuilder().Append("MERGE INTO ").Append(_commonUtils.QuoteSqlName(TableRuleInvoke())).Append(" t1 \r\nUSING ("); diff --git a/Providers/FreeSql.Provider.ShenTong/ShenTongAdo/ShenTongAdo.cs b/Providers/FreeSql.Provider.ShenTong/ShenTongAdo/ShenTongAdo.cs index f60f52569..55fbd7b5b 100644 --- a/Providers/FreeSql.Provider.ShenTong/ShenTongAdo/ShenTongAdo.cs +++ b/Providers/FreeSql.Provider.ShenTong/ShenTongAdo/ShenTongAdo.cs @@ -29,14 +29,14 @@ public ShenTongAdo(CommonUtils util, string masterConnectionString, string[] sla if (isAdoPool) masterConnectionString = masterConnectionString.Substring("AdoConnectionPool,".Length); if (!string.IsNullOrEmpty(masterConnectionString)) MasterPool = isAdoPool ? - new DbConnectionStringPool(base.DataType, CoreStrings.S_MasterDatabase, () => new OscarConnection(masterConnectionString)) as IObjectPool : - new ShenTongConnectionPool(CoreStrings.S_MasterDatabase, masterConnectionString, null, null); + new DbConnectionStringPool(base.DataType, CoreErrorStrings.S_MasterDatabase, () => new OscarConnection(masterConnectionString)) as IObjectPool : + new ShenTongConnectionPool(CoreErrorStrings.S_MasterDatabase, masterConnectionString, null, null); slaveConnectionStrings?.ToList().ForEach(slaveConnectionString => { var slavePool = isAdoPool ? - new DbConnectionStringPool(base.DataType, $"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => new OscarConnection(slaveConnectionString)) as IObjectPool : - new ShenTongConnectionPool($"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables)); + new DbConnectionStringPool(base.DataType, $"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => new OscarConnection(slaveConnectionString)) as IObjectPool : + new ShenTongConnectionPool($"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables)); SlavePools.Add(slavePool); }); } diff --git a/Providers/FreeSql.Provider.ShenTong/ShenTongAdo/ShenTongConnectionPool.cs b/Providers/FreeSql.Provider.ShenTong/ShenTongAdo/ShenTongConnectionPool.cs index c7f8ab7f4..fc556e2d5 100644 --- a/Providers/FreeSql.Provider.ShenTong/ShenTongAdo/ShenTongConnectionPool.cs +++ b/Providers/FreeSql.Provider.ShenTong/ShenTongAdo/ShenTongConnectionPool.cs @@ -44,7 +44,7 @@ class ShenTongConnectionPoolPolicy : IPolicy { internal ShenTongConnectionPool _pool; - public string Name { get; set; } = $"ShenTong OscarConnection {CoreStrings.S_ObjectPool}"; + public string Name { get; set; } = $"ShenTong OscarConnection {CoreErrorStrings.S_ObjectPool}"; public int PoolSize { get; set; } = 50; public TimeSpan SyncGetTimeout { get; set; } = TimeSpan.FromSeconds(10); public TimeSpan IdleTimeout { get; set; } = TimeSpan.FromSeconds(20); @@ -120,8 +120,8 @@ public void OnGet(Object obj) { if (obj.Value == null) { - _pool.SetUnavailable(new Exception(CoreStrings.S_ConnectionStringError), obj.LastGetTimeCopy); - throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name)); + _pool.SetUnavailable(new Exception(CoreErrorStrings.S_ConnectionStringError), obj.LastGetTimeCopy); + throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name)); } if (obj.Value.State != ConnectionState.Open || DateTime.Now.Subtract(obj.LastReturnTime).TotalSeconds > 60 && obj.Value.Ping() == false) @@ -150,8 +150,8 @@ async public Task OnGetAsync(Object obj) { if (obj.Value == null) { - _pool.SetUnavailable(new Exception(CoreStrings.S_ConnectionStringError), obj.LastGetTimeCopy); - throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name)); + _pool.SetUnavailable(new Exception(CoreErrorStrings.S_ConnectionStringError), obj.LastGetTimeCopy); + throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name)); } if (obj.Value.State != ConnectionState.Open || DateTime.Now.Subtract(obj.LastReturnTime).TotalSeconds > 60 && (await obj.Value.PingAsync()) == false) diff --git a/Providers/FreeSql.Provider.ShenTong/ShenTongCodeFirst.cs b/Providers/FreeSql.Provider.ShenTong/ShenTongCodeFirst.cs index de8b0e01a..0cd73fc0c 100644 --- a/Providers/FreeSql.Provider.ShenTong/ShenTongCodeFirst.cs +++ b/Providers/FreeSql.Provider.ShenTong/ShenTongCodeFirst.cs @@ -95,8 +95,8 @@ protected override string GetComparisonDDLStatements(params TypeSchemaAndName[] { if (sb.Length > 0) sb.Append("\r\n"); var tb = obj.tableSchema; - if (tb == null) throw new Exception(CoreStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); - if (tb.Columns.Any() == false) throw new Exception(CoreStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); + if (tb == null) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); + if (tb.Columns.Any() == false) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); var tbname = _commonUtils.SplitTableName(tb.DbName); if (tbname?.Length == 1) tbname = new[] { "PUBLIC", tbname[0] }; diff --git a/Providers/FreeSql.Provider.ShenTong/ShenTongExpression.cs b/Providers/FreeSql.Provider.ShenTong/ShenTongExpression.cs index 26b22e3d6..f256dbc63 100644 --- a/Providers/FreeSql.Provider.ShenTong/ShenTongExpression.cs +++ b/Providers/FreeSql.Provider.ShenTong/ShenTongExpression.cs @@ -298,7 +298,7 @@ public override string ExpressionLambdaToSqlCallString(MethodCallExpression exp, return _common.StringConcat(concatNewArrExp.Expressions.Select(a => getExp(a)).ToArray(), null); return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null); case "Format": - if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); + if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreErrorStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ? (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0); //3个 {} 时,Arguments 解析出来是分开的 diff --git a/Providers/FreeSql.Provider.SqlServer/Curd/SqlServerDelete.cs b/Providers/FreeSql.Provider.SqlServer/Curd/SqlServerDelete.cs index 7882a9475..ea5618c4f 100644 --- a/Providers/FreeSql.Provider.SqlServer/Curd/SqlServerDelete.cs +++ b/Providers/FreeSql.Provider.SqlServer/Curd/SqlServerDelete.cs @@ -40,7 +40,7 @@ public override List ExecuteDeleted() } var sql = sb.ToString(); var validx = sql.IndexOf(" WHERE "); - if (validx == -1) throw new ArgumentException(CoreStrings.S_NotFound_Name("WHERE")); + if (validx == -1) throw new ArgumentException(CoreErrorStrings.S_NotFound_Name("WHERE")); sql = sb.Clear().Append(sql.Substring(0, validx)) .Append(sbret) .Append(sql.Substring(validx)).ToString(); @@ -97,7 +97,7 @@ await ToSqlFetchAsync(async sb => } var sql = sb.ToString(); var validx = sql.IndexOf(" WHERE "); - if (validx == -1) throw new ArgumentException(CoreStrings.S_NotFound_Name("WHERE")); + if (validx == -1) throw new ArgumentException(CoreErrorStrings.S_NotFound_Name("WHERE")); sql = sb.Clear().Append(sql.Substring(0, validx)) .Append(sbret) .Append(sql.Substring(validx)).ToString(); diff --git a/Providers/FreeSql.Provider.SqlServer/Curd/SqlServerInsert.cs b/Providers/FreeSql.Provider.SqlServer/Curd/SqlServerInsert.cs index 798c3b594..495719686 100644 --- a/Providers/FreeSql.Provider.SqlServer/Curd/SqlServerInsert.cs +++ b/Providers/FreeSql.Provider.SqlServer/Curd/SqlServerInsert.cs @@ -74,14 +74,14 @@ protected override List RawExecuteInserted() if ((_commonUtils as SqlServerUtils).ServerVersion > 10) { var validx = sql.IndexOf(") VALUES"); - if (validx == -1) throw new ArgumentException(CoreStrings.S_NotFound_Name("VALUES")); + if (validx == -1) throw new ArgumentException(CoreErrorStrings.S_NotFound_Name("VALUES")); sb.Insert(0, sql.Substring(0, validx + 1)); sb.Append(sql.Substring(validx + 1)); } else { var validx = sql.IndexOf(") SELECT "); - if (validx == -1) throw new ArgumentException(CoreStrings.S_NotFound_Name("SELECT")); + if (validx == -1) throw new ArgumentException(CoreErrorStrings.S_NotFound_Name("SELECT")); sb.Insert(0, sql.Substring(0, validx + 1)); sb.Append(sql.Substring(validx + 1)); } @@ -158,14 +158,14 @@ async protected override Task> RawExecuteInsertedAsync(CancellationToke if ((_commonUtils as SqlServerUtils).ServerVersion > 10) { var validx = sql.IndexOf(") VALUES"); - if (validx == -1) throw new ArgumentException(CoreStrings.S_NotFound_Name("VALUES")); + if (validx == -1) throw new ArgumentException(CoreErrorStrings.S_NotFound_Name("VALUES")); sb.Insert(0, sql.Substring(0, validx + 1)); sb.Append(sql.Substring(validx + 1)); } else { var validx = sql.IndexOf(") SELECT "); - if (validx == -1) throw new ArgumentException(CoreStrings.S_NotFound_Name("SELECT")); + if (validx == -1) throw new ArgumentException(CoreErrorStrings.S_NotFound_Name("SELECT")); sb.Insert(0, sql.Substring(0, validx + 1)); sb.Append(sql.Substring(validx + 1)); } diff --git a/Providers/FreeSql.Provider.SqlServer/Curd/SqlServerInsertOrUpdate.cs b/Providers/FreeSql.Provider.SqlServer/Curd/SqlServerInsertOrUpdate.cs index 37fa76da7..16b50ec57 100644 --- a/Providers/FreeSql.Provider.SqlServer/Curd/SqlServerInsertOrUpdate.cs +++ b/Providers/FreeSql.Provider.SqlServer/Curd/SqlServerInsertOrUpdate.cs @@ -32,7 +32,7 @@ public override string ToSql() string getMergeSql(List data) { - if (_tempPrimarys.Any() == false) throw new Exception(CoreStrings.InsertOrUpdate_Must_Primary_Key(_table.CsName)); + if (_tempPrimarys.Any() == false) throw new Exception(CoreErrorStrings.InsertOrUpdate_Must_Primary_Key(_table.CsName)); var tempPrimaryIsIdentity = _tempPrimarys.Any(b => b.Attribute.IsIdentity); var sb = new StringBuilder(); diff --git a/Providers/FreeSql.Provider.SqlServer/Curd/SqlServerUpdate.cs b/Providers/FreeSql.Provider.SqlServer/Curd/SqlServerUpdate.cs index ae4710db4..56870842a 100644 --- a/Providers/FreeSql.Provider.SqlServer/Curd/SqlServerUpdate.cs +++ b/Providers/FreeSql.Provider.SqlServer/Curd/SqlServerUpdate.cs @@ -46,7 +46,7 @@ protected override List RawExecuteUpdated(IEnumerable } var sql = sb.ToString(); var validx = sql.IndexOf(" \r\nWHERE "); - if (validx == -1) throw new ArgumentException(CoreStrings.S_NotFound_Name("WHERE")); + if (validx == -1) throw new ArgumentException(CoreErrorStrings.S_NotFound_Name("WHERE")); sql = sb.Clear().Append(sql.Substring(0, validx)) .Append(sbret) .Append(sql.Substring(validx)).ToString(); diff --git a/Providers/FreeSql.Provider.SqlServer/SqlServerAdo/SqlServerAdo.cs b/Providers/FreeSql.Provider.SqlServer/SqlServerAdo/SqlServerAdo.cs index aa1b52380..40353e17c 100644 --- a/Providers/FreeSql.Provider.SqlServer/SqlServerAdo/SqlServerAdo.cs +++ b/Providers/FreeSql.Provider.SqlServer/SqlServerAdo/SqlServerAdo.cs @@ -34,14 +34,14 @@ public SqlServerAdo(CommonUtils util, string masterConnectionString, string[] sl if (isAdoPool) masterConnectionString = masterConnectionString.Substring("AdoConnectionPool,".Length); if (!string.IsNullOrEmpty(masterConnectionString)) MasterPool = isAdoPool ? - new DbConnectionStringPool(base.DataType, CoreStrings.S_MasterDatabase, () => new SqlConnection(masterConnectionString)) as IObjectPool : - new SqlServerConnectionPool(CoreStrings.S_MasterDatabase, masterConnectionString, null, null); + new DbConnectionStringPool(base.DataType, CoreErrorStrings.S_MasterDatabase, () => new SqlConnection(masterConnectionString)) as IObjectPool : + new SqlServerConnectionPool(CoreErrorStrings.S_MasterDatabase, masterConnectionString, null, null); slaveConnectionStrings?.ToList().ForEach(slaveConnectionString => { var slavePool = isAdoPool ? - new DbConnectionStringPool(base.DataType, $"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => new SqlConnection(slaveConnectionString)) as IObjectPool : - new SqlServerConnectionPool($"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables)); + new DbConnectionStringPool(base.DataType, $"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => new SqlConnection(slaveConnectionString)) as IObjectPool : + new SqlServerConnectionPool($"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables)); SlavePools.Add(slavePool); }); } diff --git a/Providers/FreeSql.Provider.SqlServer/SqlServerAdo/SqlServerConnectionPool.cs b/Providers/FreeSql.Provider.SqlServer/SqlServerAdo/SqlServerConnectionPool.cs index dc75463ae..b1d6d5d11 100644 --- a/Providers/FreeSql.Provider.SqlServer/SqlServerAdo/SqlServerConnectionPool.cs +++ b/Providers/FreeSql.Provider.SqlServer/SqlServerAdo/SqlServerConnectionPool.cs @@ -49,7 +49,7 @@ class SqlServerConnectionPoolPolicy : IPolicy { internal SqlServerConnectionPool _pool; - public string Name { get; set; } = $"SqlServer SqlConnection {CoreStrings.S_ObjectPool}"; + public string Name { get; set; } = $"SqlServer SqlConnection {CoreErrorStrings.S_ObjectPool}"; public int PoolSize { get; set; } = 100; public TimeSpan SyncGetTimeout { get; set; } = TimeSpan.FromSeconds(10); public TimeSpan IdleTimeout { get; set; } = TimeSpan.FromSeconds(20); @@ -126,8 +126,8 @@ public void OnGet(Object obj) if (obj.Value == null) { - _pool.SetUnavailable(new Exception(CoreStrings.S_ConnectionStringError), obj.LastGetTimeCopy); - throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name)); + _pool.SetUnavailable(new Exception(CoreErrorStrings.S_ConnectionStringError), obj.LastGetTimeCopy); + throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name)); } if (obj.Value.State != ConnectionState.Open || DateTime.Now.Subtract(obj.LastReturnTime).TotalSeconds > 60 && obj.Value.Ping() == false) @@ -156,8 +156,8 @@ async public Task OnGetAsync(Object obj) if (obj.Value == null) { - _pool.SetUnavailable(new Exception(CoreStrings.S_ConnectionStringError), obj.LastGetTimeCopy); - throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name)); + _pool.SetUnavailable(new Exception(CoreErrorStrings.S_ConnectionStringError), obj.LastGetTimeCopy); + throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name)); } if (obj.Value.State != ConnectionState.Open || DateTime.Now.Subtract(obj.LastReturnTime).TotalSeconds > 60 && (await obj.Value.PingAsync()) == false) diff --git a/Providers/FreeSql.Provider.SqlServer/SqlServerCodeFirst.cs b/Providers/FreeSql.Provider.SqlServer/SqlServerCodeFirst.cs index cecfc3c45..ee528f2c8 100644 --- a/Providers/FreeSql.Provider.SqlServer/SqlServerCodeFirst.cs +++ b/Providers/FreeSql.Provider.SqlServer/SqlServerCodeFirst.cs @@ -153,8 +153,8 @@ protected override string GetComparisonDDLStatements(params TypeSchemaAndName[] { if (sb.Length > 0) sb.Append("\r\n"); var tb = obj.tableSchema; - if (tb == null) throw new Exception(CoreStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); - if (tb.Columns.Any() == false) throw new Exception(CoreStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); + if (tb == null) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); + if (tb.Columns.Any() == false) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); var tbname = _commonUtils.SplitTableName(tb.DbName); if (tbname?.Length == 1) tbname = new[] { database, "dbo", tbname[0] }; if (tbname?.Length == 2) tbname = new[] { database, tbname[0], tbname[1] }; diff --git a/Providers/FreeSql.Provider.SqlServer/SqlServerExpression.cs b/Providers/FreeSql.Provider.SqlServer/SqlServerExpression.cs index 97c47b8dc..c7ce2a3cf 100644 --- a/Providers/FreeSql.Provider.SqlServer/SqlServerExpression.cs +++ b/Providers/FreeSql.Provider.SqlServer/SqlServerExpression.cs @@ -259,7 +259,7 @@ public override string ExpressionLambdaToSqlCallString(MethodCallExpression exp, return _common.StringConcat(concatNewArrExp.Expressions.Select(a => getExp(a)).ToArray(), concatNewArrExp.Expressions.Select(a => a.Type).ToArray()); return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), exp.Arguments.Select(a => a.Type).ToArray()); case "Format": - if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); + if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreErrorStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); var expArgs0 = ExpressionLambdaToSql(exp.Arguments[0], tsc); if (exp.Arguments.Count == 1) return expArgs0; var nchar = expArgs0.StartsWith("N'") ? "N" : ""; diff --git a/Providers/FreeSql.Provider.SqlServer/SqlServerExtensions.cs b/Providers/FreeSql.Provider.SqlServer/SqlServerExtensions.cs index 27bd0bb63..0548927e3 100644 --- a/Providers/FreeSql.Provider.SqlServer/SqlServerExtensions.cs +++ b/Providers/FreeSql.Provider.SqlServer/SqlServerExtensions.cs @@ -246,7 +246,7 @@ static NativeTuple ExecuteSqlBulkCopyS public static void ExecuteSqlBulkCopy(this IInsert that, SqlBulkCopyOptions copyOptions = SqlBulkCopyOptions.Default, int? batchSize = null, int? bulkCopyTimeout = null) where T : class { var insert = that as FreeSql.SqlServer.Curd.SqlServerInsert; - if (insert == null) throw new Exception(CoreStrings.S_Features_Unique("ExecuteSqlBulkCopy", "SqlServer")); + if (insert == null) throw new Exception(CoreErrorStrings.S_Features_Unique("ExecuteSqlBulkCopy", "SqlServer")); if (insert._insertIdentity) copyOptions = copyOptions | SqlBulkCopyOptions.KeepIdentity; var dt = that.ToDataTable(); @@ -313,7 +313,7 @@ public static void ExecuteSqlBulkCopy(this IInsert that, SqlBulkCopyOption } else { - throw new NotImplementedException($"ExecuteSqlBulkCopy {CoreStrings.S_Not_Implemented_FeedBack}"); + throw new NotImplementedException($"ExecuteSqlBulkCopy {CoreErrorStrings.S_Not_Implemented_FeedBack}"); } } finally @@ -340,7 +340,7 @@ public static Task ExecuteSqlBulkCopyAsync(this IUpdate that, SqlBulk async public static Task ExecuteSqlBulkCopyAsync(this IInsert that, SqlBulkCopyOptions copyOptions = SqlBulkCopyOptions.Default, int? batchSize = null, int? bulkCopyTimeout = null, CancellationToken cancellationToken = default) where T : class { var insert = that as FreeSql.SqlServer.Curd.SqlServerInsert; - if (insert == null) throw new Exception(CoreStrings.S_Features_Unique("ExecuteSqlBulkCopyAsync", "SqlServer")); + if (insert == null) throw new Exception(CoreErrorStrings.S_Features_Unique("ExecuteSqlBulkCopyAsync", "SqlServer")); if (insert._insertIdentity) copyOptions = copyOptions | SqlBulkCopyOptions.KeepIdentity; var dt = that.ToDataTable(); @@ -407,7 +407,7 @@ async public static Task ExecuteSqlBulkCopyAsync(this IInsert that, SqlBul } else { - throw new NotImplementedException($"ExecuteSqlBulkCopyAsync {CoreStrings.S_Not_Implemented_FeedBack}"); + throw new NotImplementedException($"ExecuteSqlBulkCopyAsync {CoreErrorStrings.S_Not_Implemented_FeedBack}"); } } finally diff --git a/Providers/FreeSql.Provider.Sqlite/Curd/SqliteDelete.cs b/Providers/FreeSql.Provider.Sqlite/Curd/SqliteDelete.cs index 8ae3fd62e..2d5c1bc94 100644 --- a/Providers/FreeSql.Provider.Sqlite/Curd/SqliteDelete.cs +++ b/Providers/FreeSql.Provider.Sqlite/Curd/SqliteDelete.cs @@ -16,11 +16,11 @@ public SqliteDelete(IFreeSql orm, CommonUtils commonUtils, CommonExpression comm { } - public override List ExecuteDeleted() => throw new NotImplementedException($"FreeSql.Provider.Sqlite {CoreStrings.S_Not_Implemented_Feature}"); + public override List ExecuteDeleted() => throw new NotImplementedException($"FreeSql.Provider.Sqlite {CoreErrorStrings.S_Not_Implemented_Feature}"); #if net40 #else - public override Task> ExecuteDeletedAsync(CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Provider.Sqlite {CoreStrings.S_Not_Implemented_Feature}"); + public override Task> ExecuteDeletedAsync(CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Provider.Sqlite {CoreErrorStrings.S_Not_Implemented_Feature}"); #endif } } diff --git a/Providers/FreeSql.Provider.Sqlite/Curd/SqliteInsertOrUpdate.cs b/Providers/FreeSql.Provider.Sqlite/Curd/SqliteInsertOrUpdate.cs index cb0824b40..be7480091 100644 --- a/Providers/FreeSql.Provider.Sqlite/Curd/SqliteInsertOrUpdate.cs +++ b/Providers/FreeSql.Provider.Sqlite/Curd/SqliteInsertOrUpdate.cs @@ -56,14 +56,14 @@ string getInsertSql(List data, bool flagInsert) insert.InsertIdentity(); if (_doNothing == false) { - if (_updateIgnore.Any()) throw new Exception(CoreStrings.S_InsertOrUpdate_Unable_UpdateColumns); + if (_updateIgnore.Any()) throw new Exception(CoreErrorStrings.S_InsertOrUpdate_Unable_UpdateColumns); sql = insert.ToSql(); if (sql?.StartsWith("INSERT INTO ") == true) sql = $"INSERT OR REPLACE INTO {sql.Substring(12)}"; } else { - if (_tempPrimarys.Any() == false) throw new Exception(CoreStrings.Entity_Must_Primary_Key("fsql.InsertOrUpdate + IfExistsDoNothing + Sqlite ", _table.CsName)); + if (_tempPrimarys.Any() == false) throw new Exception(CoreErrorStrings.Entity_Must_Primary_Key("fsql.InsertOrUpdate + IfExistsDoNothing + Sqlite ", _table.CsName)); sql = insert.ToSql(); if (sql?.StartsWith("INSERT INTO ") == true) sql = $"INSERT OR IGNORE INTO {sql.Substring(12)}"; diff --git a/Providers/FreeSql.Provider.Sqlite/Curd/SqliteUpdate.cs b/Providers/FreeSql.Provider.Sqlite/Curd/SqliteUpdate.cs index 062d30a84..084f6c6be 100644 --- a/Providers/FreeSql.Provider.Sqlite/Curd/SqliteUpdate.cs +++ b/Providers/FreeSql.Provider.Sqlite/Curd/SqliteUpdate.cs @@ -22,7 +22,7 @@ public SqliteUpdate(IFreeSql orm, CommonUtils commonUtils, CommonExpression comm public override int ExecuteAffrows() => base.SplitExecuteAffrows(_batchRowsLimit > 0 ? _batchRowsLimit : 200, _batchParameterLimit > 0 ? _batchParameterLimit : 999); protected override List ExecuteUpdated(IEnumerable columns) => base.SplitExecuteUpdated(_batchRowsLimit > 0 ? _batchRowsLimit : 200, _batchParameterLimit > 0 ? _batchParameterLimit : 999, columns); - protected override List RawExecuteUpdated(IEnumerable columns) => throw new NotImplementedException($"FreeSql.Provider.Sqlite {CoreStrings.S_Not_Implemented_Feature}"); + protected override List RawExecuteUpdated(IEnumerable columns) => throw new NotImplementedException($"FreeSql.Provider.Sqlite {CoreErrorStrings.S_Not_Implemented_Feature}"); protected override void ToSqlCase(StringBuilder caseWhen, ColumnInfo[] primarys) { @@ -66,7 +66,7 @@ protected override void ToSqlWhen(StringBuilder sb, ColumnInfo[] primarys, objec public override Task ExecuteAffrowsAsync(CancellationToken cancellationToken = default) => base.SplitExecuteAffrowsAsync(_batchRowsLimit > 0 ? _batchRowsLimit : 200, _batchParameterLimit > 0 ? _batchParameterLimit : 999, cancellationToken); protected override Task> ExecuteUpdatedAsync(IEnumerable columns, CancellationToken cancellationToken = default) => base.SplitExecuteUpdatedAsync(_batchRowsLimit > 0 ? _batchRowsLimit : 200, _batchParameterLimit > 0 ? _batchParameterLimit : 999, columns, cancellationToken); - protected override Task> RawExecuteUpdatedAsync(IEnumerable columns, CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Provider.Sqlite {CoreStrings.S_Not_Implemented_Feature}"); + protected override Task> RawExecuteUpdatedAsync(IEnumerable columns, CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Provider.Sqlite {CoreErrorStrings.S_Not_Implemented_Feature}"); #endif } } diff --git a/Providers/FreeSql.Provider.Sqlite/SqliteAdo/SqliteAdo.cs b/Providers/FreeSql.Provider.Sqlite/SqliteAdo/SqliteAdo.cs index 10c37d115..1228901bd 100644 --- a/Providers/FreeSql.Provider.Sqlite/SqliteAdo/SqliteAdo.cs +++ b/Providers/FreeSql.Provider.Sqlite/SqliteAdo/SqliteAdo.cs @@ -35,14 +35,14 @@ public SqliteAdo(CommonUtils util, string masterConnectionString, string[] slave if (isAdoPool) masterConnectionString = masterConnectionString.Substring("AdoConnectionPool,".Length); if (!string.IsNullOrEmpty(masterConnectionString)) MasterPool = isAdoPool ? - new DbConnectionStringPool(base.DataType, CoreStrings.S_MasterDatabase, () => SqliteConnectionPool.CreateConnection(masterConnectionString)) as IObjectPool : - new SqliteConnectionPool(CoreStrings.S_MasterDatabase, masterConnectionString, null, null); + new DbConnectionStringPool(base.DataType, CoreErrorStrings.S_MasterDatabase, () => SqliteConnectionPool.CreateConnection(masterConnectionString)) as IObjectPool : + new SqliteConnectionPool(CoreErrorStrings.S_MasterDatabase, masterConnectionString, null, null); slaveConnectionStrings?.ToList().ForEach(slaveConnectionString => { var slavePool = isAdoPool ? - new DbConnectionStringPool(base.DataType, $"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => SqliteConnectionPool.CreateConnection(slaveConnectionString)) as IObjectPool : - new SqliteConnectionPool($"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables)); + new DbConnectionStringPool(base.DataType, $"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => SqliteConnectionPool.CreateConnection(slaveConnectionString)) as IObjectPool : + new SqliteConnectionPool($"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables)); SlavePools.Add(slavePool); }); } diff --git a/Providers/FreeSql.Provider.Sqlite/SqliteAdo/SqliteConnectionPool.cs b/Providers/FreeSql.Provider.Sqlite/SqliteAdo/SqliteConnectionPool.cs index d8c0cff86..e4bb5fa38 100644 --- a/Providers/FreeSql.Provider.Sqlite/SqliteAdo/SqliteConnectionPool.cs +++ b/Providers/FreeSql.Provider.Sqlite/SqliteAdo/SqliteConnectionPool.cs @@ -56,7 +56,7 @@ class SqliteConnectionPoolPolicy : IPolicy { internal SqliteConnectionPool _pool; - public string Name { get; set; } = $"Sqlite SQLiteConnection {CoreStrings.S_ObjectPool}"; + public string Name { get; set; } = $"Sqlite SQLiteConnection {CoreErrorStrings.S_ObjectPool}"; public int PoolSize { get; set; } = 100; public TimeSpan SyncGetTimeout { get; set; } = TimeSpan.FromSeconds(10); public TimeSpan IdleTimeout { get; set; } = TimeSpan.Zero; @@ -155,7 +155,7 @@ public void OnGet(Object obj) if (_pool.IsAvailable) { if (obj.Value == null) - throw new Exception(CoreStrings.S_ConnectionStringError_CheckProjectConnection(this.Name)); + throw new Exception(CoreErrorStrings.S_ConnectionStringError_CheckProjectConnection(this.Name)); if (obj.Value.State != ConnectionState.Open) obj.Value.OpenAndAttach(Attaches); @@ -170,7 +170,7 @@ async public Task OnGetAsync(Object obj) if (_pool.IsAvailable) { if (obj.Value == null) - throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name)); + throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name)); if (obj.Value.State != ConnectionState.Open) await obj.Value.OpenAndAttachAsync(Attaches); diff --git a/Providers/FreeSql.Provider.Sqlite/SqliteCodeFirst.cs b/Providers/FreeSql.Provider.Sqlite/SqliteCodeFirst.cs index 6545bff5e..3e0ebac79 100644 --- a/Providers/FreeSql.Provider.Sqlite/SqliteCodeFirst.cs +++ b/Providers/FreeSql.Provider.Sqlite/SqliteCodeFirst.cs @@ -79,8 +79,8 @@ protected override string GetComparisonDDLStatements(params TypeSchemaAndName[] { if (sb.Length > 0) sb.Append("\r\n"); var tb = obj.tableSchema; - if (tb == null) throw new Exception(CoreStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); - if (tb.Columns.Any() == false) throw new Exception(CoreStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); + if (tb == null) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); + if (tb.Columns.Any() == false) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); var tbname = _commonUtils.SplitTableName(tb.DbName); if (tbname?.Length == 1) tbname = new[] { "main", tbname[0] }; diff --git a/Providers/FreeSql.Provider.Sqlite/SqliteDbFirst.cs b/Providers/FreeSql.Provider.Sqlite/SqliteDbFirst.cs index 0084a7fc3..b749f8e57 100644 --- a/Providers/FreeSql.Provider.Sqlite/SqliteDbFirst.cs +++ b/Providers/FreeSql.Provider.Sqlite/SqliteDbFirst.cs @@ -102,7 +102,7 @@ DbType GetSqlDbType(DbColumnInfo column) if (dbfull != null) _dicDbToCs.TryAdd(dbfull, _dicDbToCs["nvarchar(255)"]); return DbType.String; } - throw new NotImplementedException(CoreStrings.S_TypeMappingNotImplemented(column.DbTypeTextFull)); + throw new NotImplementedException(CoreErrorStrings.S_TypeMappingNotImplemented(column.DbTypeTextFull)); } static ConcurrentDictionary _dicDbToCs = new ConcurrentDictionary(StringComparer.CurrentCultureIgnoreCase); diff --git a/Providers/FreeSql.Provider.Sqlite/SqliteExpression.cs b/Providers/FreeSql.Provider.Sqlite/SqliteExpression.cs index 5c300c78f..13ce403c7 100644 --- a/Providers/FreeSql.Provider.Sqlite/SqliteExpression.cs +++ b/Providers/FreeSql.Provider.Sqlite/SqliteExpression.cs @@ -250,7 +250,7 @@ public override string ExpressionLambdaToSqlCallString(MethodCallExpression exp, return _common.StringConcat(concatNewArrExp.Expressions.Select(a => getExp(a)).ToArray(), null); return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null); case "Format": - if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); + if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreErrorStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ? (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0); //3个 {} 时,Arguments 解析出来是分开的 diff --git a/Providers/FreeSql.Provider.Xugu/Curd/XuguInsertOrUpdate.cs b/Providers/FreeSql.Provider.Xugu/Curd/XuguInsertOrUpdate.cs index 8186d6455..2114118ce 100644 --- a/Providers/FreeSql.Provider.Xugu/Curd/XuguInsertOrUpdate.cs +++ b/Providers/FreeSql.Provider.Xugu/Curd/XuguInsertOrUpdate.cs @@ -38,7 +38,7 @@ public override string ToSql() string getMergeSql(List data) { - if (_tempPrimarys.Any() == false) throw new Exception(CoreStrings.InsertOrUpdate_Must_Primary_Key(_table.CsName)); + if (_tempPrimarys.Any() == false) throw new Exception(CoreErrorStrings.InsertOrUpdate_Must_Primary_Key(_table.CsName)); var tempPrimaryIsIdentity = _tempPrimarys.Any(b => b.Attribute.IsIdentity); var sb = new StringBuilder().Append("MERGE INTO ").Append(_commonUtils.QuoteSqlName(TableRuleInvoke())).Append(" t1 \r\nUSING ("); diff --git a/Providers/FreeSql.Provider.Xugu/XuguAdo/XuguAdo.cs b/Providers/FreeSql.Provider.Xugu/XuguAdo/XuguAdo.cs index e780875d0..7a7a6be55 100644 --- a/Providers/FreeSql.Provider.Xugu/XuguAdo/XuguAdo.cs +++ b/Providers/FreeSql.Provider.Xugu/XuguAdo/XuguAdo.cs @@ -30,14 +30,14 @@ public XuguAdo(CommonUtils util, string masterConnectionString, string[] slaveCo if (isAdoPool) masterConnectionString = masterConnectionString.Substring("AdoConnectionPool,".Length); if (!string.IsNullOrEmpty(masterConnectionString)) MasterPool = isAdoPool ? - new DbConnectionStringPool(base.DataType, CoreStrings.S_MasterDatabase, () => new XGConnection(masterConnectionString)) as IObjectPool : - new XuguConnectionPool(CoreStrings.S_MasterDatabase, masterConnectionString, null, null); + new DbConnectionStringPool(base.DataType, CoreErrorStrings.S_MasterDatabase, () => new XGConnection(masterConnectionString)) as IObjectPool : + new XuguConnectionPool(CoreErrorStrings.S_MasterDatabase, masterConnectionString, null, null); slaveConnectionStrings?.ToList().ForEach(slaveConnectionString => { var slavePool = isAdoPool ? - new DbConnectionStringPool(base.DataType, $"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => new XGConnection(slaveConnectionString)) as IObjectPool : - new XuguConnectionPool($"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables)); + new DbConnectionStringPool(base.DataType, $"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => new XGConnection(slaveConnectionString)) as IObjectPool : + new XuguConnectionPool($"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables)); SlavePools.Add(slavePool); }); } diff --git a/Providers/FreeSql.Provider.Xugu/XuguAdo/XuguConnectionPool.cs b/Providers/FreeSql.Provider.Xugu/XuguAdo/XuguConnectionPool.cs index e5d4ec117..d584aa8e1 100644 --- a/Providers/FreeSql.Provider.Xugu/XuguAdo/XuguConnectionPool.cs +++ b/Providers/FreeSql.Provider.Xugu/XuguAdo/XuguConnectionPool.cs @@ -43,7 +43,7 @@ class XuguConnectionPoolPolicy : IPolicy { internal XuguConnectionPool _pool; - public string Name { get; set; } = $"Xugu XuguConnection {CoreStrings.S_ObjectPool}"; + public string Name { get; set; } = $"Xugu XuguConnection {CoreErrorStrings.S_ObjectPool}"; public int PoolSize { get; set; } = 50; public TimeSpan SyncGetTimeout { get; set; } = TimeSpan.FromSeconds(10); public TimeSpan IdleTimeout { get; set; } = TimeSpan.FromSeconds(20); @@ -120,8 +120,8 @@ public void OnGet(Object obj) { if (obj.Value == null) { - _pool.SetUnavailable(new Exception(CoreStrings.S_ConnectionStringError), obj.LastGetTimeCopy); - throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name)); + _pool.SetUnavailable(new Exception(CoreErrorStrings.S_ConnectionStringError), obj.LastGetTimeCopy); + throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name)); } if (obj.Value.State != ConnectionState.Open || DateTime.Now.Subtract(obj.LastReturnTime).TotalSeconds > 60 && obj.Value.Ping() == false) @@ -150,8 +150,8 @@ async public Task OnGetAsync(Object obj) { if (obj.Value == null) { - _pool.SetUnavailable(new Exception(CoreStrings.S_ConnectionStringError), obj.LastGetTimeCopy); - throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name)); + _pool.SetUnavailable(new Exception(CoreErrorStrings.S_ConnectionStringError), obj.LastGetTimeCopy); + throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name)); } if (obj.Value.State != ConnectionState.Open || DateTime.Now.Subtract(obj.LastReturnTime).TotalSeconds > 60 && (await obj.Value.PingAsync()) == false) diff --git a/Providers/FreeSql.Provider.Xugu/XuguCodeFirst.cs b/Providers/FreeSql.Provider.Xugu/XuguCodeFirst.cs index 1182b4933..3bed206c0 100644 --- a/Providers/FreeSql.Provider.Xugu/XuguCodeFirst.cs +++ b/Providers/FreeSql.Provider.Xugu/XuguCodeFirst.cs @@ -138,8 +138,8 @@ protected override string GetComparisonDDLStatements(params TypeSchemaAndName[] { if (sb.Length > 0) sb.Append("\r\n"); var tb = obj.tableSchema; - if (tb == null) throw new Exception(CoreStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); - if (tb.Columns.Any() == false) throw new Exception(CoreStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); + if (tb == null) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName)); + if (tb.Columns.Any() == false) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName)); var tbname = _commonUtils.SplitTableName(tb.DbName); if (tbname?.Length == 1) tbname = new[] { DefaultSchema, tbname[0] }; diff --git a/Providers/FreeSql.Provider.Xugu/XuguExpression.cs b/Providers/FreeSql.Provider.Xugu/XuguExpression.cs index ed2a4b12d..71773e541 100644 --- a/Providers/FreeSql.Provider.Xugu/XuguExpression.cs +++ b/Providers/FreeSql.Provider.Xugu/XuguExpression.cs @@ -294,7 +294,7 @@ public override string ExpressionLambdaToSqlCallString(MethodCallExpression exp, case "Concat": return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null); case "Format": - if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); + if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreErrorStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ? (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0); //3个 {} 时,Arguments 解析出来是分开的