From 1f21dd72d9f91820ab456a5fb92d1477e107f0d1 Mon Sep 17 00:00:00 2001 From: 2881099 <2881099@qq.com> Date: Fri, 8 Nov 2024 17:40:42 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E4=BC=98=E5=8C=96=20ISelect.WithMe?= =?UTF-8?q?mory=20=E5=AF=B9=E5=8C=BF=E5=90=8D=E7=B1=BB=E5=9E=8B=E7=9A=84?= =?UTF-8?q?=E6=94=AF=E6=8C=81=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DbContext/DbContextErrorStrings.cs | 8 +- FreeSql.DbContext/FreeSql.DbContext.xml | 17 - FreeSql/FreeSql.xml | 301 +----------------- FreeSql/Internal/CommonExpression.cs | 2 + .../SelectProvider/Select1Provider.cs | 76 ++++- .../Internal/Exception/CoreErrorStrings.cs | 80 ++--- 6 files changed, 106 insertions(+), 378 deletions(-) diff --git a/FreeSql.DbContext/DbContext/DbContextErrorStrings.cs b/FreeSql.DbContext/DbContext/DbContextErrorStrings.cs index e989c07c6..681b22d29 100644 --- a/FreeSql.DbContext/DbContext/DbContextErrorStrings.cs +++ b/FreeSql.DbContext/DbContext/DbContextErrorStrings.cs @@ -110,7 +110,7 @@ public static string CannotUpdate_RecordDoesNotExist(object entityString) => str /// 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},无法使用该方法 /// @@ -134,7 +134,7 @@ public static string EntityType_PrimaryKeyIsNotOne(object EntityTypeName) => str /// 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} /// @@ -158,7 +158,7 @@ public static string InsertError_Filter(object filterKey, object filterValueExpr /// 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} /// @@ -170,7 +170,7 @@ public static string NotFound_Property(object propertyName, object tableTypeFull /// public static string NotFoundMethod_StatesRemoveByObjects => Language == "cn" ? @"找不到方法 DbSet<>.StatesRemoveByObjects" : - @"FreeSql: Method DbSet<> not found. StatesRemoveByObjects"; + @"FreeSql: Method not found DbSet<>.StatesRemoveByObjects"; /// /// 参数 data 类型错误 {entityTypeFullName} /// diff --git a/FreeSql.DbContext/FreeSql.DbContext.xml b/FreeSql.DbContext/FreeSql.DbContext.xml index c941a15d9..08ab7dc4c 100644 --- a/FreeSql.DbContext/FreeSql.DbContext.xml +++ b/FreeSql.DbContext/FreeSql.DbContext.xml @@ -712,15 +712,6 @@ - - - 根据Assembly扫描所有继承IEntityTypeConfiguration<T>的配置类 - - - - - - 创建普通数据上下文档对象 @@ -758,13 +749,5 @@ - - - 批量注入 Repository,可以参考代码自行调整 - - - - - diff --git a/FreeSql/FreeSql.xml b/FreeSql/FreeSql.xml index 442d3c3e2..2a6e277ba 100644 --- a/FreeSql/FreeSql.xml +++ b/FreeSql/FreeSql.xml @@ -1087,93 +1087,6 @@ - - - 动态创建实体类型 - - - - - 配置Class - - 类名 - 类标记的特性[Table(Name = "xxx")] [Index(xxxx)] - - - - - 获取类型构建器,可作为要构建的Type来引用 - - - - - 配置属性 - - 属性名称 - 属性类型 - 属性标记的特性-支持多个 - - - - - 配置属性 - - 属性名称 - 属性类型 - 该属性是否重写父类属性 - 属性标记的特性-支持多个 - - - - - 配置属性 - - 属性名称 - 属性类型 - 该属性是否重写父类属性 - 属性默认值 - 属性标记的特性-支持多个 - - - - - 配置父类 - - 父类类型 - - - - - Override属性 - - - - - - Emit动态创建出Class - Type - - - - - - Emit动态创建出Class - Type,不附带获取TableInfo - - - - - - 首字母小写 - - - - - - - 首字母大写 - - - - 获取实体的主键值,以 "*|_,[,_|*" 分割,当任意一个主键属性无值时,返回 "" @@ -3376,13 +3289,6 @@ - - - 执行SQL语句,返回更新后的记录 - 注意:此方法只有 Postgresql/SqlServer 有效果 - - - 指定事务对象 @@ -3727,177 +3633,6 @@ - - - 测试数据库是否连接正确,本方法执行如下命令: - MySql/SqlServer/PostgreSQL/达梦/人大金仓/神通: SELECT 1 - Oracle: SELECT 1 FROM dual - - 命令超时设置(秒) - - true: 成功, false: 失败 - - - - 查询,若使用读写分离,查询【从库】条件cmdText.StartsWith("SELECT "),否则查询【主库】 - - - - - - - - - - 查询,ExecuteReaderAsync(dr => {}, "select * from user where age > @age", new { age = 25 }) - 提示:parms 参数还可以传 Dictionary<string, object> - - - - - - - - - 查询 - - - - - - - - - 查询,ExecuteArrayAsync("select * from user where age > @age", new { age = 25 }) - 提示:parms 参数还可以传 Dictionary<string, object> - - - - - - - - - 查询 - - - - - - - - - 查询,ExecuteDataSetAsync("select * from user where age > @age; select 2", new { age = 25 }) - 提示:parms 参数还可以传 Dictionary<string, object> - - - - - - - - - 查询 - - - - - - - - - 查询,ExecuteDataTableAsync("select * from user where age > @age", new { age = 25 }) - 提示:parms 参数还可以传 Dictionary<string, object> - - - - - - - - - 在【主库】执行 - - - - - - - - - 在【主库】执行,ExecuteNonQueryAsync("delete from user where age > @age", new { age = 25 }) - 提示:parms 参数还可以传 Dictionary<string, object> - - - - - - - - - 在【主库】执行 - - - - - - - - - 在【主库】执行,ExecuteScalarAsync("select 1 from user where age > @age", new { age = 25 }) - 提示:parms 参数还可以传 Dictionary<string, object> - - - - - - - - - 执行SQL返回对象集合,QueryAsync<User>("select * from user where age > @age", new SqlParameter { ParameterName = "age", Value = 25 }) - - - - - - - - - - - 执行SQL返回对象集合,QueryAsync<User>("select * from user where age > @age", new { age = 25 }) - 提示:parms 参数还可以传 Dictionary<string, object> - - - - - - - - - - 执行SQL返回对象集合,Query<User>("select * from user where age > @age; select * from address", new SqlParameter { ParameterName = "age", Value = 25 }) - - - - - - - - - - - - 执行SQL返回对象集合,Query<User, Address>("select * from user where age > @age; select * from address", new { age = 25 }) - 提示:parms 参数还可以传 Dictionary<string, object> - - - - - - - - 可自定义解析表达式 @@ -4897,12 +4632,6 @@ 超时 - - - 获取资源 - - - 使用完毕后,归还资源 @@ -4978,12 +4707,6 @@ 资源对象 - - - 从对象池获取对象成功的时候触发,通过该方法统计或初始化对象 - - 资源对象 - 归还对象给对象池的时候触发 @@ -5559,7 +5282,7 @@ - 【{policyName}】ObjectPool.GetAsync() The queue is too long. Policy.AsyncGetCapacity = {asyncGetCapacity} + 【{policyName}】ObjectPool.GetAsync() The queue is too long, Policy.AsyncGetCapacity = {asyncGetCapacity} @@ -5897,28 +5620,6 @@ 对象池 - - - 动态构建Class Type - - - - - - 根据字典,创建 table 对应的实体对象 - - - - - - - - 根据实体对象,创建 table 对应的字典 - - - - - C#: that >= between && that <= and diff --git a/FreeSql/Internal/CommonExpression.cs b/FreeSql/Internal/CommonExpression.cs index 33774c440..1d34f6934 100644 --- a/FreeSql/Internal/CommonExpression.cs +++ b/FreeSql/Internal/CommonExpression.cs @@ -2136,6 +2136,8 @@ exp4.Expression is MethodCallExpression exp4CallExp && //判断 [JsonMap] 并非导航对象,所以在上面提前判断 ColumnsByCs var tb2tmp = _common.GetTableByEntity(exp2Type); + if (tb2tmp == null && exp2.NodeType == ExpressionType.Parameter && exp2Type.IsAnonymousType()) + tb2tmp = tsc._tables.Find(a => a.Parameter == exp2)?.Table; var exp2IsParameter = false; if (tb2tmp != null) { diff --git a/FreeSql/Internal/CommonProvider/SelectProvider/Select1Provider.cs b/FreeSql/Internal/CommonProvider/SelectProvider/Select1Provider.cs index 453ddf5bb..67574b57e 100644 --- a/FreeSql/Internal/CommonProvider/SelectProvider/Select1Provider.cs +++ b/FreeSql/Internal/CommonProvider/SelectProvider/Select1Provider.cs @@ -584,30 +584,72 @@ public ISelect WithMemory(IEnumerable source) { var list = source?.Select(a => (object)a).ToList(); if (list.Any() != true) throw new Exception(CoreErrorStrings.Cannot_Be_NULL_Name(nameof(source))); - var sb = new StringBuilder(); - (_orm.InsertOrUpdate().AsType(_tables[0].Table.Type) as InsertOrUpdateProvider) - .WriteSourceSelectUnionAll(list, sb, _params, true); - try + if (_tables[0].Table.Type != typeof(TDto)) { - if (typeof(T1) != typeof(TDto)) + if (_orm.CodeFirst.IsAutoSyncStructure) + (_orm.CodeFirst as CodeFirstProvider)._dicSycedTryAdd(typeof(TDto)); //._dicSyced.TryAdd(typeof(TReturn), true); + var ret = (_orm as BaseDbProvider).CreateSelectProvider(null) as Select1Provider; + ret._commandTimeout = _commandTimeout; + ret._connection = _connection; + ret._transaction = _transaction; + ret._whereGlobalFilter = new List(_whereGlobalFilter.ToArray()); + ret._cancel = _cancel; + ret._params.AddRange(_params); + if (ret._tables[0].Table == null) { - if (_orm.CodeFirst.IsAutoSyncStructure) - (_orm.CodeFirst as CodeFirstProvider)._dicSycedTryAdd(typeof(TDto)); //._dicSyced.TryAdd(typeof(TReturn), true); - var ret = (_orm as BaseDbProvider).CreateSelectProvider(null) as Select1Provider; - ret._commandTimeout = _commandTimeout; - ret._connection = _connection; - ret._transaction = _transaction; - ret._whereGlobalFilter = new List(_whereGlobalFilter.ToArray()); - ret._cancel = _cancel; - ret._params.AddRange(_params); - if (ret._tables[0].Table == null) ret._tables[0].Table = TableInfo.GetDefaultTable(typeof(TDto)); + var table = TableInfo.GetDefaultTable(typeof(TDto)); + var colpos = new List(); + foreach (var kv in table.Properties) + { + var colName = kv.Key; + if (string.IsNullOrWhiteSpace(colName)) continue; + var colType = kv.Value.PropertyType; + if (_orm.CodeFirst.IsSyncStructureToLower) colName = colName.ToLower(); + if (_orm.CodeFirst.IsSyncStructureToUpper) colName = colName.ToUpper(); + var col = new ColumnInfo + { + CsName = kv.Key, + Table = table, + Attribute = new DataAnnotations.ColumnAttribute + { + Name = colName, + MapType = colType + }, + CsType = colType + }; + table.Columns.Add(colName, col); + table.ColumnsByCs.Add(kv.Key, col); + colpos.Add(col); + } + table.ColumnsByPosition = colpos.ToArray(); + colpos.Clear(); + ret._tables[0].Table = table; + } + var sb = new StringBuilder(); + try + { + var upset = _orm.InsertOrUpdate() as InsertOrUpdateProvider; + upset._table = ret._tables[0].Table; + upset.WriteSourceSelectUnionAll(list, sb, _params, true); ret.WithSql(sb.ToString()); return ret; } - return WithSql(sb.ToString()) as ISelect; + finally { sb.Clear(); } + } + if (_tables[0].Table.Type != typeof(object)) + { + var sb = new StringBuilder(); + try + { + var upset = _orm.InsertOrUpdate() as InsertOrUpdateProvider; + upset._table = _tables[0].Table; + upset.WriteSourceSelectUnionAll(list, sb, _params, true); + return WithSql(sb.ToString()) as ISelect; + } + finally { sb.Clear(); } } - finally { sb.Clear(); } + throw new Exception(CoreErrorStrings.TypeAsType_NotSupport_Object("Select")); } public ISelect WithTempQuery(Expression> selector) => InternalWithTempQuery(selector); diff --git a/FreeSql/Internal/Exception/CoreErrorStrings.cs b/FreeSql/Internal/Exception/CoreErrorStrings.cs index 95baa0b40..4aeee2784 100644 --- a/FreeSql/Internal/Exception/CoreErrorStrings.cs +++ b/FreeSql/Internal/Exception/CoreErrorStrings.cs @@ -127,7 +127,7 @@ public static string Custom_StaticMethodName_NotSet_DynamicFilterCustom(object f /// 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); + @"FreeSql: The data type of the operation ({0}) is inconsistent with AsType({1}), Please check.", dataDisplayCsharp, tableTypeDisplayCsharp); /// /// DateRange 要求 Value 应该逗号分割,并且长度为 2 /// @@ -157,7 +157,7 @@ public static string DbUpdateVersionException_RowLevelOptimisticLock(object sour /// 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); + @"FreeSql: ColumnAttribute.Name {0} exists repeatedly, please check (note: case insensitive)", colattrName); /// /// 属性名 {pName} 重复存在,请检查(注意:不区分大小写) /// @@ -247,7 +247,7 @@ public static string Has_Specified_Cannot_Specified_Second(object first, object /// 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); + @"FreeSql: {0}.{1} is ignored, Check the IsIgnore setting to make sure get/set is public", tb2DbName, mp2MemberName); /// /// Include 参数类型错误 /// @@ -301,13 +301,13 @@ public static string IncludeMany_ParameterTypeError(object navigateSelector) => /// 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); + @"FreeSql: ISelect.InsertInto() did not select an attribute: {0}", displayCsharp); /// /// ISelect.InsertInto() 类型错误: {displayCsharp} /// public static string InsertInto_TypeError(object displayCsharp) => string.Format(Language == "cn" ? @"ISelect.InsertInto() 类型错误: {0}" : - @"FreeSql: ISelect. InsertInto() type error: {0}", displayCsharp); + @"FreeSql: ISelect.InsertInto() type error: {0}", displayCsharp); /// /// InsertOrUpdate 功能执行 merge into 要求实体类 {CsName} 必须有主键 /// @@ -319,13 +319,13 @@ public static string InsertOrUpdate_Must_Primary_Key(object CsName) => string.Fo /// public static string InsertOrUpdate_NotSuport_Generic_UseEntity(object typeofT1) => string.Format(Language == "cn" ? @"InsertOrUpdate<>的泛型参数 不支持 {0},请传递您的实体类" : - @"FreeSql: The generic parameter for InsertOrUpdate<>does not support {0}. Pass in your entity class", typeofT1); + @"FreeSql: The generic parameter for InsertOrUpdate<>does not support {0}, Pass in your entity class", typeofT1); /// /// 【延时加载】功能需要安装 FreeSql.Extensions.LazyLoading.dll,可前往 nuget 下载 /// public static string Install_FreeSql_Extensions_LazyLoading => Language == "cn" ? @"【延时加载】功能需要安装 FreeSql.Extensions.LazyLoading.dll,可前往 nuget 下载" : - @"FreeSql: FreeSql needs to be installed for Delayed Loading. Extensions. LazyLoading. Dll, downloadable to nuget"; + @"FreeSql: FreeSql needs to be installed for Delayed Loading.Extensions.LazyLoading.Dll, downloadable to nuget"; /// /// 【延时加载】{trytbTypeName} 编译错误:{exMessage} /// @@ -347,43 +347,43 @@ public static string LazyLoading_EntityMustDeclarePublic(object trytbTypeName) = /// 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); + @"FreeSql: [ManyToMany] Navigation property {0}.{1} did not find a corresponding field in {2}, such as: {3}{4}, {3}_ {4}", trytbTypeName, pnvName, tbmidCsName, midTypePropsTrytbName, findtrytbPkCsName); /// /// 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,实体类型 {tbrefTypeName} 缺少主键标识,[Column(IsPrimary = true)] /// public static string ManyToMany_ParsingError_EntityMissing_PrimaryKey(object trytbTypeName, object pnvName, object tbrefTypeName) => string.Format(Language == "cn" ? @"【ManyToMany】导航属性 {0}.{1} 解析错误,实体类型 {2} 缺少主键标识,[Column(IsPrimary = true)]" : - @"FreeSql: [ManyToMany] Navigation property {0}. {1} parsing error, entity type {2} missing primary key identity, [Column (IsPrimary = true)]", trytbTypeName, pnvName, tbrefTypeName); + @"FreeSql: [ManyToMany] Navigation property {0}.{1} parsing error, entity type {2} missing primary key identity, [Column (IsPrimary = true)]", trytbTypeName, pnvName, tbrefTypeName); /// /// 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,实体类型 {tbrefTypeName} 必须存在对应的 [Navigate(ManyToMany = x)] 集合属性 /// public static string ManyToMany_ParsingError_EntityMustHas_NavigateCollection(object trytbTypeName, object pnvName, object tbrefTypeName) => string.Format(Language == "cn" ? @"【ManyToMany】导航属性 {0}.{1} 解析错误,实体类型 {2} 必须存在对应的 [Navigate(ManyToMany = x)] 集合属性" : - @"FreeSql: [ManyToMany] Navigation property {0}. {1} parsing error, entity type {2} must have a corresponding [Navigate (ManyToMany = x)] collection property", trytbTypeName, pnvName, tbrefTypeName); + @"FreeSql: [ManyToMany] Navigation property {0}.{1} parsing error, entity type {2} must have a corresponding [Navigate (ManyToMany = x)] collection property", trytbTypeName, pnvName, tbrefTypeName); /// /// 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,{tbmidCsName}.{trycolCsName} 和 {trytbCsName}.{trytbPrimarysCsName} 类型不一致 /// public static string ManyToMany_ParsingError_InconsistentType(object trytbTypeName, object pnvName, object tbmidCsName, object trycolCsName, object trytbCsName, object trytbPrimarysCsName) => string.Format(Language == "cn" ? @"【ManyToMany】导航属性 {0}.{1} 解析错误,{2}.{3} 和 {4}.{5} 类型不一致" : - @"FreeSql: [ManyToMany] Navigation property {0}. {1} parsing error, {2}. {3} and {4}. {5} type inconsistent", trytbTypeName, pnvName, tbmidCsName, trycolCsName, trytbCsName, trytbPrimarysCsName); + @"FreeSql: [ManyToMany] Navigation property {0}.{1} parsing error, {2}.{3} and {4}.{5} type inconsistent", trytbTypeName, pnvName, tbmidCsName, trycolCsName, trytbCsName, trytbPrimarysCsName); /// /// 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,中间类 {tbmidCsName}.{midTypePropsTrytbName} 错误:{exMessage} /// public static string ManyToMany_ParsingError_IntermediateClass_ErrorMessage(object trytbTypeName, object pnvName, object tbmidCsName, object midTypePropsTrytbName, object exMessage) => string.Format(Language == "cn" ? @"【ManyToMany】导航属性 {0}.{1} 解析错误,中间类 {2}.{3} 错误:{4}" : - @"FreeSql: [ManyToMany] Navigation property {0}. {1} parsing error, intermediate class {2}.{3} Error: {4}", trytbTypeName, pnvName, tbmidCsName, midTypePropsTrytbName, exMessage); + @"FreeSql: [ManyToMany] Navigation property {0}.{1} parsing error, intermediate class {2}.{3} Error: {4}", trytbTypeName, pnvName, tbmidCsName, midTypePropsTrytbName, exMessage); /// /// 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,中间类 {tbmidCsName}.{midTypePropsTrytbName} 导航属性不是【ManyToOne】或【OneToOne】 /// public static string ManyToMany_ParsingError_IntermediateClass_NotManyToOne_OneToOne(object trytbTypeName, object pnvName, object tbmidCsName, object midTypePropsTrytbName) => string.Format(Language == "cn" ? @"【ManyToMany】导航属性 {0}.{1} 解析错误,中间类 {2}.{3} 导航属性不是【ManyToOne】或【OneToOne】" : - @"FreeSql: [ManyToMany] Navigation property {0}. {1} parsing error, intermediate class {2}. The {3} navigation property is not ManyToOne or OneToOne", trytbTypeName, pnvName, tbmidCsName, midTypePropsTrytbName); + @"FreeSql: [ManyToMany] Navigation property {0}.{1} parsing error, intermediate class {2}.The {3} navigation property is not ManyToOne or OneToOne", trytbTypeName, pnvName, tbmidCsName, midTypePropsTrytbName); /// /// 映射异常:{name} 没有一个属性名相同 /// @@ -395,7 +395,7 @@ public static string Mapping_Exception_HasNo_SamePropertyName(object name) => st /// 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 下载 /// @@ -413,49 +413,49 @@ public static string Missing_FreeSqlProvider_Package_Reason(object dll, object p /// public static string Navigation_Bind_Number_Different(object trytbTypeName, object pnvName, object bindColumnsCount, object tbrefPrimarysLength) => string.Format(Language == "cn" ? @"导航属性 {0}.{1} 特性 [Navigate] Bind 数目({2}) 与 外部主键数目({3}) 不相同" : - @"FreeSql: Navigation property {0}. The number of {1} attributes [Navigate] Binds ({2}) is different from the number of external primary keys ({3})", trytbTypeName, pnvName, bindColumnsCount, tbrefPrimarysLength); + @"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); /// /// {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); + @"FreeSql: {0}.{1} Navigation Property Collection forgotten.AsSelect()? If used in ToList(a => a.{1}), step by step to refer to the IncludeMany document.", tb2DbName, mp2MemberName); /// /// 【导航属性】{trytbTypeDisplayCsharp}.{pName} 缺少 set 属性 /// public static string Navigation_Missing_SetProperty(object trytbTypeDisplayCsharp, object pName) => string.Format(Language == "cn" ? @"【导航属性】{0}.{1} 缺少 set 属性" : - @"FreeSql: Navigation Properties {0}. Missing set attribute for {1}", trytbTypeDisplayCsharp, pName); + @"FreeSql: Navigation Properties {0}.Missing set attribute for {1}", trytbTypeDisplayCsharp, pName); /// /// 导航属性 {trytbTypeName}.{pnvName} 没有找到对应的字段,如:{pnvName}{findtbrefPkCsName}、{pnvName}_{findtbrefPkCsName}。或者使用 [Navigate] 特性指定关系映射。 /// public static string Navigation_NotFound_CorrespondingField(object trytbTypeName, object pnvName, object findtbrefPkCsName) => string.Format(Language == "cn" ? @"导航属性 {0}.{1} 没有找到对应的字段,如:{1}{3}、{1}_{3}。或者使用 [Navigate] 特性指定关系映射。" : - @"FreeSql: Navigation property {0}. {1} No corresponding fields were found, such as: {1}{3}, {1}_ {3}. Or use the [Navigate] attribute to specify the relationship mapping.", trytbTypeName, pnvName, findtbrefPkCsName); + @"FreeSql: Navigation property {0}.{1} No corresponding fields were found, such as: {1}{3}, {1}_ {3}, Or use the [Navigate] attribute to specify the relationship mapping.", trytbTypeName, pnvName, findtbrefPkCsName); /// /// 导航属性 {trytbTypeName}.{pnvName} 解析错误,实体类型 {trytcTypeName} 缺少主键标识,[Column(IsPrimary = true)] /// public static string Navigation_ParsingError_EntityMissingPrimaryKey(object trytbTypeName, object pnvName, object trytcTypeName) => string.Format(Language == "cn" ? @"导航属性 {0}.{1} 解析错误,实体类型 {2} 缺少主键标识,[Column(IsPrimary = true)]" : - @"FreeSql: Navigation property {0}. {1} parsing error, entity type {2} missing primary key identity, [Column (IsPrimary = true)]", trytbTypeName, pnvName, trytcTypeName); + @"FreeSql: Navigation property {0}.{1} parsing error, entity type {2} missing primary key identity, [Column (IsPrimary = true)]", trytbTypeName, pnvName, trytcTypeName); /// /// 导航属性 {trytbTypeName}.{pnvName} 解析错误,{trytbCsName}.{trycolCsName} 和 {tbrefCsName}.{tbrefPrimarysCsName} 类型不一致 /// public static string Navigation_ParsingError_InconsistentType(object trytbTypeName, object pnvName, object trytbCsName, object trycolCsName, object tbrefCsName, object tbrefPrimarysCsName) => string.Format(Language == "cn" ? @"导航属性 {0}.{1} 解析错误,{2}.{3} 和 {4}.{5} 类型不一致" : - @"FreeSql: Navigation property {0}. {1} parsing error, {2}. {3} and {4}. {5} type inconsistent", trytbTypeName, pnvName, trytbCsName, trycolCsName, tbrefCsName, tbrefPrimarysCsName); + @"FreeSql: Navigation property {0}.{1} parsing error, {2}.{3} and {4}.{5} type inconsistent", trytbTypeName, pnvName, trytbCsName, trycolCsName, tbrefCsName, tbrefPrimarysCsName); /// /// 导航属性 {trytbTypeName}.{pnvName} 特性 [Navigate] 解析错误,在 {tbrefTypeName} 未找到属性:{bi} /// public static string Navigation_ParsingError_NotFound_Property(object trytbTypeName, object pnvName, object tbrefTypeName, object bi) => string.Format(Language == "cn" ? @"导航属性 {0}.{1} 特性 [Navigate] 解析错误,在 {2} 未找到属性:{3}" : - @"FreeSql: Navigation property {0}. {1} attribute [Navigate] parsing error, property not found at {2}: {3}", trytbTypeName, pnvName, tbrefTypeName, bi); + @"FreeSql: Navigation property {0}.{1} attribute [Navigate] parsing error, property not found at {2}: {3}", trytbTypeName, pnvName, tbrefTypeName, bi); /// /// {tableTypeDisplayCsharp} 没有定义主键,无法使用 SetSource,请尝试 SetDto 或者 SetSource 指定临时主键 /// public static string NoPrimaryKey_UseSetDto(object tableTypeDisplayCsharp) => string.Format(Language == "cn" ? @"{0} 没有定义主键,无法使用 SetSource,请尝试 SetDto 或者 SetSource 指定临时主键" : - @"FreeSql: {0} has no primary key defined and cannot use SetSource. Try SetDto", tableTypeDisplayCsharp); + @"FreeSql: {0} has no primary key defined and cannot use SetSource, Try SetDto", tableTypeDisplayCsharp); /// /// 没有定义属性 /// @@ -485,7 +485,7 @@ public static string Not_Implemented_Expression_ParameterUseConstant(object exp, /// 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); + @"FreeSql: Function expression {0} parsing is not implemented, Use if you are working on a navigation property collection, AsSelect().{1}({2})", exp, exp3MethodName, exp3ArgumentsCount); /// /// 未实现 MemberAccess 下的 Constant /// @@ -569,13 +569,13 @@ public static string NotFound_Table_Property_AsTable(object atmGroupsValue) => s /// 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); + @"FreeSql: [{0}] ObjectPool.{1}() timeout {2} seconds, see: https://github.com/dotnetcore/FreeSql/discussions/1081", policyName, GetName, totalSeconds); /// - /// 【{policyName}】ObjectPool.GetAsync() The queue is too long. Policy.AsyncGetCapacity = {asyncGetCapacity} + /// 【{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); + @"【{0}】ObjectPool.GetAsync() The queue is too long, Policy.AsyncGetCapacity = {1}" : + @"FreeSql: [{0}] ObjectPool.GetAsync() The queue is too long, Policy.AsyncGetCapacity = {1}", policyName, asyncGetCapacity); /// /// 【OneToMany】导航属性 {trytbTypeName}.{pnvName} 在 {tbrefCsName} 中没有找到对应的字段,如:{findtrytb}{findtrytbPkCsName}、{findtrytb}_{findtrytbPkCsName} /// @@ -593,7 +593,7 @@ public static string OneToMany_ParsingError_InconsistentType(object trytbTypeNam /// 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); + @", {0}{1}, {0}_{1}, Or use the [Navigate] attribute to specify the relationship mapping.", refpropName, findtrytbPkCsName); /// /// 参数 field 未指定 /// @@ -641,7 +641,7 @@ public static string Policy_ObjectPool_Dispose(object policyName) => string.Form /// 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); + @"FreeSql: The {0} status is unavailable and cannot be used until the background checker is restored, {1}", policyName, UnavailableExceptionMessage); /// /// 属性{trytbVersionColumnCsName} 被标注为行锁(乐观锁)(IsVersion),但其必须为数字类型 或者 byte[] 或者 string,并且不可为 Nullable /// @@ -725,7 +725,7 @@ public static string TableName_Format_Error(object yyyyMMdd) => string.Format(La /// 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); + @"FreeSql: {0}.AsType parameter error, please pass in the correct entity type", Type); /// /// {thatFullName} 类型无法访问构造函数 /// @@ -743,7 +743,7 @@ public static string Type_Error_Name(object name) => string.Format(Language == " /// 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); + @"FreeSql: {0}.AsType parameter does not support specifying as object", Type); /// /// 类型 {typeofFullName} 错误,不能使用 IncludeMany /// @@ -767,7 +767,7 @@ public static string Unable_Parse_ExpressionMethod(object exp3tmpCallMethodName) /// 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} /// @@ -791,13 +791,13 @@ public static string S_NotFound_Name(object name) => string.Format(Language == " /// public static string S_Access_InsertOnlyOneAtTime => Language == "cn" ? @"蛋疼的 Access 插入只能一条一条执行,不支持 values(..),(..) 也不支持 select .. UNION ALL select .." : - @"FreeSql: Egg pain Accs insertion can only be performed one at a time, values (..) are not supported. (..) Select is also not supported.. UNION ALL select.."; + @"FreeSql: values (..),(..) are not supported"; /// /// 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} /// @@ -833,7 +833,7 @@ public static string S_ConnectionStringError_Check(object thisName) => string.Fo /// public static string S_ConnectionStringError_CheckProjectConnection(object thisName) => string.Format(Language == "cn" ? @"【{0}】连接字符串错误,请检查。或者检查项目属性 > 生成 > 目标平台:x86 | x64,或者改用 FreeSql.Provider.SqliteCore 访问 arm 平台" : - @"FreeSql: [{0}] Connection string error, please check. Or check Project Properties > Build > Target Platform: x86 | x64, Or use FreeSql.Provider.SqliteCore accessing arm platform", thisName); + @"FreeSql: [{0}] Connection string error, please check, Or check Project Properties > Build > Target Platform: x86 | x64, Or use FreeSql.Provider.SqliteCore accessing arm platform", thisName); /// /// FreeSql.Provider.CustomAdapter 无法使用 CreateCommand /// @@ -887,7 +887,7 @@ public static string S_Features_Unique(object method, object provider) => string /// public static string S_MygisGeometry_NotImplement(object wkt) => string.Format(Language == "cn" ? @"MygisGeometry.Parse 未实现 ""{0}""" : - @"FreeSql: MygisGeometry. Parse does not implement ""{0}""", wkt); + @"FreeSql: MygisGeometry.Parse does not implement ""{0}""", wkt); /// /// -NameOptions 参数错误,格式为:0,0,0,0 /// @@ -935,7 +935,7 @@ public static string S_Oracle_NotSupport_TablespaceSchemas(object tbname) => str /// public static string S_ParsingFailed_UseRestoreToSelect(object callExpMethodName, object message) => string.Format(Language == "cn" ? @"解析失败 {0} {1},提示:可以使用扩展方法 IQueryable.RestoreToSelect() 还原为 ISelect 再查询" : - @"FreeSql: Parsing failed {0} {1}, hint: Extension method IQueryable can be used. RestoreToSelect() reverted to ISelect re-query", callExpMethodName, message); + @"FreeSql: Parsing failed {0} {1}, hint: Extension method IQueryable.RestoreToSelect() can be used", callExpMethodName, message); /// /// fsql.InsertOrUpdate + IfExistsDoNothing + {providerName}要求实体类 {tableCsName} 必须有主键 /// @@ -1338,7 +1338,7 @@ public static string S_WrongParameter(object args) => string.Format(Language == FreeSql: TableName format error, example: "log_{yyyyMMdd}" - FreeSql: {Type}. AsType parameter error, please pass in the correct entity type + FreeSql: {Type}.AsType parameter error, please pass in the correct entity type FreeSql: The {thatFullName} type cannot access the constructor @@ -1347,7 +1347,7 @@ public static string S_WrongParameter(object args) => string.Format(Language == FreeSql: {name} type error - FreeSql: {Type}. AsType parameter does not support specifying as object + FreeSql: {Type}.AsType parameter does not support specifying as object FreeSql: Type {typeofFullName} error, IncludeMany cannot be used