diff --git a/FreeSql.DbContext/DbContext/DbContextErrorStrings.cs b/FreeSql.DbContext/DbContext/DbContextErrorStrings.cs index 681b22d29..e8cd6f644 100644 --- a/FreeSql.DbContext/DbContext/DbContextErrorStrings.cs +++ b/FreeSql.DbContext/DbContext/DbContextErrorStrings.cs @@ -12,93 +12,93 @@ namespace FreeSql /// /// 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); + public static string AddFreeDbContextError_CheckConstruction(object dbContextTypeName) => Language == "cn" ? + $@"AddFreeDbContext 发生错误,请检查 {dbContextTypeName} 的构造参数都已正确注入" : + $@"FreeSql: An error occurred in AddFreeDbContext, check that the construction parameters of {dbContextTypeName} have been injected correctly"; /// /// 不可添加,已存在于状态管理:{entityString} /// - public static string CannotAdd_AlreadyExistsInStateManagement(object entityString) => string.Format(Language == "cn" ? - @"不可添加,已存在于状态管理:{0}" : - @"FreeSql: Not addable, already exists in state management: {0}", entityString); + public static string CannotAdd_AlreadyExistsInStateManagement(object entityString) => Language == "cn" ? + $@"不可添加,已存在于状态管理:{entityString}" : + $@"FreeSql: Not addable, already exists in state management: {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); + public static string CannotAdd_EntityHasNo_PrimaryKey(object entityString) => Language == "cn" ? + $@"不可添加,实体没有主键:{entityString}" : + $@"FreeSql: Not addable, entity has no primary key: {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); + public static string CannotAdd_PrimaryKey_NotSet(object entityString) => Language == "cn" ? + $@"不可添加,未设置主键的值:{entityString}" : + $@"FreeSql: Not addable, no value for primary key set: {entityString}"; /// /// 不可添加,自增属性有值:{entityString} /// - public static string CannotAdd_SelfIncreasingHasValue(object entityString) => string.Format(Language == "cn" ? - @"不可添加,自增属性有值:{0}" : - @"FreeSql: Not addable, self-increasing attribute has value: {0}", entityString); + public static string CannotAdd_SelfIncreasingHasValue(object entityString) => Language == "cn" ? + $@"不可添加,自增属性有值:{entityString}" : + $@"FreeSql: Not addable, self-increasing attribute has value: {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); + public static string CannotAttach_EntityHasNo_PrimaryKey(object entityString) => Language == "cn" ? + $@"不可附加,实体没有主键:{entityString}" : + $@"FreeSql: Not attachable, entity has no primary key: {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); + public static string CannotAttach_PrimaryKey_NotSet(object entityString) => Language == "cn" ? + $@"不可附加,未设置主键的值:{entityString}" : + $@"FreeSql: Not attachable, no value for primary key set: {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); + public static string CannotDelete_DataNotTracked_ShouldQuery(object entityString) => Language == "cn" ? + $@"不可删除,数据未被跟踪,应该先查询:{entityString}" : + $@"FreeSql: Not deletable, data not tracked, should query first: {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); + public static string CannotDelete_EntityHasNo_PrimaryKey(object entityString) => Language == "cn" ? + $@"不可删除,实体没有主键:{entityString}" : + $@"FreeSql: Not deletable, entity has no primary key: {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); + public static string CannotDelete_PrimaryKey_NotSet(object entityString) => Language == "cn" ? + $@"不可删除,未设置主键的值:{entityString}" : + $@"FreeSql: Not deletable, no value for primary key set: {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); + public static string CannotEdit_EntityHasNo_PrimaryKey(object entityString) => Language == "cn" ? + $@"不可进行编辑,实体没有主键:{entityString}" : + $@"FreeSql: Not editable, entity has no primary key: {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); + public static string CannotUpdate_DataShouldQueryOrAttach(object entityString) => Language == "cn" ? + $@"不可更新,数据未被跟踪,应该先查询 或者 Attach:{entityString}" : + $@"FreeSql: Not updatable, data not tracked, should be queried first or Attach:{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); + public static string CannotUpdate_EntityHasNo_PrimaryKey(object entityString) => Language == "cn" ? + $@"不可更新,实体没有主键:{entityString}" : + $@"FreeSql: Not updatable, entity has no primary key: {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); + public static string CannotUpdate_PrimaryKey_NotSet(object entityString) => Language == "cn" ? + $@"不可更新,未设置主键的值:{entityString}" : + $@"FreeSql: Not updatable, no value for primary key set: {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); + public static string CannotUpdate_RecordDoesNotExist(object entityString) => Language == "cn" ? + $@"不可更新,数据库不存在该记录:{entityString}" : + $@"FreeSql: Not updatable, the record does not exist in the database: {entityString}"; /// /// 请在 OnConfiguring 或 AddFreeDbContext 中配置 UseFreeSql /// @@ -110,103 +110,103 @@ namespace FreeSql /// public static string DbSetAsType_NotSupport_Object => Language == "cn" ? @"DbSet.AsType 参数错误,请传入正确的实体类型" : - @"FreeSql: DbSet.AsType parameter error, please pass in the correct entity type"; + @"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); + public static string EntityType_CannotConvert(object EntityTypeName, object name) => Language == "cn" ? + $@"实体类型 {EntityTypeName} 无法转换为 {name},无法使用该方法" : + $@"FreeSql: Entity type {EntityTypeName} cannot be converted to {name} and cannot use this method"; /// /// 实体类型 {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); + public static string EntityType_PrimaryKeyError(object EntityTypeName, object fullName) => Language == "cn" ? + $@"实体类型 {EntityTypeName} 主键类型不为 {fullName},无法使用该方法" : + $@"FreeSql: Entity type {EntityTypeName} Primary key type is not {fullName} and cannot be used with this method"; /// /// 实体类型 {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); + public static string EntityType_PrimaryKeyIsNotOne(object EntityTypeName) => Language == "cn" ? + $@"实体类型 {EntityTypeName} 主键数量不为 1,无法使用该方法" : + $@"FreeSql: Entity type {EntityTypeName} Primary key number is not 1 and cannot be used with this method"; /// /// 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"; + @"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); + public static string Incomparable_EntityHasNo_PrimaryKey(object entityString) => Language == "cn" ? + $@"不可比较,实体没有主键:{entityString}" : + $@"FreeSql: Not comparable, entity has no primary key: {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); + public static string Incomparable_PrimaryKey_NotSet(object entityString) => Language == "cn" ? + $@"不可比较,未设置主键的值:{entityString}" : + $@"FreeSql: Non-comparable, no value for primary key set: {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); + public static string InsertError_Filter(object filterKey, object filterValueExpression, object entityString) => Language == "cn" ? + $@"FreeSql.Repository Insert 失败,因为设置了过滤器 {filterKey}: {filterValueExpression},插入的数据不符合 {entityString}" : + $@"FreeSql: FreeSql.Repository Insert failed because the filter {filterKey}: {filterValueExpression} was set and the inserted data does not conform to {entityString}"; /// /// ISelect.AsType 参数不支持指定为 object /// public static string ISelectAsType_ParameterError => Language == "cn" ? @"ISelect.AsType 参数不支持指定为 object" : - @"FreeSql: ISelect.AsType parameter does not support specifying as 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); + public static string NotFound_Property(object propertyName, object tableTypeFullName) => Language == "cn" ? + $@"{tableTypeFullName} 不存在属性 {propertyName}" : + $@"FreeSql: Property {propertyName} does not exist for {tableTypeFullName}"; /// /// 找不到方法 DbSet&lt;&gt;.StatesRemoveByObjects /// public static string NotFoundMethod_StatesRemoveByObjects => Language == "cn" ? @"找不到方法 DbSet<>.StatesRemoveByObjects" : - @"FreeSql: Method not found 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); + public static string ParameterDataTypeError(object entityTypeFullName) => Language == "cn" ? + $@"参数 data 类型错误 {entityTypeFullName} " : + $@"FreeSql: Parameter data type error {entityTypeFullName}"; /// /// 参数错误 {param} /// - public static string ParameterError(object param) => string.Format(Language == "cn" ? - @"参数错误 {0}" : - @"FreeSql: Parameter error {0}", param); + public static string ParameterError(object param) => Language == "cn" ? + $@"参数错误 {param}" : + $@"FreeSql: Parameter error {param}"; /// /// 参数错误 {param} 不能为 null /// - public static string ParameterError_CannotBeNull(object param) => string.Format(Language == "cn" ? - @"参数错误 {0} 不能为 null" : - @"FreeSql: Parameter error {0} cannot be null", param); + public static string ParameterError_CannotBeNull(object param) => Language == "cn" ? + $@"参数错误 {param} 不能为 null" : + $@"FreeSql: Parameter error {param} cannot be null"; /// /// 参数错误 {many} 不是集合属性 /// - public static string ParameterError_IsNot_CollectionProperties(object many) => string.Format(Language == "cn" ? - @"参数错误 {0} 不是集合属性" : - @"FreeSql: Parameter error {0} is not a collection property", many); + public static string ParameterError_IsNot_CollectionProperties(object many) => Language == "cn" ? + $@"参数错误 {many} 不是集合属性" : + $@"FreeSql: Parameter error {many} is not a collection property"; /// /// 参数错误 {many} 集合属性不存在 /// - public static string ParameterError_NotFound_CollectionProperties(object many) => string.Format(Language == "cn" ? - @"参数错误 {0} 集合属性不存在" : - @"FreeSql: Parameter error {0} Collection property does not exist", many); + public static string ParameterError_NotFound_CollectionProperties(object many) => Language == "cn" ? + $@"参数错误 {many} 集合属性不存在" : + $@"FreeSql: Parameter error {many} Collection property does not exist"; /// /// 参数错误 {one} 属性不存在 /// - public static string ParameterError_NotFound_Property(object one) => string.Format(Language == "cn" ? - @"参数错误 {0} 属性不存在" : - @"FreeSql: Parameter error {0} attribute does not exist", one); + public static string ParameterError_NotFound_Property(object one) => Language == "cn" ? + $@"参数错误 {one} 属性不存在" : + $@"FreeSql: Parameter error {one} attribute does not exist"; /// /// Propagation_Mandatory: 使用当前事务,如果没有当前事务,就抛出异常 /// @@ -222,21 +222,21 @@ namespace FreeSql /// /// {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); + public static string PropertyOfType_IsNot_OneToManyOrManyToMany(object propertyName, object tableTypeFullName) => Language == "cn" ? + $@"{tableTypeFullName} 类型的属性 {propertyName} 不是 OneToMany 或 ManyToMany 特性" : + $@"FreeSql: Property {propertyName} of type {tableTypeFullName} is not OneToMany or ManyToMany attribute"; /// /// 特别错误:批量添加失败,{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); + public static string SpecialError_BatchAdditionFailed(object dataType) => Language == "cn" ? + $@"特别错误:批量添加失败,{dataType} 的返回数据,与添加的数目不匹配" : + $@"FreeSql: Special error: Bulk add failed, {dataType} returned data, does not match the number added"; /// /// 特别错误:更新失败,数据未被跟踪:{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 SpecialError_UpdateFailedDataNotTracked(object entityString) => Language == "cn" ? + $@"特别错误:更新失败,数据未被跟踪:{entityString}" : + $@"FreeSql: Special error: Update failed, data not tracked: {entityString}"; /// /// 已开启事务,不能禁用工作单元 /// @@ -246,21 +246,20 @@ namespace FreeSql /// /// {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); + public static string TypeHasSetProperty_IgnoreAttribute(object tableTypeFullName, object propertyName) => Language == "cn" ? + $@"{tableTypeFullName} 类型已设置属性 {propertyName} 忽略特性" : + $@"FreeSql: The {tableTypeFullName} type has set the property {propertyName} Ignore the attribute"; /// /// {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); + public static string UnitOfWorkManager_Construction_CannotBeNull(object unitOfWorkManager, object fsql) => Language == "cn" ? + $@"{unitOfWorkManager} 构造参数 {fsql} 不能为 null" : + $@"FreeSql: The {unitOfWorkManager} constructor parameter {fsql} cannot be null"; /// /// 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); + public static string UpdateError_Filter(object filterKey, object filterValueExpression, object entityString) => Language == "cn" ? + $@"FreeSql.Repository Update 失败,因为设置了过滤器 {filterKey}: {filterValueExpression},更新的数据不符合{entityString}" : + $@"FreeSql: FreeSql.Repository Update failed because the filter {filterKey}: {filterValueExpression} is set and the updated data does not conform to {entityString}"; } - } diff --git a/FreeSql/FreeSql.xml b/FreeSql/FreeSql.xml index 319d5d395..c21ae6656 100644 --- a/FreeSql/FreeSql.xml +++ b/FreeSql/FreeSql.xml @@ -5472,7 +5472,7 @@ - 【{policyName}】ObjectPool.GetAsync() The queue is too long, Policy.AsyncGetCapacity = {asyncGetCapacity} + 【{policyName}】ObjectPool.GetAsync() The queue is too long. Policy.AsyncGetCapacity = {asyncGetCapacity} @@ -6376,3 +6376,126 @@ + + + + + 插入数据,传入实体集合 + + + + + + + + 插入数据,传入实体集合 + + + + + + + + 插入或更新数据,此功能依赖数据库特性(低版本可能不支持),参考如下: + MySql 5.6+: on duplicate key update + PostgreSQL 9.4+: on conflict do update + SqlServer 2008+: merge into + Oracle 11+: merge into + Sqlite: replace into + DuckDB: on conflict do update + 达梦: merge into + 人大金仓:on conflict do update + 神通:merge into + MsAccess:不支持 + 注意区别:FreeSql.Repository 仓储也有 InsertOrUpdate 方法(不依赖数据库特性) + + + + + + + 修改数据 + + + + + + + 修改数据,传入动态条件,如:主键值 | new[]{主键值1,主键值2} | TEntity1 | new[]{TEntity1,TEntity2} | new{id=1} + + + 主键值、主键值集合、实体、实体集合、匿名对象、匿名对象集合 + + + + + 查询数据 + + + + + + + 查询数据,传入动态条件,如:主键值 | new[]{主键值1,主键值2} | TEntity1 | new[]{TEntity1,TEntity2} | new{id=1} + + + 主键值、主键值集合、实体、实体集合、匿名对象、匿名对象集合 + + + + + 删除数据 + + + + + + + 删除数据,传入动态条件,如:主键值 | new[]{主键值1,主键值2} | TEntity1 | new[]{TEntity1,TEntity2} | new{id=1} + + + 主键值、主键值集合、实体、实体集合、匿名对象、匿名对象集合 + + + + + 开启事务(不支持异步) + v1.5.0 关闭了线程事务超时自动提交的机制 + + 事务体 () => {} + + + + 开启事务(不支持异步) + v1.5.0 关闭了线程事务超时自动提交的机制 + + + 事务体 () => {} + + + + 数据库访问对象 + + + + + 所有拦截方法都在这里 + + + + + CodeFirst 模式开发相关方法 + + + + + DbFirst 模式开发相关方法 + + + + + 全局过滤设置,可默认附加为 Select/Update/Delete 条件 + + + + diff --git a/FreeSql/Internal/Exception/CoreErrorStrings.cs b/FreeSql/Internal/Exception/CoreErrorStrings.cs index 4aeee2784..9a8299726 100644 --- a/FreeSql/Internal/Exception/CoreErrorStrings.cs +++ b/FreeSql/Internal/Exception/CoreErrorStrings.cs @@ -11,33 +11,33 @@ namespace FreeSql /// /// [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); + public static string AsTable_PropertyName_FormatError(object asTable) => Language == "cn" ? + $@"[Table(AsTable = ""{asTable}"")] 特性值格式错误" : + $@"FreeSql: [Table(AsTable=""{asTable}"")] Property value formatted incorrectly"; /// /// [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); + public static string AsTable_PropertyName_NotDateTime(object atmGroupsValue) => Language == "cn" ? + $@"[Table(AsTable = xx)] 设置的属性名 {atmGroupsValue} 不是 DateTime 类型" : + $@"FreeSql: The property name {atmGroupsValue} set by [Table (AsTable = xx)] is not of type DateTime"; /// /// {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); + public static string Available_Failed_Get_Resource(object name, object statistics) => Language == "cn" ? + $@"{name}: Failed to get resource {statistics}" : + $@"FreeSql: {name}: Failed to get resource {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); + public static string Available_Thrown_Exception(object name) => Language == "cn" ? + $@"{name}: An exception needs to be thrown" : + $@"FreeSql: {name}: An exception needs to be thrown"; /// /// 错误的表达式格式 {column} /// - public static string Bad_Expression_Format(object column) => string.Format(Language == "cn" ? - @"错误的表达式格式 {0}" : - @"FreeSql: Wrong expression format {0}", column); + public static string Bad_Expression_Format(object column) => Language == "cn" ? + $@"错误的表达式格式 {column}" : + $@"FreeSql: Wrong expression format {column}"; /// /// Chunk 功能之前不可使用 Select /// @@ -59,21 +59,21 @@ namespace FreeSql /// /// {name} 不能为 null /// - public static string Cannot_Be_NULL_Name(object name) => string.Format(Language == "cn" ? - @"{0} 不能为 null" : - @"FreeSql: {0} cannot be null", name); + public static string Cannot_Be_NULL_Name(object name) => Language == "cn" ? + $@"{name} 不能为 null" : + $@"FreeSql: {name} cannot be null"; /// /// 无法匹配 {property} /// - public static string Cannot_Match_Property(object property) => string.Format(Language == "cn" ? - @"无法匹配 {0}" : - @"FreeSql: Unable to match {0}", property); + public static string Cannot_Match_Property(object property) => Language == "cn" ? + $@"无法匹配 {property}" : + $@"FreeSql: Unable to match {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); + public static string Cannot_Resolve_ExpressionTree(object property) => Language == "cn" ? + $@"{property} 无法解析为表达式树" : + $@"FreeSql: {property} cannot be resolved to an expression tree"; /// /// 参数 masterConnectionString 不可为空,请检查 UseConnectionString /// @@ -95,39 +95,39 @@ namespace FreeSql /// /// 自定义表达式解析错误:类型 {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); + public static string Custom_Expression_ParsingError(object exp3MethodDeclaringType) => Language == "cn" ? + $@"自定义表达式解析错误:类型 {exp3MethodDeclaringType} 需要定义 static ThreadLocal 字段、字段、字段(重要三次提醒)" : + $@"FreeSql: Custom expression parsing error: type {exp3MethodDeclaringType} needs to define static ThreadLocalfield, field, field (important three reminders)"; /// /// 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 {{ 反射信息 }}不能为空,格式:{{ 静态方法名 }}{{ 空格 }}{{ 反射信息 }}" : + $@"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 {{ 静态方法名 }}不能为空,格式:{{ 静态方法名 }}{{ 空格 }}{{ 反射信息 }}" : + $@"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); + public static string Custom_StaticMethodName_NotSet_DynamicFilterCustom(object fiValueCustomArray) => Language == "cn" ? + $@"Custom 对应的{{{{ 静态方法名 }}}}:{fiValueCustomArray} 未设置 [DynamicFilterCustomAttribute] 特性" : + $@"FreeSql: Custom corresponding {{{{static method name}}}}:{fiValueCustomArray} The [DynamicFilterCustomAttribute] attribute is not set"; /// /// 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}"; + $@"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); + public static string DataType_AsType_Inconsistent(object dataDisplayCsharp, object tableTypeDisplayCsharp) => Language == "cn" ? + $@"操作的数据类型({dataDisplayCsharp}) 与 AsType({tableTypeDisplayCsharp}) 不一致,请检查。" : + $@"FreeSql: The data type of the operation ({dataDisplayCsharp}) is inconsistent with AsType ({tableTypeDisplayCsharp}). Please check."; /// /// DateRange 要求 Value 应该逗号分割,并且长度为 2 /// @@ -143,9 +143,9 @@ namespace FreeSql /// /// 记录可能不存在,或者【行级乐观锁】版本过旧,更新数量{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); + public static string DbUpdateVersionException_RowLevelOptimisticLock(object sourceCount, object affrows) => Language == "cn" ? + $@"记录可能不存在,或者【行级乐观锁】版本过旧,更新数量{sourceCount},影响的行数{affrows}。" : + $@"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}."; /// /// SlaveConnectionString 数量与 SlaveWeights 不相同 /// @@ -155,33 +155,33 @@ namespace FreeSql /// /// 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); + public static string Duplicate_ColumnAttribute(object colattrName) => Language == "cn" ? + $@"ColumnAttribute.Name {colattrName} 重复存在,请检查(注意:不区分大小写)" : + $@"FreeSql: ColumnAttribute. Name {colattrName} exists repeatedly, please check (note: case insensitive)"; /// /// 属性名 {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); + public static string Duplicate_PropertyName(object pName) => Language == "cn" ? + $@"属性名 {pName} 重复存在,请检查(注意:不区分大小写)" : + $@"FreeSql: Property name {pName} exists repeatedly, please check (note: case insensitive)"; /// /// {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); + public static string Entity_Must_Primary_Key(object function, object tableCsName) => Language == "cn" ? + $@"{function} 功能要求实体类 {tableCsName} 必须有主键" : + $@"FreeSql: The {function} feature requires that the entity class {tableCsName} must have a primary key"; /// /// {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); + public static string Entity_MySQL_VersionsBelow8_NotSupport_Multiple_PrimaryKeys(object tbTypeFullName) => Language == "cn" ? + $@"{tbTypeFullName} 是父子关系,但是 MySql 8.0 以下版本中不支持组合多主键" : + $@"FreeSql: {tbTypeFullName} is a parent-child relationship, but combinations of multiple primary keys are not supported in versions below MySql 8.0"; /// /// {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 Entity_NotParentChild_Relationship(object tbTypeFullName) => Language == "cn" ? + $@"{tbTypeFullName} 不是父子关系,无法使用该功能" : + $@"FreeSql: {tbTypeFullName} is not a parent-child relationship and cannot be used"; /// /// 这个特别的子查询不能解析 /// @@ -191,33 +191,33 @@ namespace FreeSql /// /// 表达式错误,它的顶级对象不是 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); + public static string Expression_Error_Use_ParameterExpression(object exp) => Language == "cn" ? + $@"表达式错误,它的顶级对象不是 ParameterExpression:{exp}" : + $@"FreeSql: Expression error, its top object is not ParameterExpression:{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); + public static string Expression_Error_Use_Successive_MemberAccess_Type(object exp) => Language == "cn" ? + $@"表达式错误,它不是连续的 MemberAccess 类型:{exp}" : + $@"FreeSql: Expression error, it is not a continuous MemberAccess type: {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); + public static string ExpressionTree_Convert_Type_Error(object value, object valueTypeFullName, object typeFullName, object exMessage) => Language == "cn" ? + $@"ExpressionTree 转换类型错误,值({value}),类型({valueTypeFullName}),目标类型({typeFullName}),{exMessage}" : + $@"FreeSql: ExpressionTree conversion type error, value ({value}), type ({valueTypeFullName}), target type ({typeFullName}), Error:{exMessage}"; /// /// 未能解析分表字段值 {sqlWhere} /// - public static string Failed_SubTable_FieldValue(object sqlWhere) => string.Format(Language == "cn" ? - @"未能解析分表字段值 {0}" : - @"FreeSql: Failed to parse table field value {0}", sqlWhere); + public static string Failed_SubTable_FieldValue(object sqlWhere) => Language == "cn" ? + $@"未能解析分表字段值 {sqlWhere}" : + $@"FreeSql: Failed to parse table field value {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); + public static string Functions_AsTable_NotImplemented(object asTable) => Language == "cn" ? + $@"AsTable 未实现的功能 {asTable}" : + $@"FreeSql: Function {asTable} not implemented by AsTable"; /// /// GBase 暂时不支持逗号以外的分割符 /// @@ -227,27 +227,27 @@ namespace FreeSql /// /// 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); + public static string Generated_Same_SubTable(object tableName) => Language == "cn" ? + $@"tableName:{tableName} 生成了相同的分表名" : + $@"FreeSql: TableName:{tableName} generated the same table name"; /// /// 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); + public static string GetPrimarys_ParameterError_IsNotDictKey(object primary) => Language == "cn" ? + $@"GetPrimarys 传递的参数 ""{primary}"" 不正确,它不属于字典数据的键名" : + $@"FreeSql: The parameter'{primary}'passed by GetPrimarys is incorrect and does not belong to the key name of the dictionary data"; /// /// 已经指定了 {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); + public static string Has_Specified_Cannot_Specified_Second(object first, object second) => Language == "cn" ? + $@"已经指定了 {first},不能再指定 {second}" : + $@"FreeSql: {first} has already been specified and {second} can no longer be specified"; /// /// {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); + public static string Ignored_Check_Confirm_PublicGetSet(object tb2DbName, object mp2MemberName) => Language == "cn" ? + $@"{tb2DbName}.{mp2MemberName} 被忽略,请检查 IsIgnore 设置,确认 get/set 为 public" : + $@"FreeSql: {tb2DbName}. {mp2MemberName} is ignored. Check the IsIgnore setting to make sure get/set is public"; /// /// Include 参数类型错误 /// @@ -269,21 +269,21 @@ namespace FreeSql /// /// 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); + public static string IncludeMany_NotValid_Navigation(object collMemMemberName, object tbTypeDisplayCsharp) => Language == "cn" ? + $@"IncludeMany 类型 {tbTypeDisplayCsharp} 的属性 {collMemMemberName} 不是有效的导航属性,提示:IsIgnore = true 不会成为导航属性" : + $@"FreeSql: The property {collMemMemberName} of IncludeMany type {tbTypeDisplayCsharp} is not a valid navigation property, hint: IsIgnore = true will not be a navigation property"; /// /// 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); + public static string IncludeMany_ParameterError_OnlyUseOneParameter(object navigateSelector) => Language == "cn" ? + $@"IncludeMany {navigateSelector} 参数错误,Select 只可以使用一个参数的方法,正确格式:.Select(t =>new TNavigate {{{{}}}})" : + $@"FreeSql: IncludeMany {navigateSelector} parameter is wrong, Select can only use one parameter's method, the correct format:.Select(t =>new TNavigate{{{{}}}})"; /// /// 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); + public static string IncludeMany_ParameterError_Select_ReturnConsistentType(object navigateSelector, object collMemElementType) => Language == "cn" ? + $@"IncludeMany {navigateSelector} 参数错误,Select lambda参数返回值必须和 {collMemElementType} 类型一致" : + $@"FreeSql: IncludeMany {navigateSelector} parameter error, Select lambda parameter return value must match {collMemElementType} type"; /// /// IncludeMany 参数1 类型错误,表达式类型应该为 MemberAccess /// @@ -293,169 +293,169 @@ namespace FreeSql /// /// 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); + public static string IncludeMany_ParameterTypeError(object navigateSelector) => Language == "cn" ? + $@"IncludeMany {navigateSelector} 参数类型错误,正确格式: a.collections.Take(1).Where(c =>c.aid == a.id).Select(a=> new TNavigate{{{{}}}})" : + $@"FreeSql: IncludeMany {navigateSelector} parameter type is wrong, correct format: a.collections.Take(1).Where(c => C.A ID == a.id).Select (a => new TNavigate{{{{}}}})"; /// /// 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); + public static string InsertInto_No_Property_Selected(object displayCsharp) => Language == "cn" ? + $@"ISelect.InsertInto() 未选择属性: {displayCsharp}" : + $@"FreeSql: ISelect. InsertInto() did not select an attribute: {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); + public static string InsertInto_TypeError(object displayCsharp) => Language == "cn" ? + $@"ISelect.InsertInto() 类型错误: {displayCsharp}" : + $@"FreeSql: ISelect. InsertInto() type error: {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); + public static string InsertOrUpdate_Must_Primary_Key(object CsName) => Language == "cn" ? + $@"InsertOrUpdate 功能执行 merge into 要求实体类 {CsName} 必须有主键" : + $@"FreeSql: The InsertOrUpdate function performs merge into requiring the entity class {CsName} to have a primary key"; /// /// 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); + public static string InsertOrUpdate_NotSuport_Generic_UseEntity(object typeofT1) => Language == "cn" ? + $@"InsertOrUpdate<>的泛型参数 不支持 {typeofT1},请传递您的实体类" : + $@"FreeSql: The generic parameter for InsertOrUpdate<>does not support {typeofT1}. Pass in your entity class"; /// /// 【延时加载】功能需要安装 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"; + @"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} + public static string LazyLoading_CompilationError(object trytbTypeName, object exMessage, object cscode) => Language == "cn" ? + $@"【延时加载】{trytbTypeName} 编译错误:{exMessage} -{2}" : - @"FreeSql: {0} Compilation error: {1} +{cscode}" : + $@"FreeSql: {trytbTypeName} Compilation error: {exMessage} -{2}", trytbTypeName, exMessage, cscode); +{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); + public static string LazyLoading_EntityMustDeclarePublic(object trytbTypeName) => Language == "cn" ? + $@"【延时加载】实体类型 {trytbTypeName} 必须声明为 public" : + $@"FreeSql: Entity type {trytbTypeName} must be declared public"; /// /// 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"; + @"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); + public static string ManyToMany_NotFound_CorrespondingField(object trytbTypeName, object pnvName, object tbmidCsName, object midTypePropsTrytbName, object findtrytbPkCsName) => Language == "cn" ? + $@"【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 在 {tbmidCsName} 中没有找到对应的字段,如:{midTypePropsTrytbName}{findtrytbPkCsName}、{midTypePropsTrytbName}_{findtrytbPkCsName}" : + $@"FreeSql: [ManyToMany] Navigation property {trytbTypeName}. {pnvName} did not find a corresponding field in {tbmidCsName}, such as: {midTypePropsTrytbName}{findtrytbPkCsName}, {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); + public static string ManyToMany_ParsingError_EntityMissing_PrimaryKey(object trytbTypeName, object pnvName, object tbrefTypeName) => Language == "cn" ? + $@"【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,实体类型 {tbrefTypeName} 缺少主键标识,[Column(IsPrimary = true)]" : + $@"FreeSql: [ManyToMany] Navigation property {trytbTypeName}. {pnvName} parsing error, entity type {tbrefTypeName} missing primary key identity, [Column (IsPrimary = true)]"; /// /// 【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); + public static string ManyToMany_ParsingError_EntityMustHas_NavigateCollection(object trytbTypeName, object pnvName, object tbrefTypeName) => Language == "cn" ? + $@"【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,实体类型 {tbrefTypeName} 必须存在对应的 [Navigate(ManyToMany = x)] 集合属性" : + $@"FreeSql: [ManyToMany] Navigation property {trytbTypeName}. {pnvName} parsing error, entity type {tbrefTypeName} must have a corresponding [Navigate (ManyToMany = x)] collection property"; /// /// 【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); + public static string ManyToMany_ParsingError_InconsistentType(object trytbTypeName, object pnvName, object tbmidCsName, object trycolCsName, object trytbCsName, object trytbPrimarysCsName) => Language == "cn" ? + $@"【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,{tbmidCsName}.{trycolCsName} 和 {trytbCsName}.{trytbPrimarysCsName} 类型不一致" : + $@"FreeSql: [ManyToMany] Navigation property {trytbTypeName}. {pnvName} parsing error, {tbmidCsName}. {trycolCsName} and {trytbCsName}. {trytbPrimarysCsName} type inconsistent"; /// /// 【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); + public static string ManyToMany_ParsingError_IntermediateClass_ErrorMessage(object trytbTypeName, object pnvName, object tbmidCsName, object midTypePropsTrytbName, object exMessage) => Language == "cn" ? + $@"【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,中间类 {tbmidCsName}.{midTypePropsTrytbName} 错误:{exMessage}" : + $@"FreeSql: [ManyToMany] Navigation property {trytbTypeName}. {pnvName} parsing error, intermediate class {tbmidCsName}.{midTypePropsTrytbName} Error: {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); + public static string ManyToMany_ParsingError_IntermediateClass_NotManyToOne_OneToOne(object trytbTypeName, object pnvName, object tbmidCsName, object midTypePropsTrytbName) => Language == "cn" ? + $@"【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,中间类 {tbmidCsName}.{midTypePropsTrytbName} 导航属性不是【ManyToOne】或【OneToOne】" : + $@"FreeSql: [ManyToMany] Navigation property {trytbTypeName}. {pnvName} parsing error, intermediate class {tbmidCsName}. The {midTypePropsTrytbName} navigation property is not ManyToOne or OneToOne"; /// /// 映射异常:{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); + public static string Mapping_Exception_HasNo_SamePropertyName(object name) => Language == "cn" ? + $@"映射异常:{name} 没有一个属性名相同" : + $@"FreeSql: Mapping exception: {name} None of the property names are the same"; /// /// 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: 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); + public static string Missing_FreeSqlProvider_Package(object Provider) => Language == "cn" ? + $@"缺少 FreeSql 数据库实现包:FreeSql.Provider.{Provider}.dll,可前往 nuget 下载" : + $@"FreeSql: Missing FreeSql database implementation package: FreeSql.Provider.{Provider}.Dll, downloadable to nuget"; /// /// 缺少 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); + public static string Missing_FreeSqlProvider_Package_Reason(object dll, object providerType) => Language == "cn" ? + $@"缺少 FreeSql 数据库实现包:{dll},可前往 nuget 下载;如果存在 {dll} 依然报错(原因是环境问题导致反射不到类型),请在 UseConnectionString/UseConnectionFactory 第三个参数手工传入 typeof({{2}})" : + $@"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 ({{2}}) in the third parameter of UseConnectionString/UseConnectionFactory"; /// /// 导航属性 {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}.{1}, The number of attributes [Navigate] Binds ({2}) is different from the number of external primary keys ({3})", trytbTypeName, pnvName, bindColumnsCount, tbrefPrimarysLength); + public static string Navigation_Bind_Number_Different(object trytbTypeName, object pnvName, object bindColumnsCount, object tbrefPrimarysLength) => Language == "cn" ? + $@"导航属性 {trytbTypeName}.{pnvName} 特性 [Navigate] Bind 数目({bindColumnsCount}) 与 外部主键数目({tbrefPrimarysLength}) 不相同" : + $@"FreeSql: Navigation property {trytbTypeName}. The number of {pnvName} attributes [Navigate] Binds ({bindColumnsCount}) is different from the number of external primary keys ({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); + public static string Navigation_Missing_AsSelect(object tb2DbName, object mp2MemberName) => Language == "cn" ? + $@"{tb2DbName}.{mp2MemberName} 导航属性集合忘了 .AsSelect() 吗?如果在 ToList(a => a.{mp2MemberName}) 中使用,请移步参考 IncludeMany 文档。" : + $@"FreeSql: {tb2DbName}. {mp2MemberName} Navigation Property Collection forgotten. AsSelect()? If used in ToList (a => a. {mp2MemberName}), step by step to refer to the IncludeMany document."; /// /// 【导航属性】{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); + public static string Navigation_Missing_SetProperty(object trytbTypeDisplayCsharp, object pName) => Language == "cn" ? + $@"【导航属性】{trytbTypeDisplayCsharp}.{pName} 缺少 set 属性" : + $@"FreeSql: Navigation Properties {trytbTypeDisplayCsharp}. Missing set attribute for {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); + public static string Navigation_NotFound_CorrespondingField(object trytbTypeName, object pnvName, object findtbrefPkCsName) => Language == "cn" ? + $@"导航属性 {trytbTypeName}.{pnvName} 没有找到对应的字段,如:{pnvName}{{3}}、{pnvName}_{{3}}。或者使用 [Navigate] 特性指定关系映射。" : + $@"FreeSql: Navigation property {trytbTypeName}. {pnvName} No corresponding fields were found, such as: {pnvName}{{3}}, {pnvName}_ {{3}}. Or use the [Navigate] attribute to specify the relationship mapping."; /// /// 导航属性 {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); + public static string Navigation_ParsingError_EntityMissingPrimaryKey(object trytbTypeName, object pnvName, object trytcTypeName) => Language == "cn" ? + $@"导航属性 {trytbTypeName}.{pnvName} 解析错误,实体类型 {trytcTypeName} 缺少主键标识,[Column(IsPrimary = true)]" : + $@"FreeSql: Navigation property {trytbTypeName}. {pnvName} parsing error, entity type {trytcTypeName} missing primary key identity, [Column (IsPrimary = true)]"; /// /// 导航属性 {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); + public static string Navigation_ParsingError_InconsistentType(object trytbTypeName, object pnvName, object trytbCsName, object trycolCsName, object tbrefCsName, object tbrefPrimarysCsName) => Language == "cn" ? + $@"导航属性 {trytbTypeName}.{pnvName} 解析错误,{trytbCsName}.{trycolCsName} 和 {tbrefCsName}.{tbrefPrimarysCsName} 类型不一致" : + $@"FreeSql: Navigation property {trytbTypeName}. {pnvName} parsing error, {trytbCsName}. {trycolCsName} and {tbrefCsName}. {tbrefPrimarysCsName} type inconsistent"; /// /// 导航属性 {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); + public static string Navigation_ParsingError_NotFound_Property(object trytbTypeName, object pnvName, object tbrefTypeName, object bi) => Language == "cn" ? + $@"导航属性 {trytbTypeName}.{pnvName} 特性 [Navigate] 解析错误,在 {tbrefTypeName} 未找到属性:{bi}" : + $@"FreeSql: Navigation property {trytbTypeName}. {pnvName} attribute [Navigate] parsing error, property not found at {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 NoPrimaryKey_UseSetDto(object tableTypeDisplayCsharp) => Language == "cn" ? + $@"{tableTypeDisplayCsharp} 没有定义主键,无法使用 SetSource,请尝试 SetDto 或者 SetSource 指定临时主键" : + $@"FreeSql: {tableTypeDisplayCsharp} has no primary key defined and cannot use SetSource. Try SetDto"; /// /// 没有定义属性 /// @@ -471,21 +471,21 @@ namespace FreeSql /// /// 未实现函数表达式 {exp} 解析 /// - public static string Not_Implemented_Expression(object exp) => string.Format(Language == "cn" ? - @"未实现函数表达式 {0} 解析" : - @"FreeSql: Function expression {0} parsing not implemented", exp); + public static string Not_Implemented_Expression(object exp) => Language == "cn" ? + $@"未实现函数表达式 {exp} 解析" : + $@"FreeSql: Function expression {exp} parsing not implemented"; /// /// 未实现函数表达式 {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); + public static string Not_Implemented_Expression_ParameterUseConstant(object exp, object expArguments) => Language == "cn" ? + $@"未实现函数表达式 {exp} 解析,参数 {expArguments} 必须为常量" : + $@"FreeSql: Function expression {exp} parsing not implemented, parameter {expArguments} must be constant"; /// /// 未实现函数表达式 {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); + public static string Not_Implemented_Expression_UseAsSelect(object exp, object exp3MethodName, object exp3ArgumentsCount) => Language == "cn" ? + $@"未实现函数表达式 {exp} 解析,如果正在操作导航属性集合,请使用 .AsSelect().{exp3MethodName}({exp3ArgumentsCount})" : + $@"FreeSql: Function expression {exp} parsing is not implemented. Use if you are working on a navigation property collection. AsSelect (). {exp3MethodName} ({exp3ArgumentsCount})"; /// /// 未实现 MemberAccess 下的 Constant /// @@ -495,9 +495,9 @@ namespace FreeSql /// /// 未实现 {name} /// - public static string Not_Implemented_Name(object name) => string.Format(Language == "cn" ? - @"未实现 {0}" : - @"FreeSql: {0} is not implemented", name); + public static string Not_Implemented_Name(object name) => Language == "cn" ? + $@"未实现 {name}" : + $@"FreeSql: {name} is not implemented"; /// /// 不支持 /// @@ -507,57 +507,57 @@ namespace FreeSql /// /// {dataType} 不支持 OrderByRandom 随机排序 /// - public static string Not_Support_OrderByRandom(object dataType) => string.Format(Language == "cn" ? - @"{0} 不支持 OrderByRandom 随机排序" : - @"FreeSql: {0} does not support OrderByRandom sorting", dataType); + public static string Not_Support_OrderByRandom(object dataType) => Language == "cn" ? + $@"{dataType} 不支持 OrderByRandom 随机排序" : + $@"FreeSql: {dataType} does not support OrderByRandom sorting"; /// /// {property} 不是有效的导航属性 /// - public static string Not_Valid_Navigation_Property(object property) => string.Format(Language == "cn" ? - @"{0} 不是有效的导航属性" : - @"FreeSql: {0} is not a valid navigation property", property); + public static string Not_Valid_Navigation_Property(object property) => Language == "cn" ? + $@"{property} 不是有效的导航属性" : + $@"FreeSql: {property} is not a valid navigation 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); + public static string NotFound_Column(object dbName, object memberName) => Language == "cn" ? + $@"{dbName} 找不到列 {memberName}" : + $@"FreeSql: {dbName} Column {memberName} not found"; /// /// 找不到 {CsName} 对应的列 /// - public static string NotFound_CsName_Column(object CsName) => string.Format(Language == "cn" ? - @"找不到 {0} 对应的列" : - @"FreeSql: Cannot find the column corresponding to {0}", CsName); + public static string NotFound_CsName_Column(object CsName) => Language == "cn" ? + $@"找不到 {CsName} 对应的列" : + $@"FreeSql: Cannot find the column corresponding to {CsName}"; /// /// 找不到属性:{memberName} /// - public static string NotFound_Property(object memberName) => string.Format(Language == "cn" ? - @"找不到属性:{0}" : - @"FreeSql: Attribute not found: {0}", memberName); + public static string NotFound_Property(object memberName) => Language == "cn" ? + $@"找不到属性:{memberName}" : + $@"FreeSql: Attribute not found: {memberName}"; /// /// 找不到属性名 {proto} /// - public static string NotFound_PropertyName(object proto) => string.Format(Language == "cn" ? - @"找不到属性名 {0}" : - @"FreeSql: Property name {0} not found", proto); + public static string NotFound_PropertyName(object proto) => Language == "cn" ? + $@"找不到属性名 {proto}" : + $@"FreeSql: Property name {proto} not found"; /// /// 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); + public static string NotFound_Reflection(object fiValueCustomArray) => Language == "cn" ? + $@"Custom 找不到对应的{{{{ 反射信息 }}}}:{fiValueCustomArray}" : + $@"FreeSql: Custom could not find the corresponding {{{{reflection information}}}}:{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); + public static string NotFound_Static_MethodName(object fiValueCustomArray) => Language == "cn" ? + $@"Custom 找不到对应的{{{{ 静态方法名 }}}}:{fiValueCustomArray}" : + $@"FreeSql: Custom could not find the corresponding {{{{static method name}}}}:{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); + public static string NotFound_Table_Property_AsTable(object atmGroupsValue) => Language == "cn" ? + $@"[Table(AsTable = xx)] 设置的属性名 {atmGroupsValue} 不存在" : + $@"FreeSql: The property name {atmGroupsValue} set by [Table(AsTable = xx)] does not exist"; /// /// 未指定 UseConnectionString 或者 UseConnectionFactory /// @@ -567,33 +567,33 @@ namespace FreeSql /// /// 【{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); + public static string ObjectPool_Get_Timeout(object policyName, object GetName, object totalSeconds) => Language == "cn" ? + $@"【{policyName}】ObjectPool.{GetName}() timeout {totalSeconds} seconds, see: https://github.com/dotnetcore/FreeSql/discussions/1081" : + $@"FreeSql: [{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} + /// 【{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); + public static string ObjectPool_GetAsync_Queue_Long(object policyName, object asyncGetCapacity) => Language == "cn" ? + $@"【{policyName}】ObjectPool.GetAsync() The queue is too long. Policy.AsyncGetCapacity = {asyncGetCapacity}" : + $@"FreeSql: [{policyName}] ObjectPool. GetAsync() The queue is too long. Policy. AsyncGetCapacity = {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); + public static string OneToMany_NotFound_CorrespondingField(object trytbTypeName, object pnvName, object tbrefCsName, object findtrytb, object findtrytbPkCsName) => Language == "cn" ? + $@"【OneToMany】导航属性 {trytbTypeName}.{pnvName} 在 {tbrefCsName} 中没有找到对应的字段,如:{findtrytb}{findtrytbPkCsName}、{findtrytb}_{findtrytbPkCsName}" : + $@"FreeSql: [OneToMany] Navigation property {trytbTypeName}.{pnvName} did not find a corresponding field in {tbrefCsName}, such as: {findtrytb}{findtrytbPkCsName}, {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); + public static string OneToMany_ParsingError_InconsistentType(object trytbTypeName, object pnvName, object trytbCsName, object trytbPrimarysCsName, object tbrefCsName, object trycolCsName) => Language == "cn" ? + $@"【OneToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,{trytbCsName}.{trytbPrimarysCsName} 和 {tbrefCsName}.{trycolCsName} 类型不一致" : + $@"FreeSql: [OneToMany] Navigation property {trytbTypeName}.{pnvName} parsing error, {trytbCsName}.{trytbPrimarysCsName} and {tbrefCsName}.{trycolCsName} is of inconsistent type"; /// /// 、{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); + public static string OneToMany_UseNavigate(object refpropName, object findtrytbPkCsName) => Language == "cn" ? + $@"、{refpropName}{findtrytbPkCsName}、{refpropName}_{findtrytbPkCsName}。或者使用 [Navigate] 特性指定关系映射。" : + $@", {refpropName}{findtrytbPkCsName}, {refpropName}_{findtrytbPkCsName}. Or use the [Navigate] attribute to specify the relationship mapping."; /// /// 参数 field 未指定 /// @@ -603,51 +603,51 @@ namespace FreeSql /// /// {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); + public static string ParameterError_NotValid_Collection(object property) => Language == "cn" ? + $@"{property} 参数错误,它不是集合属性,必须为 IList 或者 ICollection" : + $@"FreeSql: The {property} parameter is incorrect, it is not a collection property and must be IListor ICollection"; /// /// {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); + public static string ParameterError_NotValid_Navigation(object property) => Language == "cn" ? + $@"{property} 参数错误,它不是有效的导航属性" : + $@"FreeSql: The {property} parameter is incorrect, it is not a valid navigation 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); + public static string ParameterError_NotValid_PropertyName(object where, object keyval, object reftbTypeDisplayCsharp) => Language == "cn" ? + $@"{where} 参数错误,{keyval} 不是有效的属性名,在实体类 {reftbTypeDisplayCsharp} 无法找到" : + $@"FreeSql: {where} parameter error, {keyval} is not a valid property name and cannot be found in entity class {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); + public static string ParameterError_NotValid_UseCommas(object property) => Language == "cn" ? + $@"{property} 参数错误,格式 ""TopicId=Id,多组使用逗号连接"" " : + $@"FreeSql: {property} parameter error, format ""TopicId=Id, multiple groups using comma connection"""; /// /// 解析失败 {callExpMethodName} {message} /// - public static string Parsing_Failed(object callExpMethodName, object message) => string.Format(Language == "cn" ? - @"解析失败 {0} {1}" : - @"FreeSql: Parsing failed {0} {1}", callExpMethodName, message); + public static string Parsing_Failed(object callExpMethodName, object message) => Language == "cn" ? + $@"解析失败 {callExpMethodName} {message}" : + $@"FreeSql: Parsing failed {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); + public static string Policy_ObjectPool_Dispose(object policyName) => Language == "cn" ? + $@"【{policyName}】The ObjectPool has been disposed, see: https://github.com/dotnetcore/FreeSql/discussions/1079" : + $@"FreeSql: [{policyName}] The ObjectPool has been disposed, see: https://github.com/dotnetcore/FreeSql/discussions/1079"; /// /// 【{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); + public static string Policy_Status_NotAvailable(object policyName, object UnavailableExceptionMessage) => Language == "cn" ? + $@"【{policyName}】状态不可用,等待后台检查程序恢复方可使用。{UnavailableExceptionMessage}" : + $@"FreeSql: The {policyName} status is unavailable and cannot be used until the background checker is restored. {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); + public static string Properties_AsRowLock_Must_Numeric_Byte(object trytbVersionColumnCsName) => Language == "cn" ? + $@"属性{trytbVersionColumnCsName} 被标注为行锁(乐观锁)(IsVersion),但其必须为数字类型 或者 byte[] 或者 string,并且不可为 Nullable" : + $@"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"; /// /// properties 参数不能为空 /// @@ -657,9 +657,9 @@ namespace FreeSql /// /// {property} 属性名无法找到 /// - public static string Property_Cannot_Find(object property) => string.Format(Language == "cn" ? - @"{0} 属性名无法找到" : - @"FreeSql: {0} property name not found", property); + public static string Property_Cannot_Find(object property) => Language == "cn" ? + $@"{property} 属性名无法找到" : + $@"FreeSql: {property} property name not found"; /// /// Range 要求 Value 应该逗号分割,并且长度为 2 /// @@ -681,15 +681,15 @@ namespace FreeSql /// /// {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); + public static string Set_Column_IsNullable_False(object qoteSql) => Language == "cn" ? + $@"{qoteSql} is NULL,除非设置特性 [Column(IsNullable = false)]" : + $@"FreeSql: {qoteSql} is NULL unless the attribute [Column (IsNullable = false)]"; /// /// 分表字段值 "{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); + public static string SubTableFieldValue_CannotLessThen(object dt, object beginTime) => Language == "cn" ? + $@"分表字段值 ""{dt}"" 不能小于 ""{beginTime} """ : + $@"FreeSql: Subtable field value'{dt}'cannot be less than'{beginTime}'"; /// /// 分表字段值不能为 null /// @@ -699,15 +699,15 @@ namespace FreeSql /// /// 分表字段值 "{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); + public static string SubTableFieldValue_NotConvertDateTime(object columnValue) => Language == "cn" ? + $@"分表字段值 ""{columnValue}"" 不能转化成 DateTime" : + $@"FreeSql: The tabular field value'{columnValue}'cannot be converted to DateTime"; /// /// 分表字段值 "{dt}" 未匹配到分表名 /// - public static string SubTableFieldValue_NotMatchTable(object dt) => string.Format(Language == "cn" ? - @"分表字段值 ""{0}"" 未匹配到分表名" : - @"FreeSql: Table field value'{0}'does not match table name", dt); + public static string SubTableFieldValue_NotMatchTable(object dt) => Language == "cn" ? + $@"分表字段值 ""{dt}"" 未匹配到分表名" : + $@"FreeSql: Table field value'{dt}'does not match table name"; /// /// T2 类型错误 /// @@ -717,63 +717,63 @@ namespace FreeSql /// /// 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); + public static string TableName_Format_Error(object yyyyMMdd) => Language == "cn" ? + $@"tableName 格式错误,示例:“log_{yyyyMMdd}”" : + $@"FreeSql: TableName format error, example: ""log_{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); + public static string Type_AsType_Parameter_Error(object Type) => Language == "cn" ? + $@"{Type}.AsType 参数错误,请传入正确的实体类型" : + $@"FreeSql: {Type}.AsType parameter error, please pass in the correct entity 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); + public static string Type_Cannot_Access_Constructor(object thatFullName) => Language == "cn" ? + $@"{thatFullName} 类型无法访问构造函数" : + $@"FreeSql: The {thatFullName} type cannot access the constructor"; /// /// {name} 类型错误 /// - public static string Type_Error_Name(object name) => string.Format(Language == "cn" ? - @"{0} 类型错误" : - @"FreeSql: {0} type error", name); + public static string Type_Error_Name(object name) => Language == "cn" ? + $@"{name} 类型错误" : + $@"FreeSql: {name} type error"; /// /// {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); + public static string TypeAsType_NotSupport_Object(object Type) => Language == "cn" ? + $@"{Type}.AsType 参数不支持指定为 object" : + $@"FreeSql: {Type}.AsType parameter does not support specifying as object"; /// /// 类型 {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); + public static string TypeError_CannotUse_IncludeMany(object typeofFullName) => Language == "cn" ? + $@"类型 {typeofFullName} 错误,不能使用 IncludeMany" : + $@"FreeSql: Type {typeofFullName} error, IncludeMany cannot be used"; /// /// 无法解析表达式:{exp} /// - public static string Unable_Parse_Expression(object exp) => string.Format(Language == "cn" ? - @"无法解析表达式:{0}" : - @"FreeSql: Unable to parse expression: {0}", exp); + public static string Unable_Parse_Expression(object exp) => Language == "cn" ? + $@"无法解析表达式:{exp}" : + $@"FreeSql: Unable to parse expression: {exp}"; /// /// 无法解析表达式方法 {exp3tmpCallMethodName} /// - public static string Unable_Parse_ExpressionMethod(object exp3tmpCallMethodName) => string.Format(Language == "cn" ? - @"无法解析表达式方法 {0}" : - @"FreeSql: Unable to parse expression method {0}", exp3tmpCallMethodName); + public static string Unable_Parse_ExpressionMethod(object exp3tmpCallMethodName) => Language == "cn" ? + $@"无法解析表达式方法 {exp3tmpCallMethodName}" : + $@"FreeSql: Unable to parse expression method {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"; + @"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_NotFound_Name(object name) => Language == "cn" ? + $@"找不到 {name}" : + $@"FreeSql: {name} not found"; /// /// 从库 /// @@ -791,25 +791,25 @@ namespace FreeSql /// public static string S_Access_InsertOnlyOneAtTime => Language == "cn" ? @"蛋疼的 Access 插入只能一条一条执行,不支持 values(..),(..) 也不支持 select .. UNION ALL select .." : - @"FreeSql: values (..),(..) are not supported"; + @"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"; + @"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); + public static string S_BlockAccess_WaitForRecovery(object thisName, object exMessage) => Language == "cn" ? + $@"【{thisName}】Block access and wait for recovery: {exMessage}" : + $@"FreeSql: [{thisName}] Block access and wait for recovery: {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_CannotBeConverted_To_ISelect(object typeofName) => Language == "cn" ? + $@"无法将 IQueryable<{typeofName}> 转换为 ISelect<{typeofName}>,因为他的实现不是 FreeSql.Extensions.Linq.QueryableProvider" : + $@"FreeSql: IQueryable<{typeofName}> cannot be converted to ISelect<{typeofName}> because its implementation is not FreeSql.Extensions.Linq.QueryableProvider"; /// /// 连接字符串错误 /// @@ -819,9 +819,9 @@ namespace FreeSql /// /// 【{thisName}】连接字符串错误,请检查。 /// - public static string S_ConnectionStringError_Check(object thisName) => string.Format(Language == "cn" ? - @"【{0}】连接字符串错误,请检查。" : - @"FreeSql: [{0}] Connection string error, please check.", thisName); + public static string S_ConnectionStringError_Check(object thisName) => Language == "cn" ? + $@"【{thisName}】连接字符串错误,请检查。" : + $@"FreeSql: [{thisName}] Connection string error, please check."; /// /// 连接字符串错误,或者检查项目属性 &gt; 生成 &gt; 目标平台:x86 | x64,或者改用 FreeSql.Provider.SqliteCore 访问 arm 平台 /// @@ -831,9 +831,9 @@ namespace FreeSql /// /// 【{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); + public static string S_ConnectionStringError_CheckProjectConnection(object thisName) => Language == "cn" ? + $@"【{thisName}】连接字符串错误,请检查。或者检查项目属性 > 生成 > 目标平台:x86 | x64,或者改用 FreeSql.Provider.SqliteCore 访问 arm 平台" : + $@"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.Provider.CustomAdapter 无法使用 CreateCommand /// @@ -849,9 +849,9 @@ namespace FreeSql /// /// 达梦 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); + public static string S_Dameng_NotSupport_TablespaceSchemas(object tbname) => Language == "cn" ? + $@"达梦 CodeFirst 不支持代码创建 tablespace 与 schemas {tbname}" : + $@"FreeSql: Dream CodeFirst does not support code creation tablespace and schemas {tbname}"; /// /// -DB 参数错误,未提供 ConnectionString /// @@ -867,15 +867,15 @@ namespace FreeSql /// /// -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); + public static string S_DB_ParameterError_UnsupportedType(object dbargs) => Language == "cn" ? + $@"-DB 参数错误,不支持的类型:""{dbargs}""" : + $@"FreeSql: -DB parameter error, unsupported type: ""{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); + public static string S_Features_Unique(object method, object provider) => Language == "cn" ? + $@"{method} 是 FreeSql.Provider.{provider} 特有的功能" : + $@"FreeSql: {method} is FreeSql.Provider.{provider} specific features"; /// /// fsql.InsertOrUpdate Sqlite 无法完成 UpdateColumns 操作 /// @@ -885,9 +885,9 @@ namespace FreeSql /// /// 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); + public static string S_MygisGeometry_NotImplement(object wkt) => Language == "cn" ? + $@"MygisGeometry.Parse 未实现 ""{wkt}""" : + $@"FreeSql: MygisGeometry. Parse does not implement ""{wkt}"""; /// /// -NameOptions 参数错误,格式为:0,0,0,0 /// @@ -909,15 +909,15 @@ namespace FreeSql /// /// 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); + public static string S_NotImplementSkipOffset(object providerName) => Language == "cn" ? + $@"FreeSql.Provider.{providerName} 未实现 Skip/Offset 功能,如果需要分页请使用判断上一次 id" : + $@"FreeSql: FreeSql.Provider.{providerName} does not implement Skip/Offset functionality, use to determine last ID if paging is required"; /// /// 旧表(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); + public static string S_OldTableExists(object tboldname, object tbname) => Language == "cn" ? + $@"旧表(OldName):{tboldname} 存在,数据库已存在 {tbname} 表,无法改名" : + $@"FreeSql: Old table (OldName): {tboldname} exists, database already exists {tbname} table, cannot rename"; /// /// OnConflictDoUpdate 功能要求实体类必须设置 IsPrimary 属性 /// @@ -927,51 +927,51 @@ namespace FreeSql /// /// 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); + public static string S_Oracle_NotSupport_TablespaceSchemas(object tbname) => Language == "cn" ? + $@"Oracle CodeFirst 不支持代码创建 tablespace 与 schemas {tbname}" : + $@"FreeSql: Oracle CodeFirst does not support code creation of tablespace and schemas {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.RestoreToSelect() can be used", callExpMethodName, message); + public static string S_ParsingFailed_UseRestoreToSelect(object callExpMethodName, object message) => Language == "cn" ? + $@"解析失败 {callExpMethodName} {message},提示:可以使用扩展方法 IQueryable.RestoreToSelect() 还原为 ISelect 再查询" : + $@"FreeSql: Parsing failed {callExpMethodName} {message}, hint: Extension method IQueryable can be used. RestoreToSelect() reverted to ISelect re-query"; /// /// 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); + public static string S_RequiresEntityPrimaryKey(object providerName, object tableCsName) => Language == "cn" ? + $@"fsql.InsertOrUpdate + IfExistsDoNothing + {providerName}要求实体类 {tableCsName} 必须有主键" : + $@"FreeSql: InsertOrUpdate + IfExistsDoNothing + {providerName} requires the entity class {tableCsName} to have a primary key"; /// /// SelectMany 错误的类型:{typeFullName} /// - public static string S_SelectManayErrorType(object typeFullName) => string.Format(Language == "cn" ? - @"SelectMany 错误的类型:{0}" : - @"FreeSql: SelectMany error type: {0}", typeFullName); + public static string S_SelectManayErrorType(object typeFullName) => Language == "cn" ? + $@"SelectMany 错误的类型:{typeFullName}" : + $@"FreeSql: SelectMany error type: {typeFullName}"; /// /// 类型 {objentityTypeFullName} 不可迁移 /// - public static string S_Type_IsNot_Migrable(object objentityTypeFullName) => string.Format(Language == "cn" ? - @"类型 {0} 不可迁移" : - @"FreeSql: Type {0} is not migrable", objentityTypeFullName); + public static string S_Type_IsNot_Migrable(object objentityTypeFullName) => Language == "cn" ? + $@"类型 {objentityTypeFullName} 不可迁移" : + $@"FreeSql: Type {objentityTypeFullName} is not migrable"; /// /// 类型 {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); + public static string S_Type_IsNot_Migrable_0Attributes(object objentityTypeFullName) => Language == "cn" ? + $@"类型 {objentityTypeFullName} 不可迁移,可迁移属性0个" : + $@"FreeSql: Type {objentityTypeFullName} is not migrable, migratable property 0"; /// /// 未实现 {columnDbTypeTextFull} 类型映射 /// - public static string S_TypeMappingNotImplemented(object columnDbTypeTextFull) => string.Format(Language == "cn" ? - @"未实现 {0} 类型映射" : - @"FreeSql: {0} type mapping not implemented", columnDbTypeTextFull); + public static string S_TypeMappingNotImplemented(object columnDbTypeTextFull) => Language == "cn" ? + $@"未实现 {columnDbTypeTextFull} 类型映射" : + $@"FreeSql: {columnDbTypeTextFull} type mapping not implemented"; /// /// 错误的参数设置:{args} /// - public static string S_WrongParameter(object args) => string.Format(Language == "cn" ? - @"错误的参数设置:{0}" : - @"FreeSql: Wrong parameter setting: {0}", args); + public static string S_WrongParameter(object args) => Language == "cn" ? + $@"错误的参数设置:{args}" : + $@"FreeSql: Wrong parameter setting: {args}"; /// /// 对象池 /// @@ -2019,7 +2019,13 @@ for (var a= 0; a < datas.length; a++) { 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(', ') + ');'; + var cn = cn.replace(/"/g, '""').replace(/\{/g, '{{').replace(/\}/g, '}}'); + var en = en.replace(/"/g, '""').replace(/\{/g, '{{').replace(/\}/g, '}}'); + for (var b = 0; b < csargs.length; b++) { + cn = cn.replace(new RegExp('\\{\\{' + b + '\\}\\}', 'g'), '{' + csargs[b] + '}'); + en = en.replace(new RegExp('\\{\\{' + b + '\\}\\}', 'g'), '{' + csargs[b] + '}'); + } + sb += ') => Language == "cn" ? \r\n $@"' + cn + '" : \r\n $@"' + en + '";'; } } sb += '\r\n}\r\n';