mirror of
				https://github.com/nsnail/FreeSql.git
				synced 2025-11-01 00:05:28 +08:00 
			
		
		
		
	#694 ✨ Exception信息 国际化 多语言
This commit is contained in:
		| @@ -12,12 +12,12 @@ namespace FreeSql | ||||
|     public abstract partial class DbContext : IDisposable | ||||
|     { | ||||
|         internal DbContextScopedFreeSql _ormScoped; | ||||
|         internal IFreeSql OrmOriginal => _ormScoped?._originalFsql ?? throw new ArgumentNullException("请在 OnConfiguring 或 AddFreeDbContext 中配置 UseFreeSql"); | ||||
|         internal IFreeSql OrmOriginal => _ormScoped?._originalFsql ?? throw new ArgumentNullException(DbContextStrings.ConfigureUseFreeSql); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 该对象 Select/Delete/Insert/Update/InsertOrUpdate 与 DbContext 事务保持一致,可省略传递 WithTransaction | ||||
|         /// </summary> | ||||
|         public IFreeSql Orm => _ormScoped ?? throw new ArgumentNullException("请在 OnConfiguring 或 AddFreeDbContext 中配置 UseFreeSql"); | ||||
|         public IFreeSql Orm => _ormScoped ?? throw new ArgumentNullException(DbContextStrings.ConfigureUseFreeSql); | ||||
|  | ||||
|         #region Property UnitOfWork | ||||
|         internal bool _isUseUnitOfWork = true; //是否创建工作单元事务 | ||||
| @@ -126,7 +126,7 @@ namespace FreeSql | ||||
|         void CheckEntityTypeOrThrow(Type entityType) | ||||
|         { | ||||
|             if (OrmOriginal.CodeFirst.GetTableByEntity(entityType) == null) | ||||
|                 throw new ArgumentException($"参数 data 类型错误 {entityType.FullName} "); | ||||
|                 throw new ArgumentException(DbContextStrings.ParameterDataTypeError(entityType.FullName)); | ||||
|         } | ||||
|         /// <summary> | ||||
|         /// 添加 | ||||
|   | ||||
| @@ -140,11 +140,11 @@ namespace FreeSql | ||||
|         /// <returns></returns> | ||||
|         public DbSet<TEntity> AsType(Type entityType) | ||||
|         { | ||||
|             if (entityType == typeof(object)) throw new Exception("ISelect.AsType 参数不支持指定为 object"); | ||||
|             if (entityType == typeof(object)) throw new Exception(CoreStrings.TypeAsType_NotSupport_Object("DbSet")); | ||||
|             if (entityType == _entityType) return this; | ||||
|             var newtb = _db.OrmOriginal.CodeFirst.GetTableByEntity(entityType); | ||||
|             _entityType = entityType; | ||||
|             _tablePriv = newtb ?? throw new Exception("DbSet.AsType 参数错误,请传入正确的实体类型"); | ||||
|             _tablePriv = newtb ?? throw new Exception(CoreStrings.Type_AsType_Parameter_Error("DbSet")); | ||||
|             _tableIdentitysPriv = null; | ||||
|             _tableReturnColumnsPriv = null; | ||||
|             return this; | ||||
| @@ -197,11 +197,11 @@ namespace FreeSql | ||||
|         public void AttachRange(IEnumerable<TEntity> data) | ||||
|         { | ||||
|             if (data == null || data.Any() == false) return; | ||||
|             if (_table.Primarys.Any() == false) throw new Exception($"不可附加,实体没有主键:{_db.OrmOriginal.GetEntityString(_entityType, data.First())}"); | ||||
|             if (_table.Primarys.Any() == false) throw new Exception(DbContextStrings.CannotAttach_EntityHasNo_PrimaryKey(_db.OrmOriginal.GetEntityString(_entityType, data.First()))); | ||||
|             foreach (var item in data) | ||||
|             { | ||||
|                 var key = _db.OrmOriginal.GetEntityKeyString(_entityType, item, false); | ||||
|                 if (string.IsNullOrEmpty(key)) throw new Exception($"不可附加,未设置主键的值:{_db.OrmOriginal.GetEntityString(_entityType, item)}"); | ||||
|                 if (string.IsNullOrEmpty(key)) throw new Exception(DbContextStrings.CannotAttach_PrimaryKey_NotSet(_db.OrmOriginal.GetEntityString(_entityType, item))); | ||||
|  | ||||
|                 _states.AddOrUpdate(key, k => CreateEntityState(item), (k, ov) => | ||||
|                 { | ||||
| @@ -236,9 +236,9 @@ namespace FreeSql | ||||
|         public Dictionary<string, object[]> CompareState(TEntity newdata) | ||||
|         { | ||||
|             if (newdata == null) return null; | ||||
|             if (_table.Primarys.Any() == false) throw new Exception($"不可比较,实体没有主键:{_db.OrmOriginal.GetEntityString(_entityType, newdata)}"); | ||||
|             if (_table.Primarys.Any() == false) throw new Exception(DbContextStrings.Incomparable_EntityHasNo_PrimaryKey(_db.OrmOriginal.GetEntityString(_entityType, newdata))); | ||||
|             var key = _db.OrmOriginal.GetEntityKeyString(_entityType, newdata, false); | ||||
|             if (string.IsNullOrEmpty(key)) throw new Exception($"不可比较,未设置主键的值:{_db.OrmOriginal.GetEntityString(_entityType, newdata)}"); | ||||
|             if (string.IsNullOrEmpty(key)) throw new Exception(DbContextStrings.Incomparable_PrimaryKey_NotSet(_db.OrmOriginal.GetEntityString(_entityType, newdata))); | ||||
|             if (_states.TryGetValue(key, out var oldState) == false || oldState == null) | ||||
|                 return _table.ColumnsByCs.ToDictionary(a => a.Key, a => new object[] | ||||
|                 { | ||||
| @@ -298,7 +298,7 @@ namespace FreeSql | ||||
|             } | ||||
|             if (_table.Primarys.Any() == false) | ||||
|             { | ||||
|                 if (isThrow) throw new Exception($"不可添加,实体没有主键:{_db.OrmOriginal.GetEntityString(_entityType, data)}"); | ||||
|                 if (isThrow) throw new Exception(DbContextStrings.CannotAdd_EntityHasNo_PrimaryKey(_db.OrmOriginal.GetEntityString(_entityType, data))); | ||||
|                 return false; | ||||
|             } | ||||
|             FreeSql.Internal.CommonProvider.InsertProvider<TEntity>.AuditDataValue(this, data, _db.OrmOriginal, _table, null); | ||||
| @@ -319,7 +319,7 @@ namespace FreeSql | ||||
|                     default: | ||||
|                         if (_tableIdentitys.Length == 1 && _table.Primarys.Length == 1) | ||||
|                             return true; | ||||
|                         if (isThrow) throw new Exception($"不可添加,未设置主键的值:{_db.OrmOriginal.GetEntityString(_entityType, data)}"); | ||||
|                         if (isThrow) throw new Exception(DbContextStrings.CannotAdd_PrimaryKey_NotSet(_db.OrmOriginal.GetEntityString(_entityType, data))); | ||||
|                         return false; | ||||
|                 } | ||||
|             } | ||||
| @@ -327,14 +327,14 @@ namespace FreeSql | ||||
|             { | ||||
|                 if (_states.ContainsKey(key)) | ||||
|                 { | ||||
|                     if (isThrow) throw new Exception($"不可添加,已存在于状态管理:{_db.OrmOriginal.GetEntityString(_entityType, data)}"); | ||||
|                     if (isThrow) throw new Exception(DbContextStrings.CannotAdd_AlreadyExistsInStateManagement(_db.OrmOriginal.GetEntityString(_entityType, data))); | ||||
|                     return false; | ||||
|                 } | ||||
|                 if (_db.OrmOriginal.Ado.DataType == DataType.ClickHouse) return true; | ||||
|                 var idval = _db.OrmOriginal.GetEntityIdentityValueWithPrimary(_entityType, data); | ||||
|                 if (idval > 0) | ||||
|                 { | ||||
|                     if (isThrow) throw new Exception($"不可添加,自增属性有值:{_db.OrmOriginal.GetEntityString(_entityType, data)}"); | ||||
|                     if (isThrow) throw new Exception(DbContextStrings.CannotAdd_SelfIncreasingHasValue(_db.OrmOriginal.GetEntityString(_entityType, data))); | ||||
|                     return false; | ||||
|                 } | ||||
|             } | ||||
| @@ -361,19 +361,19 @@ namespace FreeSql | ||||
|             } | ||||
|             if (_table.Primarys.Any() == false) | ||||
|             { | ||||
|                 if (isThrow) throw new Exception($"不可更新,实体没有主键:{_db.OrmOriginal.GetEntityString(_entityType, data)}"); | ||||
|                 if (isThrow) throw new Exception(DbContextStrings.CannotUpdate_EntityHasNo_PrimaryKey(_db.OrmOriginal.GetEntityString(_entityType, data))); | ||||
|                 return false; | ||||
|             } | ||||
|             FreeSql.Internal.CommonProvider.UpdateProvider<TEntity>.AuditDataValue(this, data, _db.OrmOriginal, _table, null); | ||||
|             var key = _db.OrmOriginal.GetEntityKeyString(_entityType, data, false); | ||||
|             if (string.IsNullOrEmpty(key)) | ||||
|             { | ||||
|                 if (isThrow) throw new Exception($"不可更新,未设置主键的值:{_db.OrmOriginal.GetEntityString(_entityType, data)}"); | ||||
|                 if (isThrow) throw new Exception(DbContextStrings.CannotUpdate_PrimaryKey_NotSet(_db.OrmOriginal.GetEntityString(_entityType, data))); | ||||
|                 return false; | ||||
|             } | ||||
|             if (_states.TryGetValue(key, out var tryval) == false) | ||||
|             { | ||||
|                 if (isThrow) throw new Exception($"不可更新,数据未被跟踪,应该先查询 或者 Attach:{_db.OrmOriginal.GetEntityString(_entityType, data)}"); | ||||
|                 if (isThrow) throw new Exception(DbContextStrings.CannotUpdate_DataShouldQueryOrAttach(_db.OrmOriginal.GetEntityString(_entityType, data))); | ||||
|                 return false; | ||||
|             } | ||||
|             return true; | ||||
| @@ -399,13 +399,13 @@ namespace FreeSql | ||||
|             } | ||||
|             if (_table.Primarys.Any() == false) | ||||
|             { | ||||
|                 if (isThrow) throw new Exception($"不可删除,实体没有主键:{_db.OrmOriginal.GetEntityString(_entityType, data)}"); | ||||
|                 if (isThrow) throw new Exception(DbContextStrings.CannotDelete_EntityHasNo_PrimaryKey(_db.OrmOriginal.GetEntityString(_entityType, data))); | ||||
|                 return false; | ||||
|             } | ||||
|             var key = _db.OrmOriginal.GetEntityKeyString(_entityType, data, false); | ||||
|             if (string.IsNullOrEmpty(key)) | ||||
|             { | ||||
|                 if (isThrow) throw new Exception($"不可删除,未设置主键的值:{_db.OrmOriginal.GetEntityString(_entityType, data)}"); | ||||
|                 if (isThrow) throw new Exception(DbContextStrings.CannotDelete_PrimaryKey_NotSet(_db.OrmOriginal.GetEntityString(_entityType, data))); | ||||
|                 return false; | ||||
|             } | ||||
|             //if (_states.TryGetValue(key, out var tryval) == false) { | ||||
|   | ||||
| @@ -114,7 +114,7 @@ namespace FreeSql | ||||
|                     case DataType.ShenTong: | ||||
|                         await DbContextFlushCommandAsync(cancellationToken); | ||||
|                         var rets = await this.OrmInsert(data).ExecuteInsertedAsync(cancellationToken); | ||||
|                         if (rets.Count != data.Count()) throw new Exception($"特别错误:批量添加失败,{_db.OrmOriginal.Ado.DataType} 的返回数据,与添加的数目不匹配"); | ||||
|                         if (rets.Count != data.Count()) throw new Exception(DbContextStrings.SpecialError_BatchAdditionFailed(_db.OrmOriginal.Ado.DataType)); | ||||
|                         _db._entityChangeReport.AddRange(rets.Select(a => new DbContext.EntityChangeReport.ChangeInfo { Object = a, Type = DbContext.EntityChangeType.Insert })); | ||||
|                         var idx = 0; | ||||
|                         foreach (var s in data) | ||||
| @@ -148,8 +148,8 @@ namespace FreeSql | ||||
|         { | ||||
|             if (item == null) return; | ||||
|             if (string.IsNullOrEmpty(propertyName)) return; | ||||
|             if (_table.Properties.TryGetValue(propertyName, out var prop) == false) throw new KeyNotFoundException($"{_table.Type.FullName} 不存在属性 {propertyName}"); | ||||
|             if (_table.ColumnsByCsIgnore.ContainsKey(propertyName)) throw new ArgumentException($"{_table.Type.FullName} 类型已设置属性 {propertyName} 忽略特性"); | ||||
|             if (_table.Properties.TryGetValue(propertyName, out var prop) == false) throw new KeyNotFoundException(DbContextStrings.NotFound_Property(_table.Type.FullName, propertyName)); | ||||
|             if (_table.ColumnsByCsIgnore.ContainsKey(propertyName)) throw new ArgumentException(DbContextStrings.TypeHasSetProperty_IgnoreAttribute(_table.Type.FullName, propertyName)); | ||||
|  | ||||
|             var tref = _table.GetTableRef(propertyName, true); | ||||
|             if (tref == null) return; | ||||
| @@ -157,7 +157,7 @@ namespace FreeSql | ||||
|             { | ||||
|                 case Internal.Model.TableRefType.OneToOne: | ||||
|                 case Internal.Model.TableRefType.ManyToOne: | ||||
|                     throw new ArgumentException($"{_table.Type.FullName} 类型的属性 {propertyName} 不是 OneToMany 或 ManyToMany 特性"); | ||||
|                     throw new ArgumentException(DbContextStrings.PropertyOfType_IsNot_OneToManyOrManyToMany(_table.Type.FullName, propertyName)); | ||||
|             } | ||||
|  | ||||
|             await DbContextFlushCommandAsync(cancellationToken); | ||||
| @@ -363,7 +363,7 @@ namespace FreeSql | ||||
|  | ||||
|             if (_states.TryGetValue(uplst1.Key, out var lstval1) == false) return -999; | ||||
|             var lstval2 = default(EntityState); | ||||
|             if (uplst2 != null && _states.TryGetValue(uplst2.Key, out lstval2) == false) throw new Exception($"特别错误:更新失败,数据未被跟踪:{_db.OrmOriginal.GetEntityString(_entityType, uplst2.Value)}"); | ||||
|             if (uplst2 != null && _states.TryGetValue(uplst2.Key, out lstval2) == false) throw new Exception(DbContextStrings.SpecialError_UpdateFailedDataNotTracked(_db.OrmOriginal.GetEntityString(_entityType, uplst2.Value))); | ||||
|  | ||||
|             var cuig1 = _db.OrmOriginal.CompareEntityValueReturnColumns(_entityType, uplst1.Value, lstval1.Value, true); | ||||
|             var cuig2 = uplst2 != null ? _db.OrmOriginal.CompareEntityValueReturnColumns(_entityType, uplst2.Value, lstval2.Value, true) : null; | ||||
| @@ -413,11 +413,11 @@ namespace FreeSql | ||||
|         async public Task UpdateAsync(TEntity data, CancellationToken cancellationToken = default) | ||||
|         { | ||||
|             var exists = ExistsInStates(data); | ||||
|             if (exists == null) throw new Exception($"不可更新,未设置主键的值:{_db.OrmOriginal.GetEntityString(_entityType, data)}"); | ||||
|             if (exists == null) throw new Exception(DbContextStrings.CannotUpdate_PrimaryKey_NotSet(_db.OrmOriginal.GetEntityString(_entityType, data))); | ||||
|             if (exists == false) | ||||
|             { | ||||
|                 var olddata = await OrmSelect(data).FirstAsync(cancellationToken); | ||||
|                 if (olddata == null) throw new Exception($"不可更新,数据库不存在该记录:{_db.OrmOriginal.GetEntityString(_entityType, data)}"); | ||||
|                 if (olddata == null) throw new Exception(DbContextStrings.CannotUpdate_RecordDoesNotExist(_db.OrmOriginal.GetEntityString(_entityType, data))); | ||||
|             } | ||||
|  | ||||
|             await UpdateRangePrivAsync(new[] { data }, true, cancellationToken); | ||||
| @@ -472,7 +472,7 @@ namespace FreeSql | ||||
|         async public Task AddOrUpdateAsync(TEntity data, CancellationToken cancellationToken = default) | ||||
|         { | ||||
|             if (data == null) throw new ArgumentNullException(nameof(data)); | ||||
|             if (_table.Primarys.Any() == false) throw new Exception($"不可添加,实体没有主键:{_db.OrmOriginal.GetEntityString(_entityType, data)}"); | ||||
|             if (_table.Primarys.Any() == false) throw new Exception(DbContextStrings.CannotAdd_EntityHasNo_PrimaryKey(_db.OrmOriginal.GetEntityString(_entityType, data))); | ||||
|  | ||||
|             var flagExists = ExistsInStates(data); | ||||
|             if (flagExists == false) | ||||
|   | ||||
| @@ -116,7 +116,7 @@ namespace FreeSql | ||||
|                     case DataType.ShenTong: | ||||
|                         DbContextFlushCommand(); | ||||
|                         var rets = this.OrmInsert(data).ExecuteInserted(); | ||||
|                         if (rets.Count != data.Count()) throw new Exception($"特别错误:批量添加失败,{_db.OrmOriginal.Ado.DataType} 的返回数据,与添加的数目不匹配"); | ||||
|                         if (rets.Count != data.Count()) throw new Exception(DbContextStrings.SpecialError_BatchAdditionFailed(_db.OrmOriginal.Ado.DataType)); | ||||
|                         _db._entityChangeReport.AddRange(rets.Select(a => new DbContext.EntityChangeReport.ChangeInfo { Object = a, Type = DbContext.EntityChangeType.Insert })); | ||||
|                         var idx = 0; | ||||
|                         foreach (var s in data) | ||||
| @@ -159,8 +159,8 @@ namespace FreeSql | ||||
|         { | ||||
|             if (item == null) return; | ||||
|             if (string.IsNullOrEmpty(propertyName)) return; | ||||
|             if (_table.Properties.TryGetValue(propertyName, out var prop) == false) throw new KeyNotFoundException($"{_table.Type.FullName} 不存在属性 {propertyName}"); | ||||
|             if (_table.ColumnsByCsIgnore.ContainsKey(propertyName)) throw new ArgumentException($"{_table.Type.FullName} 类型已设置属性 {propertyName} 忽略特性"); | ||||
|             if (_table.Properties.TryGetValue(propertyName, out var prop) == false) throw new KeyNotFoundException(DbContextStrings.NotFound_Property(_table.Type.FullName, propertyName)); | ||||
|             if (_table.ColumnsByCsIgnore.ContainsKey(propertyName)) throw new ArgumentException(DbContextStrings.TypeHasSetProperty_IgnoreAttribute(_table.Type.FullName, propertyName)); | ||||
|  | ||||
|             var tref = _table.GetTableRef(propertyName, true); | ||||
|             if (tref == null) return; | ||||
| @@ -168,7 +168,7 @@ namespace FreeSql | ||||
|             { | ||||
|                 case Internal.Model.TableRefType.OneToOne: | ||||
|                 case Internal.Model.TableRefType.ManyToOne: | ||||
|                     throw new ArgumentException($"{_table.Type.FullName} 类型的属性 {propertyName} 不是 OneToMany 或 ManyToMany 特性"); | ||||
|                     throw new ArgumentException(DbContextStrings.PropertyOfType_IsNot_OneToManyOrManyToMany(_table.Type.FullName, propertyName)); | ||||
|             } | ||||
|  | ||||
|             DbContextFlushCommand(); | ||||
| @@ -397,7 +397,7 @@ namespace FreeSql | ||||
|  | ||||
|             if (_states.TryGetValue(uplst1.Key, out var lstval1) == false) return -999; | ||||
|             var lstval2 = default(EntityState); | ||||
|             if (uplst2 != null && _states.TryGetValue(uplst2.Key, out lstval2) == false) throw new Exception($"特别错误:更新失败,数据未被跟踪:{_db.OrmOriginal.GetEntityString(_entityType, uplst2.Value)}"); | ||||
|             if (uplst2 != null && _states.TryGetValue(uplst2.Key, out lstval2) == false) throw new Exception(DbContextStrings.SpecialError_UpdateFailedDataNotTracked(_db.OrmOriginal.GetEntityString(_entityType, uplst2.Value))); | ||||
|  | ||||
|             var cuig1 = _db.OrmOriginal.CompareEntityValueReturnColumns(_entityType, uplst1.Value, lstval1.Value, true); | ||||
|             var cuig2 = uplst2 != null ? _db.OrmOriginal.CompareEntityValueReturnColumns(_entityType, uplst2.Value, lstval2.Value, true) : null; | ||||
| @@ -454,11 +454,11 @@ namespace FreeSql | ||||
|         public void Update(TEntity data) | ||||
|         { | ||||
|             var exists = ExistsInStates(data); | ||||
|             if (exists == null) throw new Exception($"不可更新,未设置主键的值:{_db.OrmOriginal.GetEntityString(_entityType, data)}"); | ||||
|             if (exists == null) throw new Exception(DbContextStrings.CannotUpdate_PrimaryKey_NotSet(_db.OrmOriginal.GetEntityString(_entityType, data))); | ||||
|             if (exists == false) | ||||
|             { | ||||
|                 var olddata = OrmSelect(data).First(); | ||||
|                 if (olddata == null) throw new Exception($"不可更新,数据库不存在该记录:{_db.OrmOriginal.GetEntityString(_entityType, data)}"); | ||||
|                 if (olddata == null) throw new Exception(DbContextStrings.CannotUpdate_RecordDoesNotExist(_db.OrmOriginal.GetEntityString(_entityType, data))); | ||||
|             } | ||||
|  | ||||
|             UpdateRangePriv(new[] { data }, true); | ||||
| @@ -545,7 +545,7 @@ namespace FreeSql | ||||
|         public void AddOrUpdate(TEntity data) | ||||
|         { | ||||
|             if (data == null) throw new ArgumentNullException(nameof(data)); | ||||
|             if (_table.Primarys.Any() == false) throw new Exception($"不可添加,实体没有主键:{_db.OrmOriginal.GetEntityString(_entityType, data)}"); | ||||
|             if (_table.Primarys.Any() == false) throw new Exception(DbContextStrings.CannotAdd_EntityHasNo_PrimaryKey(_db.OrmOriginal.GetEntityString(_entityType, data))); | ||||
|  | ||||
|             var flagExists = ExistsInStates(data); | ||||
|             if (flagExists == false) | ||||
| @@ -585,7 +585,7 @@ namespace FreeSql | ||||
|         public void BeginEdit(List<TEntity> data) | ||||
|         { | ||||
|             if (data == null) return; | ||||
|             if (_table.Primarys.Any() == false) throw new Exception($"不可进行编辑,实体没有主键:{_db.OrmOriginal.GetEntityString(_entityType, data.First())}"); | ||||
|             if (_table.Primarys.Any() == false) throw new Exception(DbContextStrings.CannotEdit_EntityHasNo_PrimaryKey(_db.OrmOriginal.GetEntityString(_entityType, data.First()))); | ||||
|             _statesEditing.Clear(); | ||||
|             _dataEditing = data; | ||||
|             foreach (var item in data) | ||||
| @@ -875,7 +875,7 @@ namespace FreeSql | ||||
|  | ||||
|                     var rawset = _db.Set(dbset.EntityType); | ||||
|                     var statesRemove = typeof(DbSet<>).MakeGenericType(dbset.EntityType).GetMethod("StatesRemoveByObjects", BindingFlags.NonPublic | BindingFlags.Instance, null, new[] { typeof(IEnumerable<object>) }, null); | ||||
|                     if (statesRemove == null) throw new Exception("找不到方法 DbSet<>.StatesRemoveByObjects"); | ||||
|                     if (statesRemove == null) throw new Exception(DbContextStrings.NotFoundMethod_StatesRemoveByObjects); | ||||
|                     statesRemove.Invoke(rawset, new object[] { items }); | ||||
|                 } | ||||
|                 returnDeleted?.AddRange(items); | ||||
|   | ||||
| @@ -42,7 +42,7 @@ namespace FreeSql.Extensions.EfCoreFluentApi | ||||
|         #region HasKey | ||||
|         public EfCoreTableFluent HasKey(string key) | ||||
|         { | ||||
|             if (key == null) throw new ArgumentException("参数错误 key 不能为 null"); | ||||
|             if (key == null) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("key")); | ||||
|             foreach (string name in key.Split(',')) | ||||
|             { | ||||
|                 if (string.IsNullOrEmpty(name.Trim())) continue; | ||||
| @@ -55,7 +55,7 @@ namespace FreeSql.Extensions.EfCoreFluentApi | ||||
|         #region HasIndex | ||||
|         public HasIndexFluent HasIndex(string index) | ||||
|         { | ||||
|             if (index == null) throw new ArgumentException("参数错误 index 不能为 null"); | ||||
|             if (index == null) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("index")); | ||||
|             var indexName = $"idx_{Guid.NewGuid().ToString("N").Substring(0, 8)}"; | ||||
|             var columns = new List<string>(); | ||||
|             foreach (string name in index.Split(',')) | ||||
| @@ -98,8 +98,8 @@ namespace FreeSql.Extensions.EfCoreFluentApi | ||||
|         #region HasOne | ||||
|         public HasOneFluent HasOne(string one) | ||||
|         { | ||||
|             if (string.IsNullOrEmpty(one)) throw new ArgumentException("参数错误 one 不能为 null"); | ||||
|             if (_entityType.GetPropertiesDictIgnoreCase().TryGetValue(one, out var oneProperty) == false) throw new ArgumentException($"参数错误 {one} 属性不存在"); | ||||
|             if (string.IsNullOrEmpty(one)) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("one")); | ||||
|             if (_entityType.GetPropertiesDictIgnoreCase().TryGetValue(one, out var oneProperty) == false) throw new ArgumentException(DbContextStrings.ParameterError_NotFound_Property(one)); | ||||
|             return new HasOneFluent(_fsql, _tf, _entityType, oneProperty.PropertyType, one); | ||||
|         } | ||||
|         public class HasOneFluent | ||||
| @@ -124,8 +124,8 @@ namespace FreeSql.Extensions.EfCoreFluentApi | ||||
|             } | ||||
|             public HasOneFluent WithMany(string many) | ||||
|             { | ||||
|                 if (many == null) throw new ArgumentException("参数错误 many 不能为 null"); | ||||
|                 if (_entityType2.GetPropertiesDictIgnoreCase().TryGetValue(many, out var manyProperty) == false) throw new ArgumentException($"参数错误 {many} 属性不存在"); | ||||
|                 if (many == null) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("many")); | ||||
|                 if (_entityType2.GetPropertiesDictIgnoreCase().TryGetValue(many, out var manyProperty) == false) throw new ArgumentException(DbContextStrings.ParameterError_NotFound_Property(many)); | ||||
|                 _withManyProperty = manyProperty.Name; | ||||
|                 if (string.IsNullOrEmpty(_selfBind) == false) | ||||
|                     _fsql.CodeFirst.ConfigEntity(_entityType2, eb2 => eb2.Navigate(many, _selfBind)); | ||||
| @@ -133,18 +133,18 @@ namespace FreeSql.Extensions.EfCoreFluentApi | ||||
|             } | ||||
|             public HasOneFluent WithOne(string one, string foreignKey) | ||||
|             { | ||||
|                 if (string.IsNullOrEmpty(one)) throw new ArgumentException("参数错误 one 不能为 null"); | ||||
|                 if (_entityType1.GetPropertiesDictIgnoreCase().TryGetValue(one, out var oneProperty) == false) throw new ArgumentException($"参数错误 {one} 属性不存在"); | ||||
|                 if (oneProperty != _entityType1) throw new ArgumentException($"参数错误 {one} 属性不存在"); | ||||
|                 if (string.IsNullOrEmpty(one)) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("one")); | ||||
|                 if (_entityType1.GetPropertiesDictIgnoreCase().TryGetValue(one, out var oneProperty) == false) throw new ArgumentException(DbContextStrings.ParameterError_NotFound_Property(one)); | ||||
|                 if (oneProperty != _entityType1) throw new ArgumentException(DbContextStrings.ParameterError_NotFound_Property(one)); | ||||
|                 _withOneProperty = oneProperty.Name; | ||||
|  | ||||
|                 if (foreignKey == null) throw new ArgumentException("参数错误 foreignKey 不能为 null"); | ||||
|                 if (foreignKey == null) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("foreignKey")); | ||||
|                 foreach (string name in foreignKey.Split(',')) | ||||
|                 { | ||||
|                     if (string.IsNullOrEmpty(name.Trim())) continue; | ||||
|                     _withOneBind += ", " + name.Trim(); | ||||
|                 } | ||||
|                 if (string.IsNullOrEmpty(_withOneBind)) throw new ArgumentException("参数错误 foreignKey"); | ||||
|                 if (string.IsNullOrEmpty(_withOneBind)) throw new ArgumentException(DbContextStrings.ParameterError("foreignKey")); | ||||
|                 _withOneBind = _withOneBind.TrimStart(',', ' '); | ||||
|                 if (string.IsNullOrEmpty(_selfBind) == false) | ||||
|                     _fsql.CodeFirst.ConfigEntity(_entityType2, eb2 => eb2.Navigate(_withOneProperty, _withOneBind)); | ||||
| @@ -152,13 +152,13 @@ namespace FreeSql.Extensions.EfCoreFluentApi | ||||
|             } | ||||
|             public HasOneFluent HasForeignKey(string foreignKey) | ||||
|             { | ||||
|                 if (foreignKey == null) throw new ArgumentException("参数错误 foreignKey 不能为 null"); | ||||
|                 if (foreignKey == null) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("foreignKey")); | ||||
|                 foreach (string name in foreignKey.Split(',')) | ||||
|                 { | ||||
|                     if (string.IsNullOrEmpty(name.Trim())) continue; | ||||
|                     _selfBind += ", " + name.Trim(); | ||||
|                 } | ||||
|                 if (string.IsNullOrEmpty(_selfBind)) throw new ArgumentException("参数错误 foreignKey"); | ||||
|                 if (string.IsNullOrEmpty(_selfBind)) throw new ArgumentException(DbContextStrings.ParameterError("foreignKey")); | ||||
|                 _selfBind = _selfBind.TrimStart(',', ' '); | ||||
|                 _tf.Navigate(_selfProperty, _selfBind); | ||||
|                 if (string.IsNullOrEmpty(_withManyProperty) == false) | ||||
| @@ -173,9 +173,9 @@ namespace FreeSql.Extensions.EfCoreFluentApi | ||||
|         #region HasMany | ||||
|         public HasManyFluent HasMany(string many) | ||||
|         { | ||||
|             if (string.IsNullOrEmpty(many)) throw new ArgumentException("参数错误 many 不能为 null"); | ||||
|             if (_entityType.GetPropertiesDictIgnoreCase().TryGetValue(many, out var manyProperty) == false) throw new ArgumentException($"参数错误 {many} 集合属性不存在"); | ||||
|             if (typeof(IEnumerable).IsAssignableFrom(manyProperty.PropertyType) == false || manyProperty.PropertyType.IsGenericType == false) throw new ArgumentException("参数错误 {many} 不是集合属性"); | ||||
|             if (string.IsNullOrEmpty(many)) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("many")); | ||||
|             if (_entityType.GetPropertiesDictIgnoreCase().TryGetValue(many, out var manyProperty) == false) throw new ArgumentException(DbContextStrings.ParameterError_NotFound_CollectionProperties(many)); | ||||
|             if (typeof(IEnumerable).IsAssignableFrom(manyProperty.PropertyType) == false || manyProperty.PropertyType.IsGenericType == false) throw new ArgumentException(DbContextStrings.ParameterError_IsNot_CollectionProperties(many)); | ||||
|             return new HasManyFluent(_fsql, _tf, _entityType, manyProperty.PropertyType.GetGenericArguments()[0], manyProperty.Name); | ||||
|         } | ||||
|         public class HasManyFluent | ||||
| @@ -200,18 +200,18 @@ namespace FreeSql.Extensions.EfCoreFluentApi | ||||
|  | ||||
|             public void WithMany(string many, Type middleType) | ||||
|             { | ||||
|                 if (string.IsNullOrEmpty(many)) throw new ArgumentException("参数错误 many 不能为 null"); | ||||
|                 if (_entityType2.GetPropertiesDictIgnoreCase().TryGetValue(many, out var manyProperty) == false) throw new ArgumentException($"参数错误 {many} 集合属性不存在"); | ||||
|                 if (typeof(IEnumerable).IsAssignableFrom(manyProperty.PropertyType) == false || manyProperty.PropertyType.IsGenericType == false) throw new ArgumentException("参数错误 {many} 不是集合属性"); | ||||
|                 if (string.IsNullOrEmpty(many)) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("many")); | ||||
|                 if (_entityType2.GetPropertiesDictIgnoreCase().TryGetValue(many, out var manyProperty) == false) throw new ArgumentException(DbContextStrings.ParameterError_NotFound_CollectionProperties(many)); | ||||
|                 if (typeof(IEnumerable).IsAssignableFrom(manyProperty.PropertyType) == false || manyProperty.PropertyType.IsGenericType == false) throw new ArgumentException(DbContextStrings.ParameterError_IsNot_CollectionProperties(many)); | ||||
|                 _withManyProperty = manyProperty.Name; | ||||
|                 _tf.Navigate(_selfProperty, null, middleType); | ||||
|                 _fsql.CodeFirst.ConfigEntity(_entityType2, eb2 => eb2.Navigate(_withManyProperty, null, middleType)); | ||||
|             } | ||||
|             public HasManyFluent WithOne(string one) | ||||
|             { | ||||
|                 if (string.IsNullOrEmpty(one)) throw new ArgumentException("参数错误 one 不能为 null"); | ||||
|                 if (_entityType2.GetPropertiesDictIgnoreCase().TryGetValue(one, out var oneProperty) == false) throw new ArgumentException($"参数错误 {one} 属性不存在"); | ||||
|                 if (oneProperty.PropertyType != _entityType1) throw new ArgumentException($"参数错误 {one} 属性不存在"); | ||||
|                 if (string.IsNullOrEmpty(one)) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("one")); | ||||
|                 if (_entityType2.GetPropertiesDictIgnoreCase().TryGetValue(one, out var oneProperty) == false) throw new ArgumentException(DbContextStrings.ParameterError_NotFound_Property(one)); | ||||
|                 if (oneProperty.PropertyType != _entityType1) throw new ArgumentException(DbContextStrings.ParameterError_NotFound_Property(one)); | ||||
|                 _withOneProperty = oneProperty.Name; | ||||
|                 if (string.IsNullOrEmpty(_selfBind) == false) | ||||
|                     _fsql.CodeFirst.ConfigEntity(_entityType2, eb2 => eb2.Navigate(oneProperty.Name, _selfBind)); | ||||
| @@ -219,13 +219,13 @@ namespace FreeSql.Extensions.EfCoreFluentApi | ||||
|             } | ||||
|             public HasManyFluent HasForeignKey(string foreignKey) | ||||
|             { | ||||
|                 if (foreignKey == null) throw new ArgumentException("参数错误 foreignKey 不能为 null"); | ||||
|                 if (foreignKey == null) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("foreignKey")); | ||||
|                 foreach (string name in foreignKey.Split(',')) | ||||
|                 { | ||||
|                     if (string.IsNullOrEmpty(name.Trim())) continue; | ||||
|                     _selfBind += ", " + name.Trim(); | ||||
|                 } | ||||
|                 if (string.IsNullOrEmpty(_selfBind)) throw new ArgumentException("参数错误 foreignKey"); | ||||
|                 if (string.IsNullOrEmpty(_selfBind)) throw new ArgumentException(DbContextStrings.ParameterError("foreignKey")); | ||||
|                 _selfBind = _selfBind.TrimStart(',', ' '); | ||||
|                 _tf.Navigate(_selfProperty, _selfBind); | ||||
|                 if (string.IsNullOrEmpty(_withOneProperty) == false) | ||||
|   | ||||
| @@ -42,7 +42,7 @@ namespace FreeSql.Extensions.EfCoreFluentApi | ||||
|         { | ||||
|             var exp = key?.Body; | ||||
|             if (exp?.NodeType == ExpressionType.Convert) exp = (exp as UnaryExpression)?.Operand; | ||||
|             if (exp == null) throw new ArgumentException("参数错误 key 不能为 null"); | ||||
|             if (exp == null) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("key")); | ||||
|  | ||||
|             switch (exp.NodeType) | ||||
|             { | ||||
| @@ -63,7 +63,7 @@ namespace FreeSql.Extensions.EfCoreFluentApi | ||||
|         { | ||||
|             var exp = index?.Body; | ||||
|             if (exp?.NodeType == ExpressionType.Convert) exp = (exp as UnaryExpression)?.Operand; | ||||
|             if (exp == null) throw new ArgumentException("参数错误 index 不能为 null"); | ||||
|             if (exp == null) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("index")); | ||||
|  | ||||
|             var indexName = $"idx_{Guid.NewGuid().ToString("N").Substring(0, 8)}"; | ||||
|             var columns = new List<string>(); | ||||
| @@ -114,7 +114,7 @@ namespace FreeSql.Extensions.EfCoreFluentApi | ||||
|         { | ||||
|             var exp = one?.Body; | ||||
|             if (exp?.NodeType == ExpressionType.Convert) exp = (exp as UnaryExpression)?.Operand; | ||||
|             if (exp == null) throw new ArgumentException("参数错误 one 不能为 null"); | ||||
|             if (exp == null) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("one")); | ||||
|  | ||||
|             var oneProperty = ""; | ||||
|             switch (exp.NodeType) | ||||
| @@ -123,7 +123,7 @@ namespace FreeSql.Extensions.EfCoreFluentApi | ||||
|                     oneProperty = (exp as MemberExpression).Member.Name; | ||||
|                     break; | ||||
|             } | ||||
|             if (string.IsNullOrEmpty(oneProperty)) throw new ArgumentException("参数错误 one"); | ||||
|             if (string.IsNullOrEmpty(oneProperty)) throw new ArgumentException(DbContextStrings.ParameterError("one")); | ||||
|             return new HasOneFluent<T2>(_fsql, _tf, oneProperty); | ||||
|         } | ||||
|         public class HasOneFluent<T2> | ||||
| @@ -146,7 +146,7 @@ namespace FreeSql.Extensions.EfCoreFluentApi | ||||
|             { | ||||
|                 var exp = many?.Body; | ||||
|                 if (exp?.NodeType == ExpressionType.Convert) exp = (exp as UnaryExpression)?.Operand; | ||||
|                 if (exp == null) throw new ArgumentException("参数错误 many 不能为 null"); | ||||
|                 if (exp == null) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("many")); | ||||
|  | ||||
|                 switch (exp.NodeType) | ||||
|                 { | ||||
| @@ -154,7 +154,7 @@ namespace FreeSql.Extensions.EfCoreFluentApi | ||||
|                         _withManyProperty = (exp as MemberExpression).Member.Name; | ||||
|                         break; | ||||
|                 } | ||||
|                 if (string.IsNullOrEmpty(_withManyProperty)) throw new ArgumentException("参数错误 many"); | ||||
|                 if (string.IsNullOrEmpty(_withManyProperty)) throw new ArgumentException(DbContextStrings.ParameterError("many")); | ||||
|                 if (string.IsNullOrEmpty(_selfBind) == false) | ||||
|                     _fsql.CodeFirst.ConfigEntity<T2>(eb2 => eb2.Navigate(_withManyProperty, _selfBind)); | ||||
|                 return this; | ||||
| @@ -163,7 +163,7 @@ namespace FreeSql.Extensions.EfCoreFluentApi | ||||
|             { | ||||
|                 var exp = one?.Body; | ||||
|                 if (exp?.NodeType == ExpressionType.Convert) exp = (exp as UnaryExpression)?.Operand; | ||||
|                 if (exp == null) throw new ArgumentException("参数错误 one 不能为 null"); | ||||
|                 if (exp == null) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("one")); | ||||
|  | ||||
|                 switch (exp.NodeType) | ||||
|                 { | ||||
| @@ -171,11 +171,11 @@ namespace FreeSql.Extensions.EfCoreFluentApi | ||||
|                         _withOneProperty = (exp as MemberExpression).Member.Name; | ||||
|                         break; | ||||
|                 } | ||||
|                 if (string.IsNullOrEmpty(_withOneProperty)) throw new ArgumentException("参数错误 one"); | ||||
|                 if (string.IsNullOrEmpty(_withOneProperty)) throw new ArgumentException(DbContextStrings.ParameterError("one")); | ||||
|  | ||||
|                 exp = foreignKey?.Body; | ||||
|                 if (exp?.NodeType == ExpressionType.Convert) exp = (exp as UnaryExpression)?.Operand; | ||||
|                 if (exp == null) throw new ArgumentException("参数错误 foreignKey 不能为 null"); | ||||
|                 if (exp == null) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("foreignKey")); | ||||
|  | ||||
|                 switch (exp.NodeType) | ||||
|                 { | ||||
| @@ -190,7 +190,7 @@ namespace FreeSql.Extensions.EfCoreFluentApi | ||||
|                         _withOneBind = _withOneBind.TrimStart(',', ' '); | ||||
|                         break; | ||||
|                 } | ||||
|                 if (string.IsNullOrEmpty(_withOneBind)) throw new ArgumentException("参数错误 foreignKey"); | ||||
|                 if (string.IsNullOrEmpty(_withOneBind)) throw new ArgumentException(DbContextStrings.ParameterError("foreignKey")); | ||||
|                 if (string.IsNullOrEmpty(_selfBind) == false) | ||||
|                     _fsql.CodeFirst.ConfigEntity<T2>(eb2 => eb2.Navigate(_withOneProperty, _withOneBind)); | ||||
|                 return this; | ||||
| @@ -199,7 +199,7 @@ namespace FreeSql.Extensions.EfCoreFluentApi | ||||
|             { | ||||
|                 var exp = foreignKey?.Body; | ||||
|                 if (exp?.NodeType == ExpressionType.Convert) exp = (exp as UnaryExpression)?.Operand; | ||||
|                 if (exp == null) throw new ArgumentException("参数错误 foreignKey 不能为 null"); | ||||
|                 if (exp == null) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("foreignKey")); | ||||
|  | ||||
|                 switch (exp.NodeType) | ||||
|                 { | ||||
| @@ -214,7 +214,7 @@ namespace FreeSql.Extensions.EfCoreFluentApi | ||||
|                         _selfBind = _selfBind.TrimStart(',', ' '); | ||||
|                         break; | ||||
|                 } | ||||
|                 if (string.IsNullOrEmpty(_selfBind)) throw new ArgumentException("参数错误 foreignKey"); | ||||
|                 if (string.IsNullOrEmpty(_selfBind)) throw new ArgumentException(DbContextStrings.ParameterError("foreignKey")); | ||||
|                 _tf.Navigate(_selfProperty, _selfBind); | ||||
|                 if (string.IsNullOrEmpty(_withManyProperty) == false) | ||||
|                     _fsql.CodeFirst.ConfigEntity<T2>(eb2 => eb2.Navigate(_withManyProperty, _selfBind)); | ||||
| @@ -230,7 +230,7 @@ namespace FreeSql.Extensions.EfCoreFluentApi | ||||
|         { | ||||
|             var exp = many?.Body; | ||||
|             if (exp?.NodeType == ExpressionType.Convert) exp = (exp as UnaryExpression)?.Operand; | ||||
|             if (exp == null) throw new ArgumentException("参数错误 many 不能为 null"); | ||||
|             if (exp == null) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("many")); | ||||
|  | ||||
|             var manyProperty = ""; | ||||
|             switch (exp.NodeType) | ||||
| @@ -239,7 +239,7 @@ namespace FreeSql.Extensions.EfCoreFluentApi | ||||
|                     manyProperty = (exp as MemberExpression).Member.Name; | ||||
|                     break; | ||||
|             } | ||||
|             if (string.IsNullOrEmpty(manyProperty)) throw new ArgumentException("参数错误 many"); | ||||
|             if (string.IsNullOrEmpty(manyProperty)) throw new ArgumentException(DbContextStrings.ParameterError("many")); | ||||
|             return new HasManyFluent<T2>(_fsql, _tf, manyProperty); | ||||
|         } | ||||
|         public class HasManyFluent<T2> | ||||
| @@ -262,7 +262,7 @@ namespace FreeSql.Extensions.EfCoreFluentApi | ||||
|             { | ||||
|                 var exp = many?.Body; | ||||
|                 if (exp?.NodeType == ExpressionType.Convert) exp = (exp as UnaryExpression)?.Operand; | ||||
|                 if (exp == null) throw new ArgumentException("参数错误 many 不能为 null"); | ||||
|                 if (exp == null) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("many")); | ||||
|  | ||||
|                 switch (exp.NodeType) | ||||
|                 { | ||||
| @@ -270,7 +270,7 @@ namespace FreeSql.Extensions.EfCoreFluentApi | ||||
|                         _withManyProperty = (exp as MemberExpression).Member.Name; | ||||
|                         break; | ||||
|                 } | ||||
|                 if (string.IsNullOrEmpty(_withManyProperty)) throw new ArgumentException("参数错误 many"); | ||||
|                 if (string.IsNullOrEmpty(_withManyProperty)) throw new ArgumentException(DbContextStrings.ParameterError("many")); | ||||
|  | ||||
|                 _tf.Navigate(_selfProperty, null, middleType); | ||||
|                 _fsql.CodeFirst.ConfigEntity<T2>(eb2 => eb2.Navigate(_withManyProperty, null, middleType)); | ||||
| @@ -279,7 +279,7 @@ namespace FreeSql.Extensions.EfCoreFluentApi | ||||
|             { | ||||
|                 var exp = one?.Body; | ||||
|                 if (exp?.NodeType == ExpressionType.Convert) exp = (exp as UnaryExpression)?.Operand; | ||||
|                 if (exp == null) throw new ArgumentException("参数错误 one 不能为 null"); | ||||
|                 if (exp == null) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("one")); | ||||
|  | ||||
|                 switch (exp.NodeType) | ||||
|                 { | ||||
| @@ -287,7 +287,7 @@ namespace FreeSql.Extensions.EfCoreFluentApi | ||||
|                         _withOneProperty = (exp as MemberExpression).Member.Name; | ||||
|                         break; | ||||
|                 } | ||||
|                 if (string.IsNullOrEmpty(_withOneProperty)) throw new ArgumentException("参数错误 one"); | ||||
|                 if (string.IsNullOrEmpty(_withOneProperty)) throw new ArgumentException(DbContextStrings.ParameterError("one")); | ||||
|                  | ||||
|                 if (string.IsNullOrEmpty(_selfBind) == false) | ||||
|                     _fsql.CodeFirst.ConfigEntity<T2>(eb2 => eb2.Navigate(_withOneProperty, _selfBind)); | ||||
| @@ -297,7 +297,7 @@ namespace FreeSql.Extensions.EfCoreFluentApi | ||||
|             { | ||||
|                 var exp = foreignKey?.Body; | ||||
|                 if (exp?.NodeType == ExpressionType.Convert) exp = (exp as UnaryExpression)?.Operand; | ||||
|                 if (exp == null) throw new ArgumentException("参数错误 foreignKey 不能为 null"); | ||||
|                 if (exp == null) throw new ArgumentException(DbContextStrings.ParameterError_CannotBeNull("foreignKey")); | ||||
|  | ||||
|                 switch (exp.NodeType) | ||||
|                 { | ||||
| @@ -312,7 +312,7 @@ namespace FreeSql.Extensions.EfCoreFluentApi | ||||
|                         _selfBind = _selfBind.TrimStart(',', ' '); | ||||
|                         break; | ||||
|                 } | ||||
|                 if (string.IsNullOrEmpty(_selfBind)) throw new ArgumentException("参数错误 foreignKey"); | ||||
|                 if (string.IsNullOrEmpty(_selfBind)) throw new ArgumentException(DbContextStrings.ParameterError("foreignKey")); | ||||
|                 _tf.Navigate(_selfProperty, _selfBind); | ||||
|                 if (string.IsNullOrEmpty(_withOneProperty) == false) | ||||
|                     _fsql.CodeFirst.ConfigEntity<T2>(eb2 => eb2.Navigate(_withOneProperty, _selfBind)); | ||||
|   | ||||
| @@ -21,7 +21,7 @@ namespace Microsoft.Extensions.DependencyInjection | ||||
|                 } | ||||
|                 catch(Exception ex) | ||||
|                 { | ||||
|                     throw new Exception($"AddFreeDbContext 发生错误,请检查 {dbContextType.Name} 的构造参数都已正确注入", ex); | ||||
|                     throw new Exception(DbContextStrings.AddFreeDbContextError_CheckConstruction(dbContextType.Name), ex); | ||||
|                 } | ||||
|                 if (ctx != null && ctx._ormScoped == null) | ||||
|                 { | ||||
| @@ -31,7 +31,7 @@ namespace Microsoft.Extensions.DependencyInjection | ||||
|                     ctx._optionsPriv = builder._options; | ||||
|  | ||||
|                     if (ctx._ormScoped == null) | ||||
|                         throw new Exception("请在 OnConfiguring 或 AddFreeDbContext 中配置 UseFreeSql"); | ||||
|                         throw new Exception(DbContextStrings.ConfigureUseFreeSql); | ||||
|  | ||||
|                     ctx.InitPropSets(); | ||||
|                 } | ||||
|   | ||||
| @@ -54,4 +54,30 @@ | ||||
| 		<ProjectReference Include="..\FreeSql\FreeSql.csproj" /> | ||||
| 	</ItemGroup> | ||||
|  | ||||
| 	<ItemGroup> | ||||
| 		<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" /> | ||||
| 	</ItemGroup> | ||||
|  | ||||
| 	<ItemGroup> | ||||
| 		<Compile Update="Properties\DbContextStrings.Designer.cs"> | ||||
| 			<DesignTime>True</DesignTime> | ||||
| 			<AutoGen>True</AutoGen> | ||||
| 			<DependentUpon>DbContextStrings.Designer.tt</DependentUpon> | ||||
| 		</Compile> | ||||
| 	</ItemGroup> | ||||
|  | ||||
| 	<ItemGroup> | ||||
| 		<None Update="Properties\DbContextStrings.Designer.tt"> | ||||
| 			<Generator>TextTemplatingFileGenerator</Generator> | ||||
| 			<LastGenOutput>DbContextStrings.Designer.cs</LastGenOutput> | ||||
| 		</None> | ||||
| 		<EmbeddedResource Update="Properties\DbContextStrings.en-US.resx"> | ||||
| 		  <SubType>Designer</SubType> | ||||
| 		  <CustomToolNamespace>FreeSql</CustomToolNamespace> | ||||
| 		</EmbeddedResource> | ||||
| 		<EmbeddedResource Update="Properties\DbContextStrings.resx"> | ||||
| 			<CustomToolNamespace>FreeSql</CustomToolNamespace> | ||||
| 		</EmbeddedResource> | ||||
| 	</ItemGroup> | ||||
|  | ||||
| </Project> | ||||
|   | ||||
| @@ -255,6 +255,227 @@ | ||||
|             <param name="data"></param> | ||||
|             <returns></returns> | ||||
|         </member> | ||||
|         <member name="T:FreeSql.DbContextStrings"> | ||||
|             <summary> | ||||
|                 <para> | ||||
|             	    String resources used in FreeSql exceptions, etc. | ||||
|                 </para> | ||||
|                 <para> | ||||
|             	    These strings are exposed publicly for use by database providers and extensions. | ||||
|                     It is unusual for application code to need these strings. | ||||
|                 </para> | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.DbContextStrings.AddFreeDbContextError_CheckConstruction(System.Object)"> | ||||
|             <summary> | ||||
|             AddFreeDbContext 发生错误,请检查 {dbContextTypeName} 的构造参数都已正确注入 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.DbContextStrings.CannotAdd_AlreadyExistsInStateManagement(System.Object)"> | ||||
|             <summary> | ||||
|             不可添加,已存在于状态管理:{entityString} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.DbContextStrings.CannotAdd_EntityHasNo_PrimaryKey(System.Object)"> | ||||
|             <summary> | ||||
|             不可添加,实体没有主键:{entityString} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.DbContextStrings.CannotAdd_PrimaryKey_NotSet(System.Object)"> | ||||
|             <summary> | ||||
|             不可添加,未设置主键的值:{entityString} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.DbContextStrings.CannotAdd_SelfIncreasingHasValue(System.Object)"> | ||||
|             <summary> | ||||
|             不可添加,自增属性有值:{entityString} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.DbContextStrings.CannotAttach_EntityHasNo_PrimaryKey(System.Object)"> | ||||
|             <summary> | ||||
|             不可附加,实体没有主键:{entityString} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.DbContextStrings.CannotAttach_PrimaryKey_NotSet(System.Object)"> | ||||
|             <summary> | ||||
|             不可附加,未设置主键的值:{entityString} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.DbContextStrings.CannotDelete_DataNotTracked_ShouldQuery(System.Object)"> | ||||
|             <summary> | ||||
|             不可删除,数据未被跟踪,应该先查询:{entityString} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.DbContextStrings.CannotDelete_EntityHasNo_PrimaryKey(System.Object)"> | ||||
|             <summary> | ||||
|             不可删除,实体没有主键:{entityString} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.DbContextStrings.CannotDelete_PrimaryKey_NotSet(System.Object)"> | ||||
|             <summary> | ||||
|             不可删除,未设置主键的值:{entityString} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.DbContextStrings.CannotEdit_EntityHasNo_PrimaryKey(System.Object)"> | ||||
|             <summary> | ||||
|             不可进行编辑,实体没有主键:{entityString} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.DbContextStrings.CannotUpdate_DataShouldQueryOrAttach(System.Object)"> | ||||
|             <summary> | ||||
|             不可更新,数据未被跟踪,应该先查询 或者 Attach:{entityString} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.DbContextStrings.CannotUpdate_EntityHasNo_PrimaryKey(System.Object)"> | ||||
|             <summary> | ||||
|             不可更新,实体没有主键:{entityString} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.DbContextStrings.CannotUpdate_PrimaryKey_NotSet(System.Object)"> | ||||
|             <summary> | ||||
|             不可更新,未设置主键的值:{entityString} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.DbContextStrings.CannotUpdate_RecordDoesNotExist(System.Object)"> | ||||
|             <summary> | ||||
|             不可更新,数据库不存在该记录:{entityString} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.DbContextStrings.ConfigureUseFreeSql"> | ||||
|             <summary> | ||||
|             请在 OnConfiguring 或 AddFreeDbContext 中配置 UseFreeSql | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.DbContextStrings.DbSetAsType_NotSupport_Object"> | ||||
|             <summary> | ||||
|             DbSet.AsType 参数错误,请传入正确的实体类型 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.DbContextStrings.EntityType_CannotConvert(System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             实体类型 {EntityTypeName} 无法转换为 {name},无法使用该方法 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.DbContextStrings.EntityType_PrimaryKeyError(System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             实体类型 {EntityTypeName} 主键类型不为 {fullName},无法使用该方法 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.DbContextStrings.EntityType_PrimaryKeyIsNotOne(System.Object)"> | ||||
|             <summary> | ||||
|             实体类型 {EntityTypeName} 主键数量不为 1,无法使用该方法 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.DbContextStrings.FailedSetFilter_NotBelongIRpository"> | ||||
|             <summary> | ||||
|             FreeSql.Repository 设置过滤器失败,原因是对象不属于 IRepository | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.DbContextStrings.Incomparable_EntityHasNo_PrimaryKey(System.Object)"> | ||||
|             <summary> | ||||
|             不可比较,实体没有主键:{entityString} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.DbContextStrings.Incomparable_PrimaryKey_NotSet(System.Object)"> | ||||
|             <summary> | ||||
|             不可比较,未设置主键的值:{entityString} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.DbContextStrings.InsertError_Filter(System.Object,System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             FreeSql.Repository Insert 失败,因为设置了过滤器 {filterKey}: {filterValueExpression},插入的数据不符合 {entityString} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.DbContextStrings.ISelectAsType_ParameterError"> | ||||
|             <summary> | ||||
|             ISelect.AsType 参数不支持指定为 object | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.DbContextStrings.NotFound_Property(System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             {tableTypeFullName} 不存在属性 {propertyName} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.DbContextStrings.NotFoundMethod_StatesRemoveByObjects"> | ||||
|             <summary> | ||||
|             找不到方法 DbSet<>.StatesRemoveByObjects | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.DbContextStrings.ParameterDataTypeError(System.Object)"> | ||||
|             <summary> | ||||
|             参数 data 类型错误 {entityTypeFullName}  | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.DbContextStrings.ParameterError(System.Object)"> | ||||
|             <summary> | ||||
|             参数错误 {param} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.DbContextStrings.ParameterError_CannotBeNull(System.Object)"> | ||||
|             <summary> | ||||
|             参数错误 {param} 不能为 null | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.DbContextStrings.ParameterError_IsNot_CollectionProperties(System.Object)"> | ||||
|             <summary> | ||||
|             参数错误 {many} 不是集合属性 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.DbContextStrings.ParameterError_NotFound_CollectionProperties(System.Object)"> | ||||
|             <summary> | ||||
|             参数错误 {many} 集合属性不存在 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.DbContextStrings.ParameterError_NotFound_Property(System.Object)"> | ||||
|             <summary> | ||||
|             参数错误 {one} 属性不存在 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.DbContextStrings.Propagation_Mandatory"> | ||||
|             <summary> | ||||
|             Propagation_Mandatory: 使用当前事务,如果没有当前事务,就抛出异常 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.DbContextStrings.Propagation_Never"> | ||||
|             <summary> | ||||
|             Propagation_Never: 以非事务方式执行操作,如果当前事务存在则抛出异常 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.DbContextStrings.PropertyOfType_IsNot_OneToManyOrManyToMany(System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             {tableTypeFullName} 类型的属性 {propertyName} 不是 OneToMany 或 ManyToMany 特性 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.DbContextStrings.SpecialError_BatchAdditionFailed(System.Object)"> | ||||
|             <summary> | ||||
|             特别错误:批量添加失败,{dataType} 的返回数据,与添加的数目不匹配 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.DbContextStrings.SpecialError_UpdateFailedDataNotTracked(System.Object)"> | ||||
|             <summary> | ||||
|             特别错误:更新失败,数据未被跟踪:{entityString} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.DbContextStrings.TransactionHasBeenStarted"> | ||||
|             <summary> | ||||
|             已开启事务,不能禁用工作单元 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.DbContextStrings.TypeHasSetProperty_IgnoreAttribute(System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             {tableTypeFullName} 类型已设置属性 {propertyName} 忽略特性 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.DbContextStrings.UnitOfWorkManager_Construction_CannotBeNull(System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             {unitOfWorkManager} 构造参数 {fsql} 不能为 null | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.DbContextStrings.UpdateError_Filter(System.Object,System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             FreeSql.Repository Update 失败,因为设置了过滤器 {filterKey}: {filterValueExpression},更新的数据不符合{entityString} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.IRepositoryUnitOfWork.GetRepository``2(System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}})"> | ||||
|             <summary> | ||||
|             在工作单元内创建默认仓库类,工作单元下的仓储操作具有事务特点 | ||||
| @@ -559,14 +780,5 @@ | ||||
|             <param name="that"></param> | ||||
|             <returns></returns> | ||||
|         </member> | ||||
|         <member name="M:Microsoft.Extensions.DependencyInjection.FreeSqlRepositoryDependencyInjection.AddFreeRepository(Microsoft.Extensions.DependencyInjection.IServiceCollection,System.Action{FreeSql.FluentDataFilter},System.Reflection.Assembly[])"> | ||||
|             <summary> | ||||
|             批量注入 Repository,可以参考代码自行调整 | ||||
|             </summary> | ||||
|             <param name="services"></param> | ||||
|             <param name="globalDataFilter"></param> | ||||
|             <param name="assemblies"></param> | ||||
|             <returns></returns> | ||||
|         </member> | ||||
|     </members> | ||||
| </doc> | ||||
|   | ||||
							
								
								
									
										357
									
								
								FreeSql.DbContext/Properties/DbContextStrings.Designer.cs
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										357
									
								
								FreeSql.DbContext/Properties/DbContextStrings.Designer.cs
									
									
									
										generated
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,357 @@ | ||||
|  | ||||
| // <auto-generated /> | ||||
|  | ||||
| using System; | ||||
| using System.Reflection; | ||||
| using System.Resources; | ||||
| using System.Threading; | ||||
|  | ||||
| namespace FreeSql | ||||
| { | ||||
|     /// <summary> | ||||
|     ///     <para> | ||||
|     ///		    String resources used in FreeSql exceptions, etc. | ||||
|     ///     </para> | ||||
|     ///     <para> | ||||
|     ///		    These strings are exposed publicly for use by database providers and extensions. | ||||
|     ///         It is unusual for application code to need these strings. | ||||
|     ///     </para> | ||||
|     /// </summary> | ||||
|     public static class DbContextStrings | ||||
|     { | ||||
|         private static readonly ResourceManager _resourceManager | ||||
|             = new ResourceManager("FreeSql.DbContext.Properties.DbContextStrings", typeof(DbContextStrings).Assembly); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// AddFreeDbContext 发生错误,请检查 {dbContextTypeName} 的构造参数都已正确注入 | ||||
|         /// </summary> | ||||
|         public static string AddFreeDbContextError_CheckConstruction(object dbContextTypeName) | ||||
|             => string.Format( | ||||
|                 GetString("AddFreeDbContextError_CheckConstruction", nameof(dbContextTypeName)), | ||||
|                 dbContextTypeName); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 不可添加,已存在于状态管理:{entityString} | ||||
|         /// </summary> | ||||
|         public static string CannotAdd_AlreadyExistsInStateManagement(object entityString) | ||||
|             => string.Format( | ||||
|                 GetString("CannotAdd_AlreadyExistsInStateManagement", nameof(entityString)), | ||||
|                 entityString); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 不可添加,实体没有主键:{entityString} | ||||
|         /// </summary> | ||||
|         public static string CannotAdd_EntityHasNo_PrimaryKey(object entityString) | ||||
|             => string.Format( | ||||
|                 GetString("CannotAdd_EntityHasNo_PrimaryKey", nameof(entityString)), | ||||
|                 entityString); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 不可添加,未设置主键的值:{entityString} | ||||
|         /// </summary> | ||||
|         public static string CannotAdd_PrimaryKey_NotSet(object entityString) | ||||
|             => string.Format( | ||||
|                 GetString("CannotAdd_PrimaryKey_NotSet", nameof(entityString)), | ||||
|                 entityString); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 不可添加,自增属性有值:{entityString} | ||||
|         /// </summary> | ||||
|         public static string CannotAdd_SelfIncreasingHasValue(object entityString) | ||||
|             => string.Format( | ||||
|                 GetString("CannotAdd_SelfIncreasingHasValue", nameof(entityString)), | ||||
|                 entityString); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 不可附加,实体没有主键:{entityString} | ||||
|         /// </summary> | ||||
|         public static string CannotAttach_EntityHasNo_PrimaryKey(object entityString) | ||||
|             => string.Format( | ||||
|                 GetString("CannotAttach_EntityHasNo_PrimaryKey", nameof(entityString)), | ||||
|                 entityString); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 不可附加,未设置主键的值:{entityString} | ||||
|         /// </summary> | ||||
|         public static string CannotAttach_PrimaryKey_NotSet(object entityString) | ||||
|             => string.Format( | ||||
|                 GetString("CannotAttach_PrimaryKey_NotSet", nameof(entityString)), | ||||
|                 entityString); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 不可删除,数据未被跟踪,应该先查询:{entityString} | ||||
|         /// </summary> | ||||
|         public static string CannotDelete_DataNotTracked_ShouldQuery(object entityString) | ||||
|             => string.Format( | ||||
|                 GetString("CannotDelete_DataNotTracked_ShouldQuery", nameof(entityString)), | ||||
|                 entityString); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 不可删除,实体没有主键:{entityString} | ||||
|         /// </summary> | ||||
|         public static string CannotDelete_EntityHasNo_PrimaryKey(object entityString) | ||||
|             => string.Format( | ||||
|                 GetString("CannotDelete_EntityHasNo_PrimaryKey", nameof(entityString)), | ||||
|                 entityString); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 不可删除,未设置主键的值:{entityString} | ||||
|         /// </summary> | ||||
|         public static string CannotDelete_PrimaryKey_NotSet(object entityString) | ||||
|             => string.Format( | ||||
|                 GetString("CannotDelete_PrimaryKey_NotSet", nameof(entityString)), | ||||
|                 entityString); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 不可进行编辑,实体没有主键:{entityString} | ||||
|         /// </summary> | ||||
|         public static string CannotEdit_EntityHasNo_PrimaryKey(object entityString) | ||||
|             => string.Format( | ||||
|                 GetString("CannotEdit_EntityHasNo_PrimaryKey", nameof(entityString)), | ||||
|                 entityString); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 不可更新,数据未被跟踪,应该先查询 或者 Attach:{entityString} | ||||
|         /// </summary> | ||||
|         public static string CannotUpdate_DataShouldQueryOrAttach(object entityString) | ||||
|             => string.Format( | ||||
|                 GetString("CannotUpdate_DataShouldQueryOrAttach", nameof(entityString)), | ||||
|                 entityString); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 不可更新,实体没有主键:{entityString} | ||||
|         /// </summary> | ||||
|         public static string CannotUpdate_EntityHasNo_PrimaryKey(object entityString) | ||||
|             => string.Format( | ||||
|                 GetString("CannotUpdate_EntityHasNo_PrimaryKey", nameof(entityString)), | ||||
|                 entityString); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 不可更新,未设置主键的值:{entityString} | ||||
|         /// </summary> | ||||
|         public static string CannotUpdate_PrimaryKey_NotSet(object entityString) | ||||
|             => string.Format( | ||||
|                 GetString("CannotUpdate_PrimaryKey_NotSet", nameof(entityString)), | ||||
|                 entityString); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 不可更新,数据库不存在该记录:{entityString} | ||||
|         /// </summary> | ||||
|         public static string CannotUpdate_RecordDoesNotExist(object entityString) | ||||
|             => string.Format( | ||||
|                 GetString("CannotUpdate_RecordDoesNotExist", nameof(entityString)), | ||||
|                 entityString); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 请在 OnConfiguring 或 AddFreeDbContext 中配置 UseFreeSql | ||||
|         /// </summary> | ||||
|         public static string ConfigureUseFreeSql | ||||
|             => GetString("ConfigureUseFreeSql"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// DbSet.AsType 参数错误,请传入正确的实体类型 | ||||
|         /// </summary> | ||||
|         public static string DbSetAsType_NotSupport_Object | ||||
|             => GetString("DbSetAsType_NotSupport_Object"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 实体类型 {EntityTypeName} 无法转换为 {name},无法使用该方法 | ||||
|         /// </summary> | ||||
|         public static string EntityType_CannotConvert(object EntityTypeName, object name) | ||||
|             => string.Format( | ||||
|                 GetString("EntityType_CannotConvert", nameof(EntityTypeName), nameof(name)), | ||||
|                 EntityTypeName, name); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 实体类型 {EntityTypeName} 主键类型不为 {fullName},无法使用该方法 | ||||
|         /// </summary> | ||||
|         public static string EntityType_PrimaryKeyError(object EntityTypeName, object fullName) | ||||
|             => string.Format( | ||||
|                 GetString("EntityType_PrimaryKeyError", nameof(EntityTypeName), nameof(fullName)), | ||||
|                 EntityTypeName, fullName); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 实体类型 {EntityTypeName} 主键数量不为 1,无法使用该方法 | ||||
|         /// </summary> | ||||
|         public static string EntityType_PrimaryKeyIsNotOne(object EntityTypeName) | ||||
|             => string.Format( | ||||
|                 GetString("EntityType_PrimaryKeyIsNotOne", nameof(EntityTypeName)), | ||||
|                 EntityTypeName); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// FreeSql.Repository 设置过滤器失败,原因是对象不属于 IRepository | ||||
|         /// </summary> | ||||
|         public static string FailedSetFilter_NotBelongIRpository | ||||
|             => GetString("FailedSetFilter_NotBelongIRpository"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 不可比较,实体没有主键:{entityString} | ||||
|         /// </summary> | ||||
|         public static string Incomparable_EntityHasNo_PrimaryKey(object entityString) | ||||
|             => string.Format( | ||||
|                 GetString("Incomparable_EntityHasNo_PrimaryKey", nameof(entityString)), | ||||
|                 entityString); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 不可比较,未设置主键的值:{entityString} | ||||
|         /// </summary> | ||||
|         public static string Incomparable_PrimaryKey_NotSet(object entityString) | ||||
|             => string.Format( | ||||
|                 GetString("Incomparable_PrimaryKey_NotSet", nameof(entityString)), | ||||
|                 entityString); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// FreeSql.Repository Insert 失败,因为设置了过滤器 {filterKey}: {filterValueExpression},插入的数据不符合 {entityString} | ||||
|         /// </summary> | ||||
|         public static string InsertError_Filter(object filterKey, object filterValueExpression, object entityString) | ||||
|             => string.Format( | ||||
|                 GetString("InsertError_Filter", nameof(filterKey), nameof(filterValueExpression), nameof(entityString)), | ||||
|                 filterKey, filterValueExpression, entityString); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// ISelect.AsType 参数不支持指定为 object | ||||
|         /// </summary> | ||||
|         public static string ISelectAsType_ParameterError | ||||
|             => GetString("ISelectAsType_ParameterError"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// {tableTypeFullName} 不存在属性 {propertyName} | ||||
|         /// </summary> | ||||
|         public static string NotFound_Property(object tableTypeFullName, object propertyName) | ||||
|             => string.Format( | ||||
|                 GetString("NotFound_Property", nameof(tableTypeFullName), nameof(propertyName)), | ||||
|                 tableTypeFullName, propertyName); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 找不到方法 DbSet<>.StatesRemoveByObjects | ||||
|         /// </summary> | ||||
|         public static string NotFoundMethod_StatesRemoveByObjects | ||||
|             => GetString("NotFoundMethod_StatesRemoveByObjects"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 参数 data 类型错误 {entityTypeFullName}  | ||||
|         /// </summary> | ||||
|         public static string ParameterDataTypeError(object entityTypeFullName) | ||||
|             => string.Format( | ||||
|                 GetString("ParameterDataTypeError", nameof(entityTypeFullName)), | ||||
|                 entityTypeFullName); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 参数错误 {param} | ||||
|         /// </summary> | ||||
|         public static string ParameterError(object param) | ||||
|             => string.Format( | ||||
|                 GetString("ParameterError", nameof(param)), | ||||
|                 param); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 参数错误 {param} 不能为 null | ||||
|         /// </summary> | ||||
|         public static string ParameterError_CannotBeNull(object param) | ||||
|             => string.Format( | ||||
|                 GetString("ParameterError_CannotBeNull", nameof(param)), | ||||
|                 param); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 参数错误 {many} 不是集合属性 | ||||
|         /// </summary> | ||||
|         public static string ParameterError_IsNot_CollectionProperties(object many) | ||||
|             => string.Format( | ||||
|                 GetString("ParameterError_IsNot_CollectionProperties", nameof(many)), | ||||
|                 many); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 参数错误 {many} 集合属性不存在 | ||||
|         /// </summary> | ||||
|         public static string ParameterError_NotFound_CollectionProperties(object many) | ||||
|             => string.Format( | ||||
|                 GetString("ParameterError_NotFound_CollectionProperties", nameof(many)), | ||||
|                 many); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 参数错误 {one} 属性不存在 | ||||
|         /// </summary> | ||||
|         public static string ParameterError_NotFound_Property(object one) | ||||
|             => string.Format( | ||||
|                 GetString("ParameterError_NotFound_Property", nameof(one)), | ||||
|                 one); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Propagation_Mandatory: 使用当前事务,如果没有当前事务,就抛出异常 | ||||
|         /// </summary> | ||||
|         public static string Propagation_Mandatory | ||||
|             => GetString("Propagation_Mandatory"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Propagation_Never: 以非事务方式执行操作,如果当前事务存在则抛出异常 | ||||
|         /// </summary> | ||||
|         public static string Propagation_Never | ||||
|             => GetString("Propagation_Never"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// {tableTypeFullName} 类型的属性 {propertyName} 不是 OneToMany 或 ManyToMany 特性 | ||||
|         /// </summary> | ||||
|         public static string PropertyOfType_IsNot_OneToManyOrManyToMany(object tableTypeFullName, object propertyName) | ||||
|             => string.Format( | ||||
|                 GetString("PropertyOfType_IsNot_OneToManyOrManyToMany", nameof(tableTypeFullName), nameof(propertyName)), | ||||
|                 tableTypeFullName, propertyName); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 特别错误:批量添加失败,{dataType} 的返回数据,与添加的数目不匹配 | ||||
|         /// </summary> | ||||
|         public static string SpecialError_BatchAdditionFailed(object dataType) | ||||
|             => string.Format( | ||||
|                 GetString("SpecialError_BatchAdditionFailed", nameof(dataType)), | ||||
|                 dataType); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 特别错误:更新失败,数据未被跟踪:{entityString} | ||||
|         /// </summary> | ||||
|         public static string SpecialError_UpdateFailedDataNotTracked(object entityString) | ||||
|             => string.Format( | ||||
|                 GetString("SpecialError_UpdateFailedDataNotTracked", nameof(entityString)), | ||||
|                 entityString); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 已开启事务,不能禁用工作单元 | ||||
|         /// </summary> | ||||
|         public static string TransactionHasBeenStarted | ||||
|             => GetString("TransactionHasBeenStarted"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// {tableTypeFullName} 类型已设置属性 {propertyName} 忽略特性 | ||||
|         /// </summary> | ||||
|         public static string TypeHasSetProperty_IgnoreAttribute(object tableTypeFullName, object propertyName) | ||||
|             => string.Format( | ||||
|                 GetString("TypeHasSetProperty_IgnoreAttribute", nameof(tableTypeFullName), nameof(propertyName)), | ||||
|                 tableTypeFullName, propertyName); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// {unitOfWorkManager} 构造参数 {fsql} 不能为 null | ||||
|         /// </summary> | ||||
|         public static string UnitOfWorkManager_Construction_CannotBeNull(object unitOfWorkManager, object fsql) | ||||
|             => string.Format( | ||||
|                 GetString("UnitOfWorkManager_Construction_CannotBeNull", nameof(unitOfWorkManager), nameof(fsql)), | ||||
|                 unitOfWorkManager, fsql); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// FreeSql.Repository Update 失败,因为设置了过滤器 {filterKey}: {filterValueExpression},更新的数据不符合{entityString} | ||||
|         /// </summary> | ||||
|         public static string UpdateError_Filter(object filterKey, object filterValueExpression, object entityString) | ||||
|             => string.Format( | ||||
|                 GetString("UpdateError_Filter", nameof(filterKey), nameof(filterValueExpression), nameof(entityString)), | ||||
|                 filterKey, filterValueExpression, entityString); | ||||
|  | ||||
|         private static string GetString(string name, params string[] formatterNames) | ||||
|         { | ||||
|             var value = _resourceManager.GetString(name); | ||||
|             for (var i = 0; i < formatterNames.Length; i++) | ||||
|             { | ||||
|                 value = value.Replace("{" + formatterNames[i] + "}", "{" + i + "}"); | ||||
|             } | ||||
|  | ||||
|             return value; | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| @@ -0,0 +1,5 @@ | ||||
| <# | ||||
|     Session["ResourceFile"] = "DbContextStrings.resx"; | ||||
|     Session["AccessModifier"] = "public"; | ||||
| #> | ||||
| <#@ include file="../../FreeSql/Properties/Resources.tt" #> | ||||
							
								
								
									
										246
									
								
								FreeSql.DbContext/Properties/DbContextStrings.en-US.resx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										246
									
								
								FreeSql.DbContext/Properties/DbContextStrings.en-US.resx
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,246 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <root> | ||||
|   <!--  | ||||
|     Microsoft ResX Schema  | ||||
|      | ||||
|     Version 2.0 | ||||
|      | ||||
|     The primary goals of this format is to allow a simple XML format  | ||||
|     that is mostly human readable. The generation and parsing of the  | ||||
|     various data types are done through the TypeConverter classes  | ||||
|     associated with the data types. | ||||
|      | ||||
|     Example: | ||||
|      | ||||
|     ... ado.net/XML headers & schema ... | ||||
|     <resheader name="resmimetype">text/microsoft-resx</resheader> | ||||
|     <resheader name="version">2.0</resheader> | ||||
|     <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> | ||||
|     <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> | ||||
|     <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> | ||||
|     <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> | ||||
|     <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> | ||||
|         <value>[base64 mime encoded serialized .NET Framework object]</value> | ||||
|     </data> | ||||
|     <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | ||||
|         <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> | ||||
|         <comment>This is a comment</comment> | ||||
|     </data> | ||||
|                  | ||||
|     There are any number of "resheader" rows that contain simple  | ||||
|     name/value pairs. | ||||
|      | ||||
|     Each data row contains a name, and value. The row also contains a  | ||||
|     type or mimetype. Type corresponds to a .NET class that support  | ||||
|     text/value conversion through the TypeConverter architecture.  | ||||
|     Classes that don't support this are serialized and stored with the  | ||||
|     mimetype set. | ||||
|      | ||||
|     The mimetype is used for serialized objects, and tells the  | ||||
|     ResXResourceReader how to depersist the object. This is currently not  | ||||
|     extensible. For a given mimetype the value must be set accordingly: | ||||
|      | ||||
|     Note - application/x-microsoft.net.object.binary.base64 is the format  | ||||
|     that the ResXResourceWriter will generate, however the reader can  | ||||
|     read any of the formats listed below. | ||||
|      | ||||
|     mimetype: application/x-microsoft.net.object.binary.base64 | ||||
|     value   : The object must be serialized with  | ||||
|             : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter | ||||
|             : and then encoded with base64 encoding. | ||||
|      | ||||
|     mimetype: application/x-microsoft.net.object.soap.base64 | ||||
|     value   : The object must be serialized with  | ||||
|             : System.Runtime.Serialization.Formatters.Soap.SoapFormatter | ||||
|             : and then encoded with base64 encoding. | ||||
|  | ||||
|     mimetype: application/x-microsoft.net.object.bytearray.base64 | ||||
|     value   : The object must be serialized into a byte array  | ||||
|             : using a System.ComponentModel.TypeConverter | ||||
|             : and then encoded with base64 encoding. | ||||
|     --> | ||||
|   <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> | ||||
|     <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> | ||||
|     <xsd:element name="root" msdata:IsDataSet="true"> | ||||
|       <xsd:complexType> | ||||
|         <xsd:choice maxOccurs="unbounded"> | ||||
|           <xsd:element name="metadata"> | ||||
|             <xsd:complexType> | ||||
|               <xsd:sequence> | ||||
|                 <xsd:element name="value" type="xsd:string" minOccurs="0" /> | ||||
|               </xsd:sequence> | ||||
|               <xsd:attribute name="name" use="required" type="xsd:string" /> | ||||
|               <xsd:attribute name="type" type="xsd:string" /> | ||||
|               <xsd:attribute name="mimetype" type="xsd:string" /> | ||||
|               <xsd:attribute ref="xml:space" /> | ||||
|             </xsd:complexType> | ||||
|           </xsd:element> | ||||
|           <xsd:element name="assembly"> | ||||
|             <xsd:complexType> | ||||
|               <xsd:attribute name="alias" type="xsd:string" /> | ||||
|               <xsd:attribute name="name" type="xsd:string" /> | ||||
|             </xsd:complexType> | ||||
|           </xsd:element> | ||||
|           <xsd:element name="data"> | ||||
|             <xsd:complexType> | ||||
|               <xsd:sequence> | ||||
|                 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | ||||
|                 <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> | ||||
|               </xsd:sequence> | ||||
|               <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> | ||||
|               <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> | ||||
|               <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> | ||||
|               <xsd:attribute ref="xml:space" /> | ||||
|             </xsd:complexType> | ||||
|           </xsd:element> | ||||
|           <xsd:element name="resheader"> | ||||
|             <xsd:complexType> | ||||
|               <xsd:sequence> | ||||
|                 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | ||||
|               </xsd:sequence> | ||||
|               <xsd:attribute name="name" type="xsd:string" use="required" /> | ||||
|             </xsd:complexType> | ||||
|           </xsd:element> | ||||
|         </xsd:choice> | ||||
|       </xsd:complexType> | ||||
|     </xsd:element> | ||||
|   </xsd:schema> | ||||
|   <resheader name="resmimetype"> | ||||
|     <value>text/microsoft-resx</value> | ||||
|   </resheader> | ||||
|   <resheader name="version"> | ||||
|     <value>2.0</value> | ||||
|   </resheader> | ||||
|   <resheader name="reader"> | ||||
|     <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||||
|   </resheader> | ||||
|   <resheader name="writer"> | ||||
|     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||||
|   </resheader> | ||||
|   <data name="AddFreeDbContextError_CheckConstruction" xml:space="preserve"> | ||||
|     <value>An error occurred in AddFreeDbContext, check that the construction parameters of {dbContextTypeName} have been injected correctly</value> | ||||
|   </data> | ||||
|   <data name="CannotAdd_AlreadyExistsInStateManagement" xml:space="preserve"> | ||||
|     <value>Not addable, already exists in state management: {entityString}</value> | ||||
|   </data> | ||||
|   <data name="CannotAdd_EntityHasNo_PrimaryKey" xml:space="preserve"> | ||||
|     <value>Not addable, entity has no primary key: {entityString}</value> | ||||
|   </data> | ||||
|   <data name="CannotAdd_PrimaryKey_NotSet" xml:space="preserve"> | ||||
|     <value>Not addable, no value for primary key set: {entityString}</value> | ||||
|   </data> | ||||
|   <data name="CannotAdd_SelfIncreasingHasValue" xml:space="preserve"> | ||||
|     <value>Not addable, self-increasing attribute has value: {entityString}</value> | ||||
|   </data> | ||||
|   <data name="CannotAttach_EntityHasNo_PrimaryKey" xml:space="preserve"> | ||||
|     <value>Not attachable, entity has no primary key: {entityString}</value> | ||||
|   </data> | ||||
|   <data name="CannotAttach_PrimaryKey_NotSet" xml:space="preserve"> | ||||
|     <value>Not attachable, no value for primary key set: {entityString}</value> | ||||
|   </data> | ||||
|   <data name="CannotDelete_DataNotTracked_ShouldQuery" xml:space="preserve"> | ||||
|     <value>Not deletable, data not tracked, should query first: {entityString}</value> | ||||
|   </data> | ||||
|   <data name="CannotDelete_EntityHasNo_PrimaryKey" xml:space="preserve"> | ||||
|     <value>Not deletable, entity has no primary key: {entityString}</value> | ||||
|   </data> | ||||
|   <data name="CannotDelete_PrimaryKey_NotSet" xml:space="preserve"> | ||||
|     <value>Not deletable, no value for primary key set: {entityString}</value> | ||||
|   </data> | ||||
|   <data name="CannotEdit_EntityHasNo_PrimaryKey" xml:space="preserve"> | ||||
|     <value>Not editable, entity has no primary key: {entityString}</value> | ||||
|   </data> | ||||
|   <data name="CannotUpdate_DataShouldQueryOrAttach" xml:space="preserve"> | ||||
|     <value>Not updatable, data not tracked, should be queried first or Attach:{entityString}</value> | ||||
|   </data> | ||||
|   <data name="CannotUpdate_EntityHasNo_PrimaryKey" xml:space="preserve"> | ||||
|     <value>Not updatable, entity has no primary key: {entityString}</value> | ||||
|   </data> | ||||
|   <data name="CannotUpdate_PrimaryKey_NotSet" xml:space="preserve"> | ||||
|     <value>Not updatable, no value for primary key set: {entityString}</value> | ||||
|   </data> | ||||
|   <data name="CannotUpdate_RecordDoesNotExist" xml:space="preserve"> | ||||
|     <value>Not updatable, the record does not exist in the database: {entityString}</value> | ||||
|   </data> | ||||
|   <data name="ConfigureUseFreeSql" xml:space="preserve"> | ||||
|     <value>Please configure UseFreeSql in OnConfiguring or AddFreeDbContext</value> | ||||
|   </data> | ||||
|   <data name="DbSetAsType_NotSupport_Object" xml:space="preserve"> | ||||
|     <value>DbSet. AsType parameter error, please pass in the correct entity type</value> | ||||
|   </data> | ||||
|   <data name="EntityType_CannotConvert" xml:space="preserve"> | ||||
|     <value>Entity type {EntityTypeName} cannot be converted to {name} and cannot use this method</value> | ||||
|   </data> | ||||
|   <data name="EntityType_PrimaryKeyError" xml:space="preserve"> | ||||
|     <value>Entity type {EntityTypeName} Primary key type is not {fullName} and cannot be used with this method</value> | ||||
|   </data> | ||||
|   <data name="EntityType_PrimaryKeyIsNotOne" xml:space="preserve"> | ||||
|     <value>Entity type {EntityTypeName} Primary key number is not 1 and cannot be used with this method</value> | ||||
|   </data> | ||||
|   <data name="FailedSetFilter_NotBelongIRpository" xml:space="preserve"> | ||||
|     <value>FreeSql. Repository failed to set filter because object does not belong to IRepository</value> | ||||
|   </data> | ||||
|   <data name="Incomparable_EntityHasNo_PrimaryKey" xml:space="preserve"> | ||||
|     <value>Not comparable, entity has no primary key: {entityString}</value> | ||||
|   </data> | ||||
|   <data name="Incomparable_PrimaryKey_NotSet" xml:space="preserve"> | ||||
|     <value>Non-comparable, no value for primary key set: {entityString}</value> | ||||
|   </data> | ||||
|   <data name="InsertError_Filter" xml:space="preserve"> | ||||
|     <value>FreeSql. Repository Insert failed because the filter {filterKey}: {filterValueExpression} was set and the inserted data does not conform to {entityString}</value> | ||||
|   </data> | ||||
|   <data name="ISelectAsType_ParameterError" xml:space="preserve"> | ||||
|     <value>ISelect. AsType parameter does not support specifying as object</value> | ||||
|   </data> | ||||
|   <data name="NotFound_Property" xml:space="preserve"> | ||||
|     <value>Property {propertyName} does not exist for {tableTypeFullName}</value> | ||||
|   </data> | ||||
|   <data name="NotFoundMethod_StatesRemoveByObjects" xml:space="preserve"> | ||||
|     <value>Method DbSet<> not found. StatesRemoveByObjects</value> | ||||
|   </data> | ||||
|   <data name="ParameterDataTypeError" xml:space="preserve"> | ||||
|     <value>Parameter data type error {entityTypeFullName}</value> | ||||
|   </data> | ||||
|   <data name="ParameterError" xml:space="preserve"> | ||||
|     <value>Parameter error {param}</value> | ||||
|   </data> | ||||
|   <data name="ParameterError_CannotBeNull" xml:space="preserve"> | ||||
|     <value>Parameter error {param} cannot be null</value> | ||||
|   </data> | ||||
|   <data name="ParameterError_IsNot_CollectionProperties" xml:space="preserve"> | ||||
|     <value>Parameter error {many} is not a collection property</value> | ||||
|   </data> | ||||
|   <data name="ParameterError_NotFound_CollectionProperties" xml:space="preserve"> | ||||
|     <value>Parameter error {many} Collection property does not exist</value> | ||||
|   </data> | ||||
|   <data name="ParameterError_NotFound_Property" xml:space="preserve"> | ||||
|     <value>Parameter error {one} attribute does not exist</value> | ||||
|   </data> | ||||
|   <data name="Propagation_Mandatory" xml:space="preserve"> | ||||
|     <value>Propagation_ Mandatory: With the current transaction, throw an exception if there is no current transaction</value> | ||||
|   </data> | ||||
|   <data name="Propagation_Never" xml:space="preserve"> | ||||
|     <value>Propagation_ Never: Perform the operation non-transactionally and throw an exception if the current transaction exists</value> | ||||
|   </data> | ||||
|   <data name="PropertyOfType_IsNot_OneToManyOrManyToMany" xml:space="preserve"> | ||||
|     <value>Property {propertyName} of type {tableTypeFullName} is not OneToMany or ManyToMany attribute</value> | ||||
|   </data> | ||||
|   <data name="SpecialError_BatchAdditionFailed" xml:space="preserve"> | ||||
|     <value>Special error: Bulk add failed, {dataType} returned data, does not match the number added</value> | ||||
|   </data> | ||||
|   <data name="SpecialError_UpdateFailedDataNotTracked" xml:space="preserve"> | ||||
|     <value>Special error: Update failed, data not tracked: {entityString}</value> | ||||
|   </data> | ||||
|   <data name="TransactionHasBeenStarted" xml:space="preserve"> | ||||
|     <value>Transaction opened, unit of work cannot be disabled</value> | ||||
|   </data> | ||||
|   <data name="TypeHasSetProperty_IgnoreAttribute" xml:space="preserve"> | ||||
|     <value>The {tableTypeFullName} type has set the property {propertyName} Ignore the attribute</value> | ||||
|   </data> | ||||
|   <data name="UnitOfWorkManager_Construction_CannotBeNull" xml:space="preserve"> | ||||
|     <value>The {unitOfWorkManager} constructor parameter {fsql} cannot be null</value> | ||||
|   </data> | ||||
|   <data name="UpdateError_Filter" xml:space="preserve"> | ||||
|     <value>FreeSql. Repository Update failed because the filter {filterKey}: {filterValueExpression} is set and the updated data does not conform to {entityString}</value> | ||||
|   </data> | ||||
| </root> | ||||
							
								
								
									
										246
									
								
								FreeSql.DbContext/Properties/DbContextStrings.resx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										246
									
								
								FreeSql.DbContext/Properties/DbContextStrings.resx
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,246 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <root> | ||||
|   <!--  | ||||
|     Microsoft ResX Schema  | ||||
|      | ||||
|     Version 2.0 | ||||
|      | ||||
|     The primary goals of this format is to allow a simple XML format  | ||||
|     that is mostly human readable. The generation and parsing of the  | ||||
|     various data types are done through the TypeConverter classes  | ||||
|     associated with the data types. | ||||
|      | ||||
|     Example: | ||||
|      | ||||
|     ... ado.net/XML headers & schema ... | ||||
|     <resheader name="resmimetype">text/microsoft-resx</resheader> | ||||
|     <resheader name="version">2.0</resheader> | ||||
|     <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> | ||||
|     <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> | ||||
|     <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> | ||||
|     <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> | ||||
|     <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> | ||||
|         <value>[base64 mime encoded serialized .NET Framework object]</value> | ||||
|     </data> | ||||
|     <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | ||||
|         <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> | ||||
|         <comment>This is a comment</comment> | ||||
|     </data> | ||||
|                  | ||||
|     There are any number of "resheader" rows that contain simple  | ||||
|     name/value pairs. | ||||
|      | ||||
|     Each data row contains a name, and value. The row also contains a  | ||||
|     type or mimetype. Type corresponds to a .NET class that support  | ||||
|     text/value conversion through the TypeConverter architecture.  | ||||
|     Classes that don't support this are serialized and stored with the  | ||||
|     mimetype set. | ||||
|      | ||||
|     The mimetype is used for serialized objects, and tells the  | ||||
|     ResXResourceReader how to depersist the object. This is currently not  | ||||
|     extensible. For a given mimetype the value must be set accordingly: | ||||
|      | ||||
|     Note - application/x-microsoft.net.object.binary.base64 is the format  | ||||
|     that the ResXResourceWriter will generate, however the reader can  | ||||
|     read any of the formats listed below. | ||||
|      | ||||
|     mimetype: application/x-microsoft.net.object.binary.base64 | ||||
|     value   : The object must be serialized with  | ||||
|             : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter | ||||
|             : and then encoded with base64 encoding. | ||||
|      | ||||
|     mimetype: application/x-microsoft.net.object.soap.base64 | ||||
|     value   : The object must be serialized with  | ||||
|             : System.Runtime.Serialization.Formatters.Soap.SoapFormatter | ||||
|             : and then encoded with base64 encoding. | ||||
|  | ||||
|     mimetype: application/x-microsoft.net.object.bytearray.base64 | ||||
|     value   : The object must be serialized into a byte array  | ||||
|             : using a System.ComponentModel.TypeConverter | ||||
|             : and then encoded with base64 encoding. | ||||
|     --> | ||||
|   <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> | ||||
|     <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> | ||||
|     <xsd:element name="root" msdata:IsDataSet="true"> | ||||
|       <xsd:complexType> | ||||
|         <xsd:choice maxOccurs="unbounded"> | ||||
|           <xsd:element name="metadata"> | ||||
|             <xsd:complexType> | ||||
|               <xsd:sequence> | ||||
|                 <xsd:element name="value" type="xsd:string" minOccurs="0" /> | ||||
|               </xsd:sequence> | ||||
|               <xsd:attribute name="name" use="required" type="xsd:string" /> | ||||
|               <xsd:attribute name="type" type="xsd:string" /> | ||||
|               <xsd:attribute name="mimetype" type="xsd:string" /> | ||||
|               <xsd:attribute ref="xml:space" /> | ||||
|             </xsd:complexType> | ||||
|           </xsd:element> | ||||
|           <xsd:element name="assembly"> | ||||
|             <xsd:complexType> | ||||
|               <xsd:attribute name="alias" type="xsd:string" /> | ||||
|               <xsd:attribute name="name" type="xsd:string" /> | ||||
|             </xsd:complexType> | ||||
|           </xsd:element> | ||||
|           <xsd:element name="data"> | ||||
|             <xsd:complexType> | ||||
|               <xsd:sequence> | ||||
|                 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | ||||
|                 <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> | ||||
|               </xsd:sequence> | ||||
|               <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> | ||||
|               <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> | ||||
|               <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> | ||||
|               <xsd:attribute ref="xml:space" /> | ||||
|             </xsd:complexType> | ||||
|           </xsd:element> | ||||
|           <xsd:element name="resheader"> | ||||
|             <xsd:complexType> | ||||
|               <xsd:sequence> | ||||
|                 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | ||||
|               </xsd:sequence> | ||||
|               <xsd:attribute name="name" type="xsd:string" use="required" /> | ||||
|             </xsd:complexType> | ||||
|           </xsd:element> | ||||
|         </xsd:choice> | ||||
|       </xsd:complexType> | ||||
|     </xsd:element> | ||||
|   </xsd:schema> | ||||
|   <resheader name="resmimetype"> | ||||
|     <value>text/microsoft-resx</value> | ||||
|   </resheader> | ||||
|   <resheader name="version"> | ||||
|     <value>2.0</value> | ||||
|   </resheader> | ||||
|   <resheader name="reader"> | ||||
|     <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||||
|   </resheader> | ||||
|   <resheader name="writer"> | ||||
|     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||||
|   </resheader> | ||||
|   <data name="AddFreeDbContextError_CheckConstruction" xml:space="preserve"> | ||||
|     <value>AddFreeDbContext 发生错误,请检查 {dbContextTypeName} 的构造参数都已正确注入</value> | ||||
|   </data> | ||||
|   <data name="CannotAdd_AlreadyExistsInStateManagement" xml:space="preserve"> | ||||
|     <value>不可添加,已存在于状态管理:{entityString}</value> | ||||
|   </data> | ||||
|   <data name="CannotAdd_EntityHasNo_PrimaryKey" xml:space="preserve"> | ||||
|     <value>不可添加,实体没有主键:{entityString}</value> | ||||
|   </data> | ||||
|   <data name="CannotAdd_PrimaryKey_NotSet" xml:space="preserve"> | ||||
|     <value>不可添加,未设置主键的值:{entityString}</value> | ||||
|   </data> | ||||
|   <data name="CannotAdd_SelfIncreasingHasValue" xml:space="preserve"> | ||||
|     <value>不可添加,自增属性有值:{entityString}</value> | ||||
|   </data> | ||||
|   <data name="CannotAttach_EntityHasNo_PrimaryKey" xml:space="preserve"> | ||||
|     <value>不可附加,实体没有主键:{entityString}</value> | ||||
|   </data> | ||||
|   <data name="CannotAttach_PrimaryKey_NotSet" xml:space="preserve"> | ||||
|     <value>不可附加,未设置主键的值:{entityString}</value> | ||||
|   </data> | ||||
|   <data name="CannotDelete_DataNotTracked_ShouldQuery" xml:space="preserve"> | ||||
|     <value>不可删除,数据未被跟踪,应该先查询:{entityString}</value> | ||||
|   </data> | ||||
|   <data name="CannotDelete_EntityHasNo_PrimaryKey" xml:space="preserve"> | ||||
|     <value>不可删除,实体没有主键:{entityString}</value> | ||||
|   </data> | ||||
|   <data name="CannotDelete_PrimaryKey_NotSet" xml:space="preserve"> | ||||
|     <value>不可删除,未设置主键的值:{entityString}</value> | ||||
|   </data> | ||||
|   <data name="CannotEdit_EntityHasNo_PrimaryKey" xml:space="preserve"> | ||||
|     <value>不可进行编辑,实体没有主键:{entityString}</value> | ||||
|   </data> | ||||
|   <data name="CannotUpdate_DataShouldQueryOrAttach" xml:space="preserve"> | ||||
|     <value>不可更新,数据未被跟踪,应该先查询 或者 Attach:{entityString}</value> | ||||
|   </data> | ||||
|   <data name="CannotUpdate_EntityHasNo_PrimaryKey" xml:space="preserve"> | ||||
|     <value>不可更新,实体没有主键:{entityString}</value> | ||||
|   </data> | ||||
|   <data name="CannotUpdate_PrimaryKey_NotSet" xml:space="preserve"> | ||||
|     <value>不可更新,未设置主键的值:{entityString}</value> | ||||
|   </data> | ||||
|   <data name="CannotUpdate_RecordDoesNotExist" xml:space="preserve"> | ||||
|     <value>不可更新,数据库不存在该记录:{entityString}</value> | ||||
|   </data> | ||||
|   <data name="ConfigureUseFreeSql" xml:space="preserve"> | ||||
|     <value>请在 OnConfiguring 或 AddFreeDbContext 中配置 UseFreeSql</value> | ||||
|   </data> | ||||
|   <data name="DbSetAsType_NotSupport_Object" xml:space="preserve"> | ||||
|     <value>DbSet.AsType 参数错误,请传入正确的实体类型</value> | ||||
|   </data> | ||||
|   <data name="EntityType_CannotConvert" xml:space="preserve"> | ||||
|     <value>实体类型 {EntityTypeName} 无法转换为 {name},无法使用该方法</value> | ||||
|   </data> | ||||
|   <data name="EntityType_PrimaryKeyError" xml:space="preserve"> | ||||
|     <value>实体类型 {EntityTypeName} 主键类型不为 {fullName},无法使用该方法</value> | ||||
|   </data> | ||||
|   <data name="EntityType_PrimaryKeyIsNotOne" xml:space="preserve"> | ||||
|     <value>实体类型 {EntityTypeName} 主键数量不为 1,无法使用该方法</value> | ||||
|   </data> | ||||
|   <data name="FailedSetFilter_NotBelongIRpository" xml:space="preserve"> | ||||
|     <value>FreeSql.Repository 设置过滤器失败,原因是对象不属于 IRepository</value> | ||||
|   </data> | ||||
|   <data name="Incomparable_EntityHasNo_PrimaryKey" xml:space="preserve"> | ||||
|     <value>不可比较,实体没有主键:{entityString}</value> | ||||
|   </data> | ||||
|   <data name="Incomparable_PrimaryKey_NotSet" xml:space="preserve"> | ||||
|     <value>不可比较,未设置主键的值:{entityString}</value> | ||||
|   </data> | ||||
|   <data name="InsertError_Filter" xml:space="preserve"> | ||||
|     <value>FreeSql.Repository Insert 失败,因为设置了过滤器 {filterKey}: {filterValueExpression},插入的数据不符合 {entityString}</value> | ||||
|   </data> | ||||
|   <data name="ISelectAsType_ParameterError" xml:space="preserve"> | ||||
|     <value>ISelect.AsType 参数不支持指定为 object</value> | ||||
|   </data> | ||||
|   <data name="NotFound_Property" xml:space="preserve"> | ||||
|     <value>{tableTypeFullName} 不存在属性 {propertyName}</value> | ||||
|   </data> | ||||
|   <data name="NotFoundMethod_StatesRemoveByObjects" xml:space="preserve"> | ||||
|     <value>找不到方法 DbSet<>.StatesRemoveByObjects</value> | ||||
|   </data> | ||||
|   <data name="ParameterDataTypeError" xml:space="preserve"> | ||||
|     <value>参数 data 类型错误 {entityTypeFullName} </value> | ||||
|   </data> | ||||
|   <data name="ParameterError" xml:space="preserve"> | ||||
|     <value>参数错误 {param}</value> | ||||
|   </data> | ||||
|   <data name="ParameterError_CannotBeNull" xml:space="preserve"> | ||||
|     <value>参数错误 {param} 不能为 null</value> | ||||
|   </data> | ||||
|   <data name="ParameterError_IsNot_CollectionProperties" xml:space="preserve"> | ||||
|     <value>参数错误 {many} 不是集合属性</value> | ||||
|   </data> | ||||
|   <data name="ParameterError_NotFound_CollectionProperties" xml:space="preserve"> | ||||
|     <value>参数错误 {many} 集合属性不存在</value> | ||||
|   </data> | ||||
|   <data name="ParameterError_NotFound_Property" xml:space="preserve"> | ||||
|     <value>参数错误 {one} 属性不存在</value> | ||||
|   </data> | ||||
|   <data name="Propagation_Mandatory" xml:space="preserve"> | ||||
|     <value>Propagation_Mandatory: 使用当前事务,如果没有当前事务,就抛出异常</value> | ||||
|   </data> | ||||
|   <data name="Propagation_Never" xml:space="preserve"> | ||||
|     <value>Propagation_Never: 以非事务方式执行操作,如果当前事务存在则抛出异常</value> | ||||
|   </data> | ||||
|   <data name="PropertyOfType_IsNot_OneToManyOrManyToMany" xml:space="preserve"> | ||||
|     <value>{tableTypeFullName} 类型的属性 {propertyName} 不是 OneToMany 或 ManyToMany 特性</value> | ||||
|   </data> | ||||
|   <data name="SpecialError_BatchAdditionFailed" xml:space="preserve"> | ||||
|     <value>特别错误:批量添加失败,{dataType} 的返回数据,与添加的数目不匹配</value> | ||||
|   </data> | ||||
|   <data name="SpecialError_UpdateFailedDataNotTracked" xml:space="preserve"> | ||||
|     <value>特别错误:更新失败,数据未被跟踪:{entityString}</value> | ||||
|   </data> | ||||
|   <data name="TransactionHasBeenStarted" xml:space="preserve"> | ||||
|     <value>已开启事务,不能禁用工作单元</value> | ||||
|   </data> | ||||
|   <data name="TypeHasSetProperty_IgnoreAttribute" xml:space="preserve"> | ||||
|     <value>{tableTypeFullName} 类型已设置属性 {propertyName} 忽略特性</value> | ||||
|   </data> | ||||
|   <data name="UnitOfWorkManager_Construction_CannotBeNull" xml:space="preserve"> | ||||
|     <value>{unitOfWorkManager} 构造参数 {fsql} 不能为 null</value> | ||||
|   </data> | ||||
|   <data name="UpdateError_Filter" xml:space="preserve"> | ||||
|     <value>FreeSql.Repository Update 失败,因为设置了过滤器 {filterKey}: {filterValueExpression},更新的数据不符合{entityString}</value> | ||||
|   </data> | ||||
| </root> | ||||
| @@ -36,7 +36,7 @@ namespace FreeSql | ||||
|                 if (entitys != null) | ||||
|                     foreach (var entity in entitys) | ||||
|                         if (filter.Value.ExpressionDelegate?.Invoke(entity) == false) | ||||
|                             throw new Exception($"FreeSql.Repository Update 失败,因为设置了过滤器 {filter.Key}: {filter.Value.Expression},更新的数据不符合 {_db.OrmOriginal.GetEntityString(_entityType, entity)}"); | ||||
|                             throw new Exception(DbContextStrings.UpdateError_Filter(filter.Key, filter.Value.Expression, _db.OrmOriginal.GetEntityString(_entityType, entity))); | ||||
|                 update.Where(filter.Value.Expression); | ||||
|             } | ||||
|             var disableFilter = filters.Where(a => a.Value.IsEnabled == false).Select(a => a.Key).ToArray(); | ||||
| @@ -64,7 +64,7 @@ namespace FreeSql | ||||
|                 if (entitys != null) | ||||
|                     foreach (var entity in entitys) | ||||
|                         if (filter.Value.ExpressionDelegate?.Invoke(entity) == false) | ||||
|                             throw new Exception($"FreeSql.Repository Insert 失败,因为设置了过滤器 {filter.Key}: {filter.Value.Expression},插入的数据不符合 {_db.OrmOriginal.GetEntityString(_entityType, entity)}"); | ||||
|                             throw new Exception(DbContextStrings.InsertError_Filter(filter.Key, filter.Value.Expression, _db.OrmOriginal.GetEntityString(_entityType, entity))); | ||||
|             } | ||||
|             return insert; | ||||
|         } | ||||
|   | ||||
| @@ -32,7 +32,7 @@ namespace FreeSql | ||||
|  | ||||
|                 var type = repos.GetType(); | ||||
|                 Type entityType = (repos as IBaseRepository).EntityType; | ||||
|                 if (entityType == null) throw new Exception("FreeSql.Repository 设置过滤器失败,原因是对象不属于 IRepository"); | ||||
|                 if (entityType == null) throw new Exception(DbContextStrings.FailedSetFilter_NotBelongIRpository); | ||||
|  | ||||
|                 var notExists = _dicSetRepositoryDataFilterConvertFilterNotExists.GetOrAdd(type, t => new ConcurrentDictionary<string, bool>()); | ||||
|                 var newFilter = new Dictionary<string, LambdaExpression>(); | ||||
|   | ||||
| @@ -186,12 +186,12 @@ namespace FreeSql | ||||
|         TEntity CheckTKeyAndReturnIdEntity(TKey id) | ||||
|         { | ||||
|             var tb = _db.OrmOriginal.CodeFirst.GetTableByEntity(EntityType); | ||||
|             if (tb.Primarys.Length != 1) throw new Exception($"实体类型 {EntityType.Name} 主键数量不为 1,无法使用该方法"); | ||||
|             if (tb.Primarys[0].CsType.NullableTypeOrThis() != typeof(TKey).NullableTypeOrThis()) throw new Exception($"实体类型 {EntityType.Name} 主键类型不为 {typeof(TKey).FullName},无法使用该方法"); | ||||
|             if (tb.Primarys.Length != 1) throw new Exception(DbContextStrings.EntityType_PrimaryKeyIsNotOne(EntityType.Name)); | ||||
|             if (tb.Primarys[0].CsType.NullableTypeOrThis() != typeof(TKey).NullableTypeOrThis()) throw new Exception(DbContextStrings.EntityType_PrimaryKeyError(EntityType.Name, typeof(TKey).FullName)); | ||||
|             var obj = Activator.CreateInstance(tb.Type); | ||||
|             _db.OrmOriginal.SetEntityValueWithPropertyName(tb.Type, obj, tb.Primarys[0].CsName, id); | ||||
|             var  ret = obj as TEntity; | ||||
|             if (ret == null) throw new Exception($"实体类型 {EntityType.Name} 无法转换为 {typeof(TEntity).Name},无法使用该方法"); | ||||
|             var ret = obj as TEntity; | ||||
|             if (ret == null) throw new Exception(DbContextStrings.EntityType_CannotConvert(EntityType.Name, typeof(TEntity).Name)); | ||||
|             return ret; | ||||
|         } | ||||
|  | ||||
|   | ||||
| @@ -55,7 +55,7 @@ namespace FreeSql | ||||
|         public void Close() | ||||
|         { | ||||
|             if (_tran != null) | ||||
|                 throw new Exception("已开启事务,不能禁用工作单元"); | ||||
|                 throw new Exception(DbContextStrings.TransactionHasBeenStarted); | ||||
|  | ||||
|             Enable = false; | ||||
|         } | ||||
|   | ||||
| @@ -22,7 +22,7 @@ namespace FreeSql | ||||
|  | ||||
|         public UnitOfWorkManager(IFreeSql fsql) | ||||
|         { | ||||
|             if (fsql == null) throw new ArgumentNullException($"{nameof(UnitOfWorkManager)} 构造参数 {nameof(fsql)} 不能为 null"); | ||||
|             if (fsql == null) throw new ArgumentNullException(DbContextStrings.UnitOfWorkManager_Construction_CannotBeNull(nameof(UnitOfWorkManager), nameof(fsql))); | ||||
|             _ormScoped = DbContextScopedFreeSql.Create(fsql, null, () => this.Current); | ||||
|         } | ||||
|  | ||||
| @@ -92,7 +92,7 @@ namespace FreeSql | ||||
|             { | ||||
|                 case Propagation.Required: return FindedUowCreateVirtual() ?? CreateUow(isolationLevel); | ||||
|                 case Propagation.Supports: return FindedUowCreateVirtual() ?? CreateUowNothing(_allUows.LastOrDefault()?.IsNotSupported ?? false); | ||||
|                 case Propagation.Mandatory: return FindedUowCreateVirtual() ?? throw new Exception("Propagation_Mandatory: 使用当前事务,如果没有当前事务,就抛出异常"); | ||||
|                 case Propagation.Mandatory: return FindedUowCreateVirtual() ?? throw new Exception(DbContextStrings.Propagation_Mandatory); | ||||
|                 case Propagation.NotSupported: return CreateUowNothing(true); | ||||
|                 case Propagation.Never: | ||||
|                     var isNotSupported = _allUows.LastOrDefault()?.IsNotSupported ?? false; | ||||
| @@ -100,7 +100,7 @@ namespace FreeSql | ||||
|                     { | ||||
|                         for (var a = _rawUows.Count - 1; a >= 0; a--) | ||||
|                             if (_rawUows[a].Uow.GetOrBeginTransaction(false) != null) | ||||
|                                 throw new Exception("Propagation_Never: 以非事务方式执行操作,如果当前事务存在则抛出异常"); | ||||
|                                 throw new Exception(DbContextStrings.Propagation_Never); | ||||
|                     } | ||||
|                     return CreateUowNothing(isNotSupported); | ||||
|                 case Propagation.Nested: return CreateUow(isolationLevel); | ||||
| @@ -159,7 +159,7 @@ namespace FreeSql | ||||
|         { | ||||
|             public IBaseRepository Repository; | ||||
|             public IUnitOfWork OrginalUow; | ||||
|              | ||||
|  | ||||
|             public RepoInfo(IBaseRepository repository) | ||||
|             { | ||||
|                 this.Repository = repository; | ||||
|   | ||||
							
								
								
									
										657
									
								
								FreeSql.Tests/FreeSql.Tests/Properties/CoreStringsTests.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										657
									
								
								FreeSql.Tests/FreeSql.Tests/Properties/CoreStringsTests.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,657 @@ | ||||
| using System.Threading; | ||||
|  | ||||
| using Xunit; | ||||
| using Xunit.Abstractions; | ||||
|  | ||||
| namespace FreeSql.Tests.Properties | ||||
| { | ||||
|     public class CoreStringsTests | ||||
|     { | ||||
|         private readonly ITestOutputHelper output; | ||||
|         public CoreStringsTests(ITestOutputHelper output) | ||||
|         { | ||||
|             this.output = output; | ||||
|             Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US"); | ||||
|             Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US"); | ||||
|         } | ||||
|         [Fact] | ||||
|         public void AsTable_PropertyName_NotDateTimeTest() | ||||
|         { | ||||
|             string text = CoreStrings.AsTable_PropertyName_NotDateTime("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void AsTable_PropertyName_FormatErrorTest() | ||||
|         { | ||||
|             string text = CoreStrings.AsTable_PropertyName_FormatError("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|  | ||||
|         [Fact] | ||||
|         public void Available_Failed_Get_ResourceTest() | ||||
|         { | ||||
|             string text = CoreStrings.Available_Failed_Get_Resource("1", "2 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Available_Thrown_ExceptionTest() | ||||
|         { | ||||
|             string text = CoreStrings.Available_Thrown_Exception("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Bad_Expression_FormatTest() | ||||
|         { | ||||
|             string text = CoreStrings.Bad_Expression_Format("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Cannot_Be_NULL_NameTest() | ||||
|         { | ||||
|             string text = CoreStrings.Cannot_Be_NULL_Name("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Cannot_Match_PropertyTest() | ||||
|         { | ||||
|             string text = CoreStrings.Cannot_Match_Property("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Cannot_Resolve_ExpressionTreeTest() | ||||
|         { | ||||
|             string text = CoreStrings.Cannot_Resolve_ExpressionTree("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Custom_Expression_ParsingErrorTest() | ||||
|         { | ||||
|             string text = CoreStrings.Custom_Expression_ParsingError("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Custom_StaticMethodName_NotSet_DynamicFilterCustomTest() | ||||
|         { | ||||
|             string text = CoreStrings.Custom_StaticMethodName_NotSet_DynamicFilterCustom("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void DataType_AsType_InconsistentTest() | ||||
|         { | ||||
|             string text = CoreStrings.DataType_AsType_Inconsistent("1", "2 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void DbUpdateVersionException_RowLevelOptimisticLockTest() | ||||
|         { | ||||
|             string text = CoreStrings.DbUpdateVersionException_RowLevelOptimisticLock("1", "2 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Duplicate_ColumnAttributeTest() | ||||
|         { | ||||
|             string text = CoreStrings.Duplicate_ColumnAttribute("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Duplicate_PropertyNameTest() | ||||
|         { | ||||
|             string text = CoreStrings.Duplicate_PropertyName("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Entity_Must_Primary_KeyTest() | ||||
|         { | ||||
|             string text = CoreStrings.Entity_Must_Primary_Key("1", "2 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Entity_MySQL_VersionsBelow8_NotSupport_Multiple_PrimaryKeysTest() | ||||
|         { | ||||
|             string text = CoreStrings.Entity_MySQL_VersionsBelow8_NotSupport_Multiple_PrimaryKeys("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Entity_NotParentChild_RelationshipTest() | ||||
|         { | ||||
|             string text = CoreStrings.Entity_NotParentChild_Relationship("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Expression_Error_Use_ParameterExpressionTest() | ||||
|         { | ||||
|             string text = CoreStrings.Expression_Error_Use_ParameterExpression("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Expression_Error_Use_Successive_MemberAccess_TypeTest() | ||||
|         { | ||||
|             string text = CoreStrings.Expression_Error_Use_Successive_MemberAccess_Type("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void ExpressionTree_Convert_Type_ErrorTest() | ||||
|         { | ||||
|             string text = CoreStrings.ExpressionTree_Convert_Type_Error("1", "2", "3", "4 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Failed_SubTable_FieldValueTest() | ||||
|         { | ||||
|             string text = CoreStrings.Failed_SubTable_FieldValue("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Functions_AsTable_NotImplementedTest() | ||||
|         { | ||||
|             string text = CoreStrings.Functions_AsTable_NotImplemented("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Generated_Same_SubTableTest() | ||||
|         { | ||||
|             string text = CoreStrings.Generated_Same_SubTable("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void GetPrimarys_ParameterError_IsNotDictKeyTest() | ||||
|         { | ||||
|             string text = CoreStrings.GetPrimarys_ParameterError_IsNotDictKey("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Has_Specified_Cannot_Specified_SecondTest() | ||||
|         { | ||||
|             string text = CoreStrings.Has_Specified_Cannot_Specified_Second("1", "2 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Ignored_Check_Confirm_PublicGetSetTest() | ||||
|         { | ||||
|             string text = CoreStrings.Ignored_Check_Confirm_PublicGetSet("1", "2 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void IncludeMany_NotValid_NavigationTest() | ||||
|         { | ||||
|             string text = CoreStrings.IncludeMany_NotValid_Navigation("1", "2 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void IncludeMany_ParameterError_OnlyUseOneParameterTest() | ||||
|         { | ||||
|             string text = CoreStrings.IncludeMany_ParameterError_OnlyUseOneParameter("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void IncludeMany_ParameterError_Select_ReturnConsistentTypeTest() | ||||
|         { | ||||
|             string text = CoreStrings.IncludeMany_ParameterError_Select_ReturnConsistentType("1", "2 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void IncludeMany_ParameterTypeErrorTest() | ||||
|         { | ||||
|             string text = CoreStrings.IncludeMany_ParameterTypeError("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void InsertInto_No_Property_SelectedTest() | ||||
|         { | ||||
|             string text = CoreStrings.InsertInto_No_Property_Selected("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void InsertInto_TypeErrorTest() | ||||
|         { | ||||
|             string text = CoreStrings.InsertInto_TypeError("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void InsertOrUpdate_Must_Primary_KeyTest() | ||||
|         { | ||||
|             string text = CoreStrings.InsertOrUpdate_Must_Primary_Key("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void InsertOrUpdate_NotSuport_Generic_UseEntityTest() | ||||
|         { | ||||
|             string text = CoreStrings.InsertOrUpdate_NotSuport_Generic_UseEntity("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void LazyLoading_CompilationErrorTest() | ||||
|         { | ||||
|             string text = CoreStrings.LazyLoading_CompilationError("1", "2", "2 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void LazyLoading_EntityMustDeclarePublicTest() | ||||
|         { | ||||
|             string text = CoreStrings.LazyLoading_EntityMustDeclarePublic("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void ManyToMany_NotFound_CorrespondingFieldTest() | ||||
|         { | ||||
|             string text = CoreStrings.ManyToMany_NotFound_CorrespondingField("1", "2", "2", "2", "2 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void ManyToMany_ParsingError_EntityMissing_PrimaryKeyTest() | ||||
|         { | ||||
|             string text = CoreStrings.ManyToMany_ParsingError_EntityMissing_PrimaryKey("1", "2", "2 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void ManyToMany_ParsingError_EntityMustHas_NavigateCollectionTest() | ||||
|         { | ||||
|             string text = CoreStrings.ManyToMany_ParsingError_EntityMustHas_NavigateCollection("1", "2", "2 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void ManyToMany_ParsingError_InconsistentTypeTest() | ||||
|         { | ||||
|             string text = CoreStrings.ManyToMany_ParsingError_InconsistentType("1", "2", "2", "2", "2", "2 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void ManyToMany_ParsingError_IntermediateClass_ErrorMessageTest() | ||||
|         { | ||||
|             string text = CoreStrings.ManyToMany_ParsingError_IntermediateClass_ErrorMessage("1", "2", "2", "2", "2 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void ManyToMany_ParsingError_IntermediateClass_NotManyToOne_OneToOneTest() | ||||
|         { | ||||
|             string text = CoreStrings.ManyToMany_ParsingError_IntermediateClass_NotManyToOne_OneToOne("1", "2", "2", "2 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Mapping_Exception_HasNo_SamePropertyNameTest() | ||||
|         { | ||||
|             string text = CoreStrings.Mapping_Exception_HasNo_SamePropertyName("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Missing_FreeSqlProvider_PackageTest() | ||||
|         { | ||||
|             string text = CoreStrings.Missing_FreeSqlProvider_Package("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Missing_FreeSqlProvider_Package_ReasonTest() | ||||
|         { | ||||
|             string text = CoreStrings.Missing_FreeSqlProvider_Package_Reason("1", "2 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Navigation_Bind_Number_DifferentTest() | ||||
|         { | ||||
|             string text = CoreStrings.Navigation_Bind_Number_Different("1", "2", "2", "2 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Navigation_Missing_AsSelectTest() | ||||
|         { | ||||
|             string text = CoreStrings.Navigation_Missing_AsSelect("1", "2 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Navigation_Missing_SetPropertyTest() | ||||
|         { | ||||
|             string text = CoreStrings.Navigation_Missing_SetProperty("1", "2 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Navigation_NotFound_CorrespondingFieldTest() | ||||
|         { | ||||
|             string text = CoreStrings.Navigation_NotFound_CorrespondingField("1", "2", "2 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Navigation_ParsingError_EntityMissingPrimaryKeyTest() | ||||
|         { | ||||
|             string text = CoreStrings.Navigation_ParsingError_EntityMissingPrimaryKey("1", "2", "2 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Navigation_ParsingError_InconsistentTypeTest() | ||||
|         { | ||||
|             string text = CoreStrings.Navigation_ParsingError_InconsistentType("1", "2", "2", "2", "2", "2 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Navigation_ParsingError_NotFound_PropertyTest() | ||||
|         { | ||||
|             string text = CoreStrings.Navigation_ParsingError_NotFound_Property("1", "2", "2", "2 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void NoPrimaryKey_UseSetDtoTest() | ||||
|         { | ||||
|             string text = CoreStrings.NoPrimaryKey_UseSetDto("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Not_Implemented_ExpressionTest() | ||||
|         { | ||||
|             string text = CoreStrings.Not_Implemented_Expression("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Not_Implemented_Expression_ParameterUseConstantTest() | ||||
|         { | ||||
|             string text = CoreStrings.Not_Implemented_Expression_ParameterUseConstant("1", "2 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Not_Implemented_Expression_UseAsSelectTest() | ||||
|         { | ||||
|             string text = CoreStrings.Not_Implemented_Expression_UseAsSelect("1", "2", "2 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Not_Implemented_NameTest() | ||||
|         { | ||||
|             string text = CoreStrings.Not_Implemented_Name("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Not_Support_OrderByRandomTest() | ||||
|         { | ||||
|             string text = CoreStrings.Not_Support_OrderByRandom("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Not_Valid_Navigation_PropertyTest() | ||||
|         { | ||||
|             string text = CoreStrings.Not_Valid_Navigation_Property("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void NotFound_ColumnTest() | ||||
|         { | ||||
|             string text = CoreStrings.NotFound_Column("1", "2 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void NotFound_CsName_ColumnTest() | ||||
|         { | ||||
|             string text = CoreStrings.NotFound_Column("1", "2 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void NotFound_PropertyTest() | ||||
|         { | ||||
|             string text = CoreStrings.NotFound_Property("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void NotFound_PropertyNameTest() | ||||
|         { | ||||
|             string text = CoreStrings.NotFound_PropertyName("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void NotFound_ReflectionTest() | ||||
|         { | ||||
|             string text = CoreStrings.NotFound_Reflection("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void NotFound_Static_MethodNameTest() | ||||
|         { | ||||
|             string text = CoreStrings.NotFound_Static_MethodName("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void NotFound_Table_Property_AsTableTest() | ||||
|         { | ||||
|             string text = CoreStrings.NotFound_Table_Property_AsTable("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void ObjectPool_Get_TimeoutTest() | ||||
|         { | ||||
|             string text = CoreStrings.ObjectPool_Get_Timeout("1", "2", "3"); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void ObjectPool_GetAsync_Queue_LongTest() | ||||
|         { | ||||
|             string text = CoreStrings.ObjectPool_GetAsync_Queue_Long("1", "2 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void OneToMany_NotFound_CorrespondingFieldTest() | ||||
|         { | ||||
|             string text = CoreStrings.OneToMany_NotFound_CorrespondingField("1", "2", "2", "2", "2 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void OneToMany_ParsingError_InconsistentTypeTest() | ||||
|         { | ||||
|             string text = CoreStrings.OneToMany_ParsingError_InconsistentType("1", "2", "2", "2", "2", "2 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void OneToMany_UseNavigateTest() | ||||
|         { | ||||
|             string text = CoreStrings.OneToMany_UseNavigate("1", "2 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void ParameterError_NotValid_CollectionTest() | ||||
|         { | ||||
|             string text = CoreStrings.ParameterError_NotValid_Collection("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void ParameterError_NotValid_NavigationTest() | ||||
|         { | ||||
|             string text = CoreStrings.ParameterError_NotValid_Navigation("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void ParameterError_NotValid_PropertyNameTest() | ||||
|         { | ||||
|             string text = CoreStrings.ParameterError_NotValid_PropertyName("1", "2", "2 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void ParameterError_NotValid_UseCommasTest() | ||||
|         { | ||||
|             string text = CoreStrings.ParameterError_NotValid_UseCommas("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Parsing_FailedTest() | ||||
|         { | ||||
|             string text = CoreStrings.Parsing_Failed("1", "2 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Policy_ObjectPool_DisposeTest() | ||||
|         { | ||||
|             string text = CoreStrings.Policy_ObjectPool_Dispose("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Policy_Status_NotAvailableTest() | ||||
|         { | ||||
|             string text = CoreStrings.Policy_Status_NotAvailable("1", "2 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Properties_AsRowLock_Must_Numeric_ByteTest() | ||||
|         { | ||||
|             string text = CoreStrings.Properties_AsRowLock_Must_Numeric_Byte("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Property_Cannot_FindTest() | ||||
|         { | ||||
|             string text = CoreStrings.Property_Cannot_Find("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Set_Column_IsNullable_FalseTest() | ||||
|         { | ||||
|             string text = CoreStrings.Set_Column_IsNullable_False("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void SubTableFieldValue_CannotLessThenTest() | ||||
|         { | ||||
|             string text = CoreStrings.SubTableFieldValue_CannotLessThen("1", "2 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void SubTableFieldValue_NotConvertDateTimeTest() | ||||
|         { | ||||
|             string text = CoreStrings.SubTableFieldValue_NotConvertDateTime("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void SubTableFieldValue_NotMatchTableTest() | ||||
|         { | ||||
|             string text = CoreStrings.SubTableFieldValue_NotConvertDateTime("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|  | ||||
|         [Fact] | ||||
|         public void Type_AsType_Parameter_ErrorTest() | ||||
|         { | ||||
|             string text = CoreStrings.Type_AsType_Parameter_Error("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Type_Cannot_Access_ConstructorTest() | ||||
|         { | ||||
|             string text = CoreStrings.Type_Cannot_Access_Constructor("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Type_Error_NameTest() | ||||
|         { | ||||
|             string text = CoreStrings.Type_Error_Name("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void TypeAsType_NotSupport_ObjectTest() | ||||
|         { | ||||
|             string text = CoreStrings.TypeAsType_NotSupport_Object("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void TypeError_CannotUse_IncludeManyTest() | ||||
|         { | ||||
|             string text = CoreStrings.TypeError_CannotUse_IncludeMany("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Unable_Parse_ExpressionTest() | ||||
|         { | ||||
|             string text = CoreStrings.Unable_Parse_Expression("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Unable_Parse_ExpressionMethodTest() | ||||
|         { | ||||
|             string text = CoreStrings.Unable_Parse_ExpressionMethod("1 "); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|     } | ||||
| } | ||||
							
								
								
									
										260
									
								
								FreeSql.Tests/FreeSql.Tests/Properties/DbContextStringsTests.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										260
									
								
								FreeSql.Tests/FreeSql.Tests/Properties/DbContextStringsTests.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,260 @@ | ||||
| using Xunit; | ||||
| using Xunit.Abstractions; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Linq; | ||||
| using System.Text; | ||||
| using System.Threading.Tasks; | ||||
| using System.Threading; | ||||
|  | ||||
| namespace FreeSql.Tests.Properties | ||||
| { | ||||
|     public class DbContextStringsTests | ||||
|     { | ||||
|         private readonly ITestOutputHelper output; | ||||
|         public DbContextStringsTests(ITestOutputHelper output) | ||||
|         { | ||||
|             this.output = output; | ||||
|             Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US"); | ||||
|             Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US"); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void AddFreeDbContextError_CheckConstructionTest() | ||||
|         { | ||||
|             string text = DbContextStrings.AddFreeDbContextError_CheckConstruction("1"); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void CannotAdd_AlreadyExistsInStateManagementTest() | ||||
|         { | ||||
|             string text = DbContextStrings.CannotAdd_AlreadyExistsInStateManagement("1"); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void CannotAdd_EntityHasNo_PrimaryKeyTest() | ||||
|         { | ||||
|             string text = DbContextStrings.CannotAdd_EntityHasNo_PrimaryKey("1"); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void CannotAdd_PrimaryKey_NotSetTest() | ||||
|         { | ||||
|             string text = DbContextStrings.CannotAdd_PrimaryKey_NotSet("1"); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void CannotAdd_SelfIncreasingHasValueTest() | ||||
|         { | ||||
|             string text = DbContextStrings.CannotAdd_SelfIncreasingHasValue("1"); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void CannotAttach_EntityHasNo_PrimaryKeyTest() | ||||
|         { | ||||
|             string text = DbContextStrings.CannotAttach_EntityHasNo_PrimaryKey("1"); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void CannotAttach_PrimaryKey_NotSetTest() | ||||
|         { | ||||
|             string text = DbContextStrings.CannotAttach_PrimaryKey_NotSet("1"); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void CannotDelete_DataNotTracked_ShouldQueryTest() | ||||
|         { | ||||
|             string text = DbContextStrings.CannotDelete_DataNotTracked_ShouldQuery("1"); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void CannotDelete_EntityHasNo_PrimaryKeyTest() | ||||
|         { | ||||
|             string text = DbContextStrings.CannotDelete_EntityHasNo_PrimaryKey("1"); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void CannotDelete_PrimaryKey_NotSetTest() | ||||
|         { | ||||
|             string text = DbContextStrings.CannotDelete_PrimaryKey_NotSet("1"); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void CannotEdit_EntityHasNo_PrimaryKeyTest() | ||||
|         { | ||||
|             string text = DbContextStrings.CannotEdit_EntityHasNo_PrimaryKey("1"); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void CannotUpdate_DataShouldQueryOrAttachTest() | ||||
|         { | ||||
|             string text = DbContextStrings.CannotUpdate_DataShouldQueryOrAttach("1"); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void CannotUpdate_EntityHasNo_PrimaryKeyTest() | ||||
|         { | ||||
|             string text = DbContextStrings.CannotUpdate_EntityHasNo_PrimaryKey("1"); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void CannotUpdate_PrimaryKey_NotSetTest() | ||||
|         { | ||||
|             string text = DbContextStrings.CannotUpdate_PrimaryKey_NotSet("1"); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void CannotUpdate_RecordDoesNotExistTest() | ||||
|         { | ||||
|             string text = DbContextStrings.CannotUpdate_RecordDoesNotExist("1"); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void EntityType_CannotConvertTest() | ||||
|         { | ||||
|             string text = DbContextStrings.EntityType_CannotConvert("1", "2"); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void EntityType_PrimaryKeyErrorTest() | ||||
|         { | ||||
|             string text = DbContextStrings.EntityType_PrimaryKeyError("1", "2"); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void EntityType_PrimaryKeyIsNotOneTest() | ||||
|         { | ||||
|             string text = DbContextStrings.EntityType_PrimaryKeyIsNotOne("1"); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Incomparable_EntityHasNo_PrimaryKeyTest() | ||||
|         { | ||||
|             string text = DbContextStrings.Incomparable_EntityHasNo_PrimaryKey("1"); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void Incomparable_PrimaryKey_NotSetTest() | ||||
|         { | ||||
|             string text = DbContextStrings.Incomparable_PrimaryKey_NotSet("1"); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void InsertError_FilterTest() | ||||
|         { | ||||
|             string text = DbContextStrings.InsertError_Filter("1", "2", "2"); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void NotFound_PropertyTest() | ||||
|         { | ||||
|             string text = DbContextStrings.NotFound_Property("1", "2"); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void ParameterDataTypeErrorTest() | ||||
|         { | ||||
|             string text = DbContextStrings.ParameterDataTypeError("1"); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void ParameterErrorTest() | ||||
|         { | ||||
|             string text = DbContextStrings.ParameterError("1"); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void ParameterError_CannotBeNullTest() | ||||
|         { | ||||
|             string text = DbContextStrings.ParameterError_CannotBeNull("1"); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void ParameterError_IsNot_CollectionPropertiesTest() | ||||
|         { | ||||
|             string text = DbContextStrings.ParameterError_IsNot_CollectionProperties("1"); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void ParameterError_NotFound_CollectionPropertiesTest() | ||||
|         { | ||||
|             string text = DbContextStrings.ParameterError_NotFound_CollectionProperties("1"); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void ParameterError_NotFound_PropertyTest() | ||||
|         { | ||||
|             string text = DbContextStrings.ParameterError_NotFound_Property("1"); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void PropertyOfType_IsNot_OneToManyOrManyToManyTest() | ||||
|         { | ||||
|             string text = DbContextStrings.PropertyOfType_IsNot_OneToManyOrManyToMany("1", "2"); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void SpecialError_BatchAdditionFailedTest() | ||||
|         { | ||||
|             string text = DbContextStrings.SpecialError_BatchAdditionFailed("1"); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void SpecialError_UpdateFailedDataNotTrackedTest() | ||||
|         { | ||||
|             string text = DbContextStrings.SpecialError_UpdateFailedDataNotTracked("1"); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void TypeHasSetProperty_IgnoreAttributeTest() | ||||
|         { | ||||
|             string text = DbContextStrings.TypeHasSetProperty_IgnoreAttribute("1", "2"); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void UnitOfWorkManager_Construction_CannotBeNullTest() | ||||
|         { | ||||
|             string text = DbContextStrings.UnitOfWorkManager_Construction_CannotBeNull("1", "2"); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|  | ||||
|         [Fact] | ||||
|         public void UpdateError_FilterTest() | ||||
|         { | ||||
|             string text = DbContextStrings.UpdateError_Filter("1", "2", "3"); | ||||
|             output.WriteLine(text); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -16,6 +16,11 @@ namespace FreeSql.Tests | ||||
| { | ||||
|     public class UnitTest5 | ||||
|     { | ||||
|         [Fact] | ||||
|         public void AsTable_PropertyName_FormatErrorTest1() | ||||
|         { | ||||
|             CoreStrings.AsTable_PropertyName_FormatError("astable"); | ||||
|         } | ||||
|         // DTO | ||||
|         public class TestDto | ||||
|         { | ||||
|   | ||||
| @@ -688,5 +688,7 @@ Global | ||||
| 	EndGlobalSection | ||||
| 	GlobalSection(ExtensibilityGlobals) = postSolution | ||||
| 		SolutionGuid = {089687FD-5D25-40AB-BA8A-A10D1E137F98} | ||||
| 		RESX_PrefixTranslations = False | ||||
| 		RESX_NeutralResourcesLanguage = zh-Hans | ||||
| 	EndGlobalSection | ||||
| EndGlobal | ||||
|   | ||||
| @@ -47,14 +47,14 @@ namespace FreeSql.DataAnnotations | ||||
|             { | ||||
|                 var atm = Regex.Match(AsTable, @"([\w_\d]+)\s*=\s*(\d\d\d\d)\s*\-\s*(\d\d?)\s*\-\s*(\d\d?)\s*\((\d+)\s*(year|month|day|hour)\)", RegexOptions.IgnoreCase); | ||||
|                 if (atm.Success == false) | ||||
|                     throw new Exception($"[Table(AsTable = \"{AsTable}\")] 特性值格式错误"); | ||||
|                     throw new Exception(CoreStrings.AsTable_PropertyName_FormatError(AsTable)); | ||||
|  | ||||
|                 tb.AsTableColumn = tb.Columns.TryGetValue(atm.Groups[1].Value, out var trycol) ? trycol : | ||||
|                     tb.ColumnsByCs.TryGetValue(atm.Groups[1].Value, out trycol) ? trycol : throw new Exception($"[Table(AsTable = xx)] 设置的属性名 {atm.Groups[1].Value} 不存在"); | ||||
|                     tb.ColumnsByCs.TryGetValue(atm.Groups[1].Value, out trycol) ? trycol : throw new Exception(CoreStrings.NotFound_Table_Property_AsTable(atm.Groups[1].Value)); | ||||
|                 if (tb.AsTableColumn.Attribute.MapType.NullableTypeOrThis() != typeof(DateTime)) | ||||
|                 { | ||||
|                     tb.AsTableColumn = null; | ||||
|                     throw new Exception($"[Table(AsTable = xx)] 设置的属性名 {atm.Groups[1].Value} 不是 DateTime 类型"); | ||||
|                     throw new Exception(CoreStrings.AsTable_PropertyName_NotDateTime(atm.Groups[1].Value)); | ||||
|                 } | ||||
|                 int.TryParse(atm.Groups[5].Value, out var atm5); | ||||
|                 string atm6 = atm.Groups[6].Value.ToLower(); | ||||
| @@ -67,7 +67,7 @@ namespace FreeSql.DataAnnotations | ||||
|                         case "day": return dt.AddDays(atm5); | ||||
|                         case "hour": return dt.AddHours(atm5); | ||||
|                     } | ||||
|                     throw new NotImplementedException($"AsTable 未实现的功能 {AsTable}"); | ||||
|                     throw new NotImplementedException(CoreStrings.Functions_AsTable_NotImplemented(AsTable)); | ||||
|                 }); | ||||
|             } | ||||
|         } | ||||
| @@ -94,13 +94,13 @@ namespace FreeSql.DataAnnotations | ||||
|  | ||||
|         public DateTimeAsTableImpl(string tableName, DateTime beginTime, Func<DateTime, DateTime> nextTimeFunc) | ||||
|         { | ||||
|             if (nextTimeFunc == null) throw new ArgumentException($"nextTimeFunc 不可以为 null"); | ||||
|             if (nextTimeFunc == null) throw new ArgumentException(CoreStrings.Cannot_Be_NULL_Name("nextTimeFunc")); | ||||
|             beginTime = beginTime.Date; //日期部分作为开始 | ||||
|             _beginTime = beginTime; | ||||
|             _nextTimeFunc = nextTimeFunc; | ||||
|             _tableName = tableName; | ||||
|             _tableNameFormat = _regTableNameFormat.Match(tableName); | ||||
|             if (string.IsNullOrEmpty(_tableNameFormat.Groups[1].Value)) throw new ArgumentException("tableName 格式错误,示例:“log_{yyyyMMdd}”"); | ||||
|             if (string.IsNullOrEmpty(_tableNameFormat.Groups[1].Value)) throw new ArgumentException(CoreStrings.TableName_Format_Error("yyyyMMdd")); | ||||
|             ExpandTable(beginTime, DateTime.Now); | ||||
|         } | ||||
|  | ||||
| @@ -114,7 +114,7 @@ namespace FreeSql.DataAnnotations | ||||
|                 { | ||||
|                     var dtstr = beginTime.ToString(_tableNameFormat.Groups[1].Value); | ||||
|                     var name = _tableName.Replace(_tableNameFormat.Groups[0].Value, dtstr); | ||||
|                     if (_allTables.Contains(name)) throw new ArgumentException($"tableName:{_tableName} 生成了相同的分表名"); | ||||
|                     if (_allTables.Contains(name)) throw new ArgumentException(CoreStrings.Generated_Same_SubTable(_tableName)); | ||||
|                     _allTables.Insert(0, name); | ||||
|                     _allTablesTime.Insert(0, beginTime); | ||||
|                     _lastTime = beginTime; | ||||
| @@ -124,26 +124,26 @@ namespace FreeSql.DataAnnotations | ||||
|         } | ||||
|         DateTime ParseColumnValue(object columnValue) | ||||
|         { | ||||
|             if (columnValue == null) throw new Exception($"分表字段值不能为 null"); | ||||
|             if (columnValue == null) throw new Exception(CoreStrings.SubTableFieldValue_IsNotNull); | ||||
|             DateTime dt; | ||||
|             if (columnValue is DateTime || columnValue is DateTime?) | ||||
|                 dt = (DateTime)columnValue; | ||||
|             else if (columnValue is string) | ||||
|             { | ||||
|                 if (DateTime.TryParse(string.Concat(columnValue), out dt) == false) throw new Exception($"分表字段值 \"{columnValue}\" 不能转化成 DateTime"); | ||||
|                 if (DateTime.TryParse(string.Concat(columnValue), out dt) == false) throw new Exception(CoreStrings.SubTableFieldValue_NotConvertDateTime(columnValue)); | ||||
|             } | ||||
|             else if (columnValue is int || columnValue is long) | ||||
|             { | ||||
|                 dt = new DateTime(1970, 1, 1).AddSeconds((double)columnValue); | ||||
|             } | ||||
|             else throw new Exception($"分表字段值 \"{columnValue}\" 不能转化成 DateTime"); | ||||
|             else throw new Exception(CoreStrings.SubTableFieldValue_NotConvertDateTime(columnValue)); | ||||
|             return dt; | ||||
|         } | ||||
|  | ||||
|         public string GetTableNameByColumnValue(object columnValue, bool autoExpand = false) | ||||
|         { | ||||
|             var dt = ParseColumnValue(columnValue); | ||||
|             if (dt < _beginTime) throw new Exception($"分表字段值 \"{dt.ToString("yyyy-MM-dd HH:mm:ss")}\" 不能小于 \"{_beginTime.ToString("yyyy-MM-dd HH:mm:ss")} \""); | ||||
|             if (dt < _beginTime) throw new Exception(CoreStrings.SubTableFieldValue_CannotLessThen(dt.ToString("yyyy-MM-dd HH:mm:ss"), _beginTime.ToString("yyyy-MM-dd HH:mm:ss"))); | ||||
|             var tmpTime = _nextTimeFunc(_lastTime); | ||||
|             if (dt >= tmpTime && autoExpand) | ||||
|             { | ||||
| @@ -157,7 +157,7 @@ namespace FreeSql.DataAnnotations | ||||
|                     if (dt >= _allTablesTime[a]) | ||||
|                         return _allTables[a]; | ||||
|             } | ||||
|             throw new Exception($"分表字段值 \"{dt.ToString("yyyy-MM-dd HH:mm:ss")}\" 未匹配到分表名"); | ||||
|             throw new Exception(CoreStrings.SubTableFieldValue_NotMatchTable(dt.ToString("yyyy-MM-dd HH:mm:ss"))); | ||||
|         } | ||||
|         public string[] GetTableNamesByColumnValueRange(object columnValue1, object columnValue2) | ||||
|         { | ||||
| @@ -279,7 +279,7 @@ namespace FreeSql.DataAnnotations | ||||
|             { | ||||
|                 var val1 = LocalGetParamValue(m.Groups[1].Value); | ||||
|                 var val2 = LocalGetParamValue(m.Groups[2].Value); | ||||
|                 if (val1 == null || val2 == null) throw new Exception($"未能解析分表字段值 {sqlWhere}"); | ||||
|                 if (val1 == null || val2 == null) throw new Exception(CoreStrings.Failed_SubTable_FieldValue(sqlWhere)); | ||||
|                 return GetTableNamesByColumnValueRange(val1, val2); | ||||
|             } | ||||
|             m = regs[11].Match(newSqlWhere); | ||||
| @@ -287,14 +287,14 @@ namespace FreeSql.DataAnnotations | ||||
|             { | ||||
|                 var val1 = LocalGetParamValue(m.Groups[2].Value); | ||||
|                 var val2 = LocalGetParamValue(m.Groups[4].Value); | ||||
|                 if (val1 == null || val2 == null) throw new Exception($"未能解析分表字段值 {sqlWhere}"); | ||||
|                 if (val1 == null || val2 == null) throw new Exception(CoreStrings.Failed_SubTable_FieldValue(sqlWhere)); | ||||
|                 return LocalGetTables(m.Groups[1].Value, m.Groups[3].Value, ParseColumnValue(val1), ParseColumnValue(val2)); | ||||
|             } | ||||
|             m = regs[13].Match(newSqlWhere); | ||||
|             if (m.Success) | ||||
|             { | ||||
|                 var val1 = LocalGetParamValue(m.Groups[2].Value); | ||||
|                 if (val1 == null) throw new Exception($"未能解析分表字段值 {sqlWhere}"); | ||||
|                 if (val1 == null) throw new Exception(CoreStrings.Failed_SubTable_FieldValue(sqlWhere)); | ||||
|                 return LocalGetTables2(m.Groups[1].Value, ParseColumnValue(val1)); | ||||
|             } | ||||
|             return AllTables; | ||||
|   | ||||
| @@ -1,5 +1,6 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Data.Common; | ||||
| using System.Linq; | ||||
| using System.Linq.Expressions; | ||||
| using System.Reflection; | ||||
| @@ -47,7 +48,7 @@ namespace FreeSql.DataAnnotations | ||||
|  | ||||
|         public ColumnFluent Property(string proto) | ||||
|         { | ||||
|             if (_properties.TryGetValue(proto, out var tryProto) == false) throw new KeyNotFoundException($"找不到属性名 {proto}"); | ||||
|             if (_properties.TryGetValue(proto, out var tryProto) == false) throw new KeyNotFoundException(CoreStrings.NotFound_PropertyName(proto)); | ||||
|             var col = _table._columns.GetOrAdd(tryProto.Name, name => new ColumnAttribute { Name = proto }); | ||||
|             return new ColumnFluent(col, tryProto, _entityType); | ||||
|         } | ||||
| @@ -61,7 +62,7 @@ namespace FreeSql.DataAnnotations | ||||
|         /// <returns></returns> | ||||
|         public TableFluent Navigate(string proto, string bind, Type manyToMany = null) | ||||
|         { | ||||
|             if (_properties.TryGetValue(proto, out var tryProto) == false) throw new KeyNotFoundException($"找不到属性名 {proto}"); | ||||
|             if (_properties.TryGetValue(proto, out var tryProto) == false) throw new KeyNotFoundException(CoreStrings.NotFound_Property(proto)); | ||||
|             var nav = new NavigateAttribute { Bind = bind, ManyToMany = manyToMany }; | ||||
|             _table._navigates.AddOrUpdate(tryProto.Name, nav, (name, old) => nav); | ||||
|             return this; | ||||
| @@ -129,12 +130,12 @@ namespace FreeSql.DataAnnotations | ||||
|             var exp = column?.Body; | ||||
|             if (exp?.NodeType == ExpressionType.Convert) exp = (exp as UnaryExpression)?.Operand; | ||||
|             var proto = (exp as MemberExpression)?.Member; | ||||
|             if (proto == null) throw new FormatException($"错误的表达式格式 {column}"); | ||||
|             if (proto == null) throw new FormatException(CoreStrings.Bad_Expression_Format(column)); | ||||
|             return Property(proto.Name); | ||||
|         } | ||||
|         public ColumnFluent Property(string proto) | ||||
|         { | ||||
|             if (_properties.TryGetValue(proto, out var tryProto) == false) throw new KeyNotFoundException($"找不到属性名 {proto}"); | ||||
|             if (_properties.TryGetValue(proto, out var tryProto) == false) throw new KeyNotFoundException(CoreStrings.NotFound_PropertyName(proto)); | ||||
|             var col = _table._columns.GetOrAdd(tryProto.Name, name => new ColumnAttribute { Name = proto }); | ||||
|             return new ColumnFluent(col, tryProto, typeof(T)); | ||||
|         } | ||||
| @@ -152,12 +153,12 @@ namespace FreeSql.DataAnnotations | ||||
|             var exp = proto?.Body; | ||||
|             if (exp.NodeType == ExpressionType.Convert) exp = (exp as UnaryExpression)?.Operand; | ||||
|             var member = (exp as MemberExpression)?.Member; | ||||
|             if (member == null) throw new FormatException($"错误的表达式格式 {proto}"); | ||||
|             if (member == null) throw new FormatException(CoreStrings.Bad_Expression_Format(proto)); | ||||
|             return Navigate(member.Name, bind, manyToMany); | ||||
|         } | ||||
|         public TableFluent<T> Navigate(string proto, string bind, Type manyToMany = null) | ||||
|         { | ||||
|             if (_properties.TryGetValue(proto, out var tryProto) == false) throw new KeyNotFoundException($"找不到属性名 {proto}"); | ||||
|             if (_properties.TryGetValue(proto, out var tryProto) == false) throw new KeyNotFoundException(CoreStrings.NotFound_PropertyName(proto)); | ||||
|             var nav = new NavigateAttribute { Bind = bind, ManyToMany = manyToMany }; | ||||
|             _table._navigates.AddOrUpdate(tryProto.Name, nav, (name, old) => nav); | ||||
|             return this; | ||||
|   | ||||
| @@ -13,8 +13,8 @@ namespace FreeSql | ||||
|         static object _dicCurdLock = new object(); | ||||
|         static IFreeSql GetCrud(IDbConnection dbconn) | ||||
|         { | ||||
|             if (dbconn == null) throw new ArgumentNullException($"{nameof(dbconn)} 不能为 null"); | ||||
|             if (dbconn.ConnectionString == null) throw new ArgumentNullException($"{nameof(dbconn)}.ConnectionString 不能为 null"); | ||||
|             if (dbconn == null) throw new ArgumentNullException($"{nameof(dbconn)} {CoreStrings.Cannot_Be_NULL}"); | ||||
|             if (dbconn.ConnectionString == null) throw new ArgumentNullException($"{nameof(dbconn)}.ConnectionString {CoreStrings.Cannot_Be_NULL}"); | ||||
|             Type dbconType = dbconn.GetType(); | ||||
|             var connType = dbconType.UnderlyingSystemType; | ||||
|             if (_dicCurd.TryGetValue(dbconn.ConnectionString, out var fsql)) return fsql; | ||||
| @@ -25,46 +25,46 @@ namespace FreeSql | ||||
|                 case "MySqlConnection": | ||||
|                     providerType = Type.GetType("FreeSql.MySql.MySqlProvider`1,FreeSql.Provider.MySql")?.MakeGenericType(connType); | ||||
|                     if (providerType == null) providerType = Type.GetType("FreeSql.MySql.MySqlProvider`1,FreeSql.Provider.MySqlConnector")?.MakeGenericType(connType); | ||||
|                     if (providerType == null) throw new Exception("缺少 FreeSql 数据库实现包:FreeSql.Provider.MySql.dll,可前往 nuget 下载"); | ||||
|                     if (providerType == null) throw new Exception(CoreStrings.Missing_FreeSqlProvider_Package("MySql")); | ||||
|                     break; | ||||
|                 case "SqlConnection": | ||||
|                     providerType = Type.GetType("FreeSql.SqlServer.SqlServerProvider`1,FreeSql.Provider.SqlServer")?.MakeGenericType(connType); | ||||
|                     if (providerType == null) throw new Exception("缺少 FreeSql 数据库实现包:FreeSql.Provider.SqlServer.dll,可前往 nuget 下载"); | ||||
|                     if (providerType == null) throw new Exception(CoreStrings.Missing_FreeSqlProvider_Package("SqlServer")); | ||||
|                     break; | ||||
|                 case "NpgsqlConnection": | ||||
|                     providerType = Type.GetType("FreeSql.PostgreSQL.PostgreSQLProvider`1,FreeSql.Provider.PostgreSQL")?.MakeGenericType(connType); | ||||
|                     if (providerType == null) throw new Exception("缺少 FreeSql 数据库实现包:FreeSql.Provider.PostgreSQL.dll,可前往 nuget 下载"); | ||||
|                     if (providerType == null) throw new Exception(CoreStrings.Missing_FreeSqlProvider_Package("PostgreSQL")); | ||||
|                     break; | ||||
|                 case "OracleConnection": | ||||
|                     providerType = Type.GetType("FreeSql.Oracle.OracleProvider`1,FreeSql.Provider.Oracle")?.MakeGenericType(connType); | ||||
|                     if (providerType == null) throw new Exception("缺少 FreeSql 数据库实现包:FreeSql.Provider.Oracle.dll,可前往 nuget 下载"); | ||||
|                     if (providerType == null) throw new Exception(CoreStrings.Missing_FreeSqlProvider_Package("Oracle")); | ||||
|                     break; | ||||
|                 case "SQLiteConnection": | ||||
|                     providerType = Type.GetType("FreeSql.Sqlite.SqliteProvider`1,FreeSql.Provider.Sqlite")?.MakeGenericType(connType); | ||||
|                     if (providerType == null) throw new Exception("缺少 FreeSql 数据库实现包:FreeSql.Provider.Sqlite.dll,可前往 nuget 下载"); | ||||
|                     if (providerType == null) throw new Exception(CoreStrings.Missing_FreeSqlProvider_Package("Sqlite")); | ||||
|                     break; | ||||
|                 case "DmConnection": | ||||
|                     providerType = Type.GetType("FreeSql.Dameng.DamengProvider`1,FreeSql.Provider.Dameng")?.MakeGenericType(connType); | ||||
|                     if (providerType == null) throw new Exception("缺少 FreeSql 数据库实现包:FreeSql.Provider.Dameng.dll,可前往 nuget 下载"); | ||||
|                     if (providerType == null) throw new Exception(CoreStrings.Missing_FreeSqlProvider_Package("Dameng")); | ||||
|                     break; | ||||
|                 case "OscarConnection": | ||||
|                     providerType = Type.GetType("FreeSql.ShenTong.ShenTongProvider`1,FreeSql.Provider.ShenTong")?.MakeGenericType(connType); | ||||
|                     if (providerType == null) throw new Exception("缺少 FreeSql 数据库实现包:FreeSql.Provider.ShenTong.dll,可前往 nuget 下载"); | ||||
|                     if (providerType == null) throw new Exception(CoreStrings.Missing_FreeSqlProvider_Package("ShenTong")); | ||||
|                     break; | ||||
|                 case "KdbndpConnection": | ||||
|                     providerType = Type.GetType("FreeSql.KingbaseES.KingbaseESProvider`1,FreeSql.Provider.KingbaseES")?.MakeGenericType(connType); | ||||
|                     if (providerType == null) throw new Exception("缺少 FreeSql 数据库实现包:FreeSql.Provider.KingbaseES.dll,可前往 nuget 下载"); | ||||
|                     if (providerType == null) throw new Exception(CoreStrings.Missing_FreeSqlProvider_Package("KingbaseES")); | ||||
|                     break; | ||||
|                 case "FbConnection": | ||||
|                     providerType = Type.GetType("FreeSql.Firebird.FirebirdProvider`1,FreeSql.Provider.Firebird")?.MakeGenericType(connType); | ||||
|                     if (providerType == null) throw new Exception("缺少 FreeSql 数据库实现包:FreeSql.Provider.Firebird.dll,可前往 nuget 下载"); | ||||
|                     if (providerType == null) throw new Exception(CoreStrings.Missing_FreeSqlProvider_Package("Firebird")); | ||||
|                     break; | ||||
|                 case "ClickHouseConnection": | ||||
|                     providerType = Type.GetType("FreeSql.ClickHouse.ClickHouseProvider`1,FreeSql.Provider.ClickHouse")?.MakeGenericType(connType); | ||||
|                     if (providerType == null) throw new Exception("缺少 FreeSql 数据库实现包:FreeSql.Provider.ClickHouse.dll,可前往 nuget 下载"); | ||||
|                     if (providerType == null) throw new Exception(CoreStrings.Missing_FreeSqlProvider_Package("ClickHouse")); | ||||
|                     break; | ||||
|                 default: | ||||
|                     throw new Exception("未实现"); | ||||
|                     throw new Exception(CoreStrings.Not_Implemented); | ||||
|             } | ||||
|             lock (_dicCurdLock) | ||||
|             { | ||||
| @@ -76,7 +76,7 @@ namespace FreeSql | ||||
|         } | ||||
|         static IFreeSql GetCrud(IDbTransaction dbtran) | ||||
|         { | ||||
|             if (dbtran == null) throw new ArgumentNullException($"{nameof(dbtran)} 不能为 null"); | ||||
|             if (dbtran == null) throw new ArgumentNullException($"{nameof(dbtran)} {CoreStrings.Cannot_Be_NULL}"); | ||||
|             return GetCrud(dbtran.Connection); | ||||
|         } | ||||
|  | ||||
|   | ||||
| @@ -476,7 +476,7 @@ namespace FreeSql | ||||
|             if (expContext.ParsedContent["delimiter"] == "','") | ||||
|                 expContext.Result = $"wm_concat_text({expContext.ParsedContent["column"]})"; | ||||
|             else | ||||
|                 throw new NotImplementedException("GBase 暂时不支持逗号以外的分割符"); | ||||
|                 throw new NotImplementedException(CoreStrings.GBase_NotSupport_OtherThanCommas); | ||||
|             //expContext.Result = $"replace(wm_concat_text({expContext.ParsedContent["column"]}), ',', {expContext.ParsedContent["delimiter"]})"; | ||||
|             return null; | ||||
|         } | ||||
|   | ||||
| @@ -157,7 +157,7 @@ public static partial class FreeSqlGlobalExtensions | ||||
|         var ret = _dicInternalGetTypeConstructor0OrFirst.GetOrAdd(that, tp => | ||||
|             tp.GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[0], null) ?? | ||||
|             tp.GetConstructors(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).OrderBy(a => a.IsPublic ? 0 : 1).FirstOrDefault()); | ||||
|         if (ret == null && isThrow) throw new ArgumentException($"{that.FullName} 类型无方法访问构造函数"); | ||||
|         if (ret == null && isThrow) throw new ArgumentException(CoreStrings.Type_Cannot_Access_Constructor(that.FullName)); | ||||
|         return ret; | ||||
|     } | ||||
|  | ||||
| @@ -378,7 +378,7 @@ public static partial class FreeSqlGlobalExtensions | ||||
|         var t1sel = orm.Select<T1>() as Select1Provider<T1>; | ||||
|         var t1expFul = t1sel.ConvertStringPropertyToExpression(property, true); | ||||
|         var t1exp = props.Length == 1 ? t1expFul : t1sel.ConvertStringPropertyToExpression(props[0], true); | ||||
|         if (t1expFul == null) throw new ArgumentException($"{nameof(property)} 无法解析为表达式树"); | ||||
|         if (t1expFul == null) throw new ArgumentException(CoreStrings.Cannot_Resolve_ExpressionTree(nameof(property))); | ||||
|         var propElementType = t1expFul.Type.GetGenericArguments().FirstOrDefault() ?? t1expFul.Type.GetElementType(); | ||||
|         if (propElementType != null) //IncludeMany | ||||
|         { | ||||
| @@ -394,7 +394,7 @@ public static partial class FreeSqlGlobalExtensions | ||||
|             return list; | ||||
|         } | ||||
|         var tbtr = t1tb.GetTableRef(props[0], true); | ||||
|         if (tbtr == null) throw new ArgumentException($"{nameof(property)} 参数错误,它不是有效的导航属性"); | ||||
|         if (tbtr == null) throw new ArgumentException(CoreStrings.ParameterError_NotValid_Navigation(nameof(property))); | ||||
|         var reftb = orm.CodeFirst.GetTableByEntity(t1exp.Type); | ||||
|         var refsel = orm.Select<object>().AsType(t1exp.Type) as Select1Provider<object>; | ||||
|         if (props.Length > 1) | ||||
| @@ -443,14 +443,14 @@ public static partial class FreeSqlGlobalExtensions | ||||
|         } | ||||
|         var sel = orm.Select<T1>() as Select1Provider<T1>; | ||||
|         var exp = sel.ConvertStringPropertyToExpression(property, true); | ||||
|         if (exp == null) throw new ArgumentException($"{nameof(property)} 无法解析为表达式树"); | ||||
|         if (exp == null) throw new ArgumentException(CoreStrings.Cannot_Resolve_ExpressionTree(nameof(property))); | ||||
|         var memExp = exp as MemberExpression; | ||||
|         if (memExp == null) throw new ArgumentException($"{nameof(property)} 无法解析为表达式树2"); | ||||
|         if (memExp == null) throw new ArgumentException($"{CoreStrings.Cannot_Resolve_ExpressionTree(nameof(property))}2"); | ||||
|         var parTb = orm.CodeFirst.GetTableByEntity(memExp.Expression.Type); | ||||
|         if (parTb == null) throw new ArgumentException($"{nameof(property)} 无法解析为表达式树3"); | ||||
|         if (parTb == null) throw new ArgumentException($"{CoreStrings.Cannot_Resolve_ExpressionTree(nameof(property))}3"); | ||||
|         var propElementType = exp.Type.GetGenericArguments().FirstOrDefault() ?? exp.Type.GetElementType(); | ||||
|         var reftb = orm.CodeFirst.GetTableByEntity(propElementType); | ||||
|         if (reftb == null) throw new ArgumentException($"{nameof(property)} 参数错误,它不是集合属性,必须为 IList<T> 或者 ICollection<T>"); | ||||
|         if (reftb == null) throw new ArgumentException(CoreStrings.ParameterError_NotValid_Collection(nameof(property))); | ||||
|  | ||||
|         if (string.IsNullOrWhiteSpace(where) == false) | ||||
|         { | ||||
| @@ -463,12 +463,12 @@ public static partial class FreeSqlGlobalExtensions | ||||
|             for (var a = 0; a < whereSplit.Length; a++) | ||||
|             { | ||||
|                 var keyval = whereSplit[a].Split('=').Select(x => x.Trim()).Where(x => string.IsNullOrWhiteSpace(x) == false).ToArray(); | ||||
|                 if (keyval.Length != 2) throw new ArgumentException($"{nameof(where)} 参数错误,格式 \"TopicId=Id,多组使用逗号连接\" "); | ||||
|                 if (keyval.Length != 2) throw new ArgumentException(CoreStrings.ParameterError_NotValid_UseCommas(nameof(where))); | ||||
|  | ||||
|                 if (reftb.ColumnsByCs.TryGetValue(keyval[0], out var keycol) == false) | ||||
|                     throw new ArgumentException($"{nameof(where)} 参数错误,{keyval[0]} 不是有效的属性名,在实体类 {reftb.Type.DisplayCsharp()} 无法找到"); | ||||
|                     throw new ArgumentException(CoreStrings.ParameterError_NotValid_PropertyName(nameof(where),keyval[0], reftb.Type.DisplayCsharp())); | ||||
|                 if (parTb.ColumnsByCs.TryGetValue(keyval[1], out var valcol) == false) | ||||
|                     throw new ArgumentException($"{nameof(where)} 参数错误,{keyval[1]} 不是有效的属性名,在实体类 {parTb.Type.DisplayCsharp()} 无法找到"); | ||||
|                     throw new ArgumentException(CoreStrings.ParameterError_NotValid_PropertyName(nameof(where), keyval[1], parTb.Type.DisplayCsharp())); | ||||
|  | ||||
|                 var tmpExp = Expression.Equal( | ||||
|                     Expression.Convert(Expression.MakeMemberAccess(refparamExp, reftb.Properties[keyval[0]]), valcol.CsType), | ||||
| @@ -494,7 +494,7 @@ public static partial class FreeSqlGlobalExtensions | ||||
|                 select.Split(',').Select(x => x.Trim()).Where(x => string.IsNullOrWhiteSpace(x) == false).Select(a => | ||||
|                 { | ||||
|                     if (reftb.ColumnsByCs.TryGetValue(a, out var col) == false) | ||||
|                         throw new ArgumentException($"{nameof(select)} 参数错误,{a} 不是有效的属性名,在实体类 {reftb.Type.DisplayCsharp()} 无法找到"); | ||||
|                         throw new ArgumentException(CoreStrings.ParameterError_NotValid_PropertyName(nameof(select), a, reftb.Type.DisplayCsharp())); | ||||
|                     return Expression.Bind(reftb.Properties[col.CsName], Expression.MakeMemberAccess(refparamExp, reftb.Properties[col.CsName])); | ||||
|                 }).ToArray()); | ||||
|  | ||||
| @@ -505,7 +505,7 @@ public static partial class FreeSqlGlobalExtensions | ||||
|         var funcType = typeof(Func<,>).MakeGenericType(sel._tables[0].Table.Type, typeof(IEnumerable<>).MakeGenericType(reftb.Type)); | ||||
|         var navigateSelector = Expression.Lambda(funcType, exp, sel._tables[0].Parameter); | ||||
|         var incMethod = sel.GetType().GetMethod("IncludeMany"); | ||||
|         if (incMethod == null) throw new Exception("运行时错误,反射获取 IncludeMany 方法失败"); | ||||
|         if (incMethod == null) throw new Exception(CoreStrings.RunTimeError_Reflection_IncludeMany); | ||||
|         incMethod.MakeGenericMethod(reftb.Type).Invoke(sel, new object[] { navigateSelector, null }); | ||||
|         return sel; | ||||
|     } | ||||
| @@ -595,7 +595,7 @@ public static partial class FreeSqlGlobalExtensions | ||||
|                 a.RefType == FreeSql.Internal.Model.TableRefType.OneToMany && | ||||
|                 a.RefEntityType == tb.Type).ToArray(); | ||||
|  | ||||
|         if (navs.Length != 1) throw new ArgumentException($"{tb.Type.FullName} 不是父子关系,无法使用该功能"); | ||||
|         if (navs.Length != 1) throw new ArgumentException(CoreStrings.Entity_NotParentChild_Relationship(tb.Type.FullName)); | ||||
|         var tbref = navs[0]; | ||||
|  | ||||
|         var cteName = "as_tree_cte"; | ||||
| @@ -641,7 +641,7 @@ public static partial class FreeSqlGlobalExtensions | ||||
|                 } | ||||
|                 if (int.TryParse((mysqlVersion ?? "").Split('.')[0], out var mysqlVersionFirst) && mysqlVersionFirst < 8) | ||||
|                 { | ||||
|                     if (tbref.Columns.Count > 1) throw new ArgumentException($"{tb.Type.FullName} 是父子关系,但是 MySql 8.0 以下版本中不支持组合多主键"); | ||||
|                     if (tbref.Columns.Count > 1) throw new ArgumentException(CoreStrings.Entity_MySQL_VersionsBelow8_NotSupport_Multiple_PrimaryKeys(tb.Type.FullName)); | ||||
|                     var mysql56Sql = ""; | ||||
|                     if (up == false) | ||||
|                     { | ||||
| @@ -833,7 +833,7 @@ SELECT "); | ||||
|             case DataType.Firebird: | ||||
|                 return that.OrderBy("rand()"); | ||||
|         } | ||||
|         throw new NotSupportedException($"{s0p._orm.Ado.DataType} 不支持 OrderByRandom 随机排序"); | ||||
|         throw new NotSupportedException($"{CoreStrings.Not_Support_OrderByRandom(s0p._orm.Ado.DataType)}"); | ||||
|     } | ||||
|     #endregion | ||||
|  | ||||
| @@ -1033,7 +1033,7 @@ SELECT "); | ||||
|             foreach (var primary in primarys) | ||||
|             { | ||||
|                 if (table.ColumnsByCs.TryGetValue(string.Concat(primary), out var col)) pks.Add(col); | ||||
|                 else throw new Exception($"GetPrimarys 传递的参数 \"{primary}\" 不正确,它不属于字典数据的键名"); | ||||
|                 else throw new Exception(CoreStrings.GetPrimarys_ParameterError_IsNotDictKey(primary)); | ||||
|             } | ||||
|             return pks.ToArray(); | ||||
|         } | ||||
| @@ -1042,7 +1042,7 @@ SELECT "); | ||||
|             foreach (var primary in primarys) | ||||
|             { | ||||
|                 if (table.ColumnsByCs.TryGetValue(string.Concat(primary), out var col)) col.Attribute.IsPrimary = true; | ||||
|                 else throw new Exception($"GetPrimarys 传递的参数 \"{primary}\" 不正确,它不属于字典数据的键名"); | ||||
|                 else throw new Exception(CoreStrings.GetPrimarys_ParameterError_IsNotDictKey(primary)); | ||||
|             } | ||||
|             table.Primarys = table.Columns.Where(a => a.Value.Attribute.IsPrimary).Select(a => a.Value).ToArray(); | ||||
|         } | ||||
|   | ||||
| @@ -20,9 +20,39 @@ | ||||
| 		<DelaySign>false</DelaySign> | ||||
| 	</PropertyGroup> | ||||
|  | ||||
| 	<ItemGroup> | ||||
| 	  <Compile Remove="Properties\Resources.cs" /> | ||||
| 	</ItemGroup> | ||||
|  | ||||
| 	<ItemGroup> | ||||
| 	  <None Remove="Properties\Resources.tt" /> | ||||
| 	</ItemGroup> | ||||
|  | ||||
| 	<ItemGroup> | ||||
| 		<None Include="../logo.png" Pack="true" PackagePath="\" /> | ||||
| 	</ItemGroup> | ||||
|  | ||||
| 	<ItemGroup> | ||||
| 	  <Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" /> | ||||
| 	</ItemGroup> | ||||
|  | ||||
| 	<ItemGroup> | ||||
| 	  <Compile Update="Properties\CoreStrings.Designer.cs"> | ||||
| 	    <DesignTime>True</DesignTime> | ||||
| 	    <AutoGen>True</AutoGen> | ||||
| 	    <DependentUpon>CoreStrings.Designer.tt</DependentUpon> | ||||
| 	  </Compile> | ||||
| 	</ItemGroup> | ||||
|  | ||||
| 	<ItemGroup> | ||||
| 	  <None Update="Properties\CoreStrings.Designer.tt"> | ||||
| 	    <Generator>TextTemplatingFileGenerator</Generator> | ||||
| 	    <LastGenOutput>CoreStrings.Designer.cs</LastGenOutput> | ||||
| 	  </None> | ||||
| 		<EmbeddedResource Update="Properties\CoreStrings.resx"> | ||||
| 			<CustomToolNamespace>FreeSql</CustomToolNamespace> | ||||
| 		</EmbeddedResource> | ||||
| 	</ItemGroup> | ||||
|    | ||||
| 	<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> | ||||
| 		<DocumentationFile>FreeSql.xml</DocumentationFile> | ||||
|   | ||||
| @@ -4584,6 +4584,647 @@ | ||||
|             BigApple -> bigapple | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="T:FreeSql.CoreStrings"> | ||||
|             <summary> | ||||
|                 <para> | ||||
|             	    String resources used in FreeSql exceptions, etc. | ||||
|                 </para> | ||||
|                 <para> | ||||
|             	    These strings are exposed publicly for use by database providers and extensions. | ||||
|                     It is unusual for application code to need these strings. | ||||
|                 </para> | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.AsTable_PropertyName_FormatError(System.Object)"> | ||||
|             <summary> | ||||
|             [Table(AsTable = "{asTable}")] 特性值格式错误 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.AsTable_PropertyName_NotDateTime(System.Object)"> | ||||
|             <summary> | ||||
|             [Table(AsTable = xx)] 设置的属性名 {atmGroupsValue} 不是 DateTime 类型 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Available_Failed_Get_Resource(System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             {name}: Failed to get resource {statistics} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Available_Thrown_Exception(System.Object)"> | ||||
|             <summary> | ||||
|             {name}: An exception needs to be thrown | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Bad_Expression_Format(System.Object)"> | ||||
|             <summary> | ||||
|             错误的表达式格式 {column} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.CoreStrings.Before_Chunk_Cannot_Use_Select"> | ||||
|             <summary> | ||||
|             Chunk 功能之前不可使用 Select | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.CoreStrings.Begin_Transaction_Then_ForUpdate"> | ||||
|             <summary> | ||||
|             安全起见,请务必在事务开启之后,再使用 ForUpdate | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.CoreStrings.Cannot_Be_NULL"> | ||||
|             <summary> | ||||
|             不能为 null | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Cannot_Be_NULL_Name(System.Object)"> | ||||
|             <summary> | ||||
|             {name} 不能为 null | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Cannot_Match_Property(System.Object)"> | ||||
|             <summary> | ||||
|             无法匹配 {property} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Cannot_Resolve_ExpressionTree(System.Object)"> | ||||
|             <summary> | ||||
|             {property} 无法解析为表达式树 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.CoreStrings.Check_UseConnectionString"> | ||||
|             <summary> | ||||
|             参数 masterConnectionString 不可为空,请检查 UseConnectionString | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.CoreStrings.Commit"> | ||||
|             <summary> | ||||
|             提交 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.CoreStrings.Connection_Failed_Switch_Servers"> | ||||
|             <summary> | ||||
|             连接失败,准备切换其他可用服务器 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Custom_Expression_ParsingError(System.Object)"> | ||||
|             <summary> | ||||
|             自定义表达式解析错误:类型 {exp3MethodDeclaringType} 需要定义 static ThreadLocal<ExpressionCallContext> 字段、字段、字段(重要三次提醒) | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.CoreStrings.Custom_Reflection_IsNotNull"> | ||||
|             <summary> | ||||
|             Custom { 反射信息 }不能为空,格式:{ 静态方法名 }{ 空格 }{ 反射信息 } | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.CoreStrings.Custom_StaticMethodName_IsNotNull"> | ||||
|             <summary> | ||||
|             Custom { 静态方法名 }不能为空,格式:{ 静态方法名 }{ 空格 }{ 反射信息 } | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Custom_StaticMethodName_NotSet_DynamicFilterCustom(System.Object)"> | ||||
|             <summary> | ||||
|             Custom 对应的{{ 静态方法名 }}:{fiValueCustomArray} 未设置 [DynamicFilterCustomAttribute] 特性 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.CoreStrings.CustomFieldSeparatedBySpaces"> | ||||
|             <summary> | ||||
|             Custom 要求 Field 应该空格分割,并且长度为 2,格式:{ 静态方法名 }{ 空格 }{ 反射信息 } | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.DataType_AsType_Inconsistent(System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             操作的数据类型({dataDisplayCsharp}) 与 AsType({tableTypeDisplayCsharp}) 不一致,请检查。 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.CoreStrings.DateRange_Comma_Separateda_By2Char"> | ||||
|             <summary> | ||||
|             DateRange 要求 Value 应该逗号分割,并且长度为 2 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.CoreStrings.DateRange_DateFormat_yyyy"> | ||||
|             <summary> | ||||
|             DateRange 要求 Value[1] 格式必须为:yyyy、yyyy-MM、yyyy-MM-dd、yyyy-MM-dd HH、yyyy、yyyy-MM-dd HH:mm | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.DbUpdateVersionException_RowLevelOptimisticLock(System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             记录可能不存在,或者【行级乐观锁】版本过旧,更新数量{sourceCount},影响的行数{affrows}。 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.CoreStrings.Different_Number_SlaveConnectionString_SlaveWeights"> | ||||
|             <summary> | ||||
|             SlaveConnectionString 数量与 SlaveWeights 不相同 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Duplicate_ColumnAttribute(System.Object)"> | ||||
|             <summary> | ||||
|             ColumnAttribute.Name {colattrName} 重复存在,请检查(注意:不区分大小写) | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Duplicate_PropertyName(System.Object)"> | ||||
|             <summary> | ||||
|             属性名 {pName} 重复存在,请检查(注意:不区分大小写) | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Entity_Must_Primary_Key(System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             {function} 功能要求实体类 {tableCsName} 必须有主键 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Entity_MySQL_VersionsBelow8_NotSupport_Multiple_PrimaryKeys(System.Object)"> | ||||
|             <summary> | ||||
|             {tbTypeFullName} 是父子关系,但是 MySql 8.0 以下版本中不支持组合多主键 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Entity_NotParentChild_Relationship(System.Object)"> | ||||
|             <summary> | ||||
|             {tbTypeFullName} 不是父子关系,无法使用该功能 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.CoreStrings.EspeciallySubquery_Cannot_Parsing"> | ||||
|             <summary> | ||||
|             这个特别的子查询不能解析 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Expression_Error_Use_ParameterExpression(System.Object)"> | ||||
|             <summary> | ||||
|             表达式错误,它的顶级对象不是 ParameterExpression:{exp} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Expression_Error_Use_Successive_MemberAccess_Type(System.Object)"> | ||||
|             <summary> | ||||
|             表达式错误,它不是连续的 MemberAccess 类型:{exp} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.ExpressionTree_Convert_Type_Error(System.Object,System.Object,System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             ExpressionTree 转换类型错误,值({value}),类型({valueTypeFullName}),目标类型({typeFullName}),{exMessage} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Failed_SubTable_FieldValue(System.Object)"> | ||||
|             <summary> | ||||
|             未能解析分表字段值 {sqlWhere} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Functions_AsTable_NotImplemented(System.Object)"> | ||||
|             <summary> | ||||
|             AsTable 未实现的功能 {asTable} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.CoreStrings.GBase_NotSupport_OtherThanCommas"> | ||||
|             <summary> | ||||
|             GBase 暂时不支持逗号以外的分割符 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Generated_Same_SubTable(System.Object)"> | ||||
|             <summary> | ||||
|             tableName:{tableName} 生成了相同的分表名 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.GetPrimarys_ParameterError_IsNotDictKey(System.Object)"> | ||||
|             <summary> | ||||
|             GetPrimarys 传递的参数 "{primary}" 不正确,它不属于字典数据的键名 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Has_Specified_Cannot_Specified_Second(System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             已经指定了 {first},不能再指定 {second} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Ignored_Check_Confirm_PublicGetSet(System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             {tb2DbName}.{mp2MemberName} 被忽略,请检查 IsIgnore 设置,确认 get/set 为 public | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.CoreStrings.Include_ParameterType_Error"> | ||||
|             <summary> | ||||
|             Include 参数类型错误 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.CoreStrings.Include_ParameterType_Error_Use_IncludeMany"> | ||||
|             <summary> | ||||
|             Include 参数类型错误,集合属性请使用 IncludeMany | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.CoreStrings.Include_ParameterType_Error_Use_MemberAccess"> | ||||
|             <summary> | ||||
|             Include 参数类型错误,表达式类型应该为 MemberAccess | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.IncludeMany_NotValid_Navigation(System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             IncludeMany 类型 {tbTypeDisplayCsharp} 的属性 {collMemMemberName} 不是有效的导航属性,提示:IsIgnore = true 不会成为导航属性 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.IncludeMany_ParameterError_OnlyUseOneParameter(System.Object)"> | ||||
|             <summary> | ||||
|             IncludeMany {navigateSelector} 参数错误,Select 只可以使用一个参数的方法,正确格式:.Select(t =>new TNavigate {{}}) | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.IncludeMany_ParameterError_Select_ReturnConsistentType(System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             IncludeMany {navigateSelector} 参数错误,Select lambda参数返回值必须和 {collMemElementType} 类型一致 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.CoreStrings.IncludeMany_ParameterType_Error_Use_MemberAccess"> | ||||
|             <summary> | ||||
|             IncludeMany 参数1 类型错误,表达式类型应该为 MemberAccess | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.IncludeMany_ParameterTypeError(System.Object)"> | ||||
|             <summary> | ||||
|             IncludeMany {navigateSelector} 参数类型错误,正确格式: a.collections.Take(1).Where(c =>c.aid == a.id).Select(a=> new TNavigate{{}}) | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.InsertInto_No_Property_Selected(System.Object)"> | ||||
|             <summary> | ||||
|             ISelect.InsertInto() 未选择属性: {displayCsharp} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.InsertInto_TypeError(System.Object)"> | ||||
|             <summary> | ||||
|             ISelect.InsertInto() 类型错误: {displayCsharp} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.InsertOrUpdate_Must_Primary_Key(System.Object)"> | ||||
|             <summary> | ||||
|             InsertOrUpdate 功能执行 merge into 要求实体类 {CsName} 必须有主键 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.InsertOrUpdate_NotSuport_Generic_UseEntity(System.Object)"> | ||||
|             <summary> | ||||
|             InsertOrUpdate<>的泛型参数 不支持 {typeofT1},请传递您的实体类 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.CoreStrings.Install_FreeSql_Extensions_LazyLoading"> | ||||
|             <summary> | ||||
|             【延时加载】功能需要安装 FreeSql.Extensions.LazyLoading.dll,可前往 nuget 下载 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.LazyLoading_CompilationError(System.Object,System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             【延时加载】{trytbTypeName} 编译错误:{exMessage}\r\n\r\n{cscode} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.LazyLoading_EntityMustDeclarePublic(System.Object)"> | ||||
|             <summary> | ||||
|             【延时加载】实体类型 {trytbTypeName} 必须声明为 public | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.CoreStrings.ManyToMany_AsSelect_NotSupport_Sum_Avg_etc"> | ||||
|             <summary> | ||||
|             ManyToMany 导航属性 .AsSelect() 暂时不可用于 Sum/Avg/Max/Min/First/ToOne/ToList 方法 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.ManyToMany_NotFound_CorrespondingField(System.Object,System.Object,System.Object,System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 在 {tbmidCsName} 中没有找到对应的字段,如:{midTypePropsTrytbName}{findtrytbPkCsName}、{midTypePropsTrytbName}_{findtrytbPkCsName} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.ManyToMany_ParsingError_EntityMissing_PrimaryKey(System.Object,System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,实体类型 {tbrefTypeName} 缺少主键标识,[Column(IsPrimary = true)] | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.ManyToMany_ParsingError_EntityMustHas_NavigateCollection(System.Object,System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,实体类型 {tbrefTypeName} 必须存在对应的 [Navigate(ManyToMany = x)] 集合属性 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.ManyToMany_ParsingError_InconsistentType(System.Object,System.Object,System.Object,System.Object,System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,{tbmidCsName}.{trycolCsName} 和 {trytbCsName}.{trytbPrimarysCsName} 类型不一致 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.ManyToMany_ParsingError_IntermediateClass_ErrorMessage(System.Object,System.Object,System.Object,System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,中间类 {tbmidCsName}.{midTypePropsTrytbName} 错误:{exMessage} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.ManyToMany_ParsingError_IntermediateClass_NotManyToOne_OneToOne(System.Object,System.Object,System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,中间类 {tbmidCsName}.{midTypePropsTrytbName} 导航属性不是【ManyToOne】或【OneToOne】 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Mapping_Exception_HasNo_SamePropertyName(System.Object)"> | ||||
|             <summary> | ||||
|             映射异常:{name} 没有一个属性名相同 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.CoreStrings.MasterPool_IsNull_UseTransaction"> | ||||
|             <summary> | ||||
|             Ado.MasterPool 值为 null,该操作无法自启用事务,请显式传递【事务对象】解决 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Missing_FreeSqlProvider_Package(System.Object)"> | ||||
|             <summary> | ||||
|             缺少 FreeSql 数据库实现包:FreeSql.Provider.{Provider}.dll,可前往 nuget 下载 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Missing_FreeSqlProvider_Package_Reason(System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             缺少 FreeSql 数据库实现包:{dll},可前往 nuget 下载;如果存在 {dll} 依然报错(原因是环境问题导致反射不到类型),请在 UseConnectionString/UseConnectionFactory 第三个参数手工传入 typeof({providerType}) | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Navigation_Bind_Number_Different(System.Object,System.Object,System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             导航属性 {trytbTypeName}.{pnvName} 特性 [Navigate] Bind 数目({bindColumnsCount}) 与 外部主键数目({tbrefPrimarysLength}) 不相同 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Navigation_Missing_AsSelect(System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             {tb2DbName}.{mp2MemberName} 导航属性集合忘了 .AsSelect() 吗?如果在 ToList(a => a.{mp2MemberName}) 中使用,请移步参考 IncludeMany 文档。 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Navigation_Missing_SetProperty(System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             【导航属性】{trytbTypeDisplayCsharp}.{pName} 缺少 set 属性 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Navigation_NotFound_CorrespondingField(System.Object,System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             导航属性 {trytbTypeName}.{pnvName} 没有找到对应的字段,如:{pnvName}{findtbrefPkCsName}、{pnvName}_{findtbrefPkCsName}。或者使用 [Navigate] 特性指定关系映射。 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Navigation_ParsingError_EntityMissingPrimaryKey(System.Object,System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             导航属性 {trytbTypeName}.{pnvName} 解析错误,实体类型 {trytcTypeName} 缺少主键标识,[Column(IsPrimary = true)] | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Navigation_ParsingError_InconsistentType(System.Object,System.Object,System.Object,System.Object,System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             导航属性 {trytbTypeName}.{pnvName} 解析错误,{trytbCsName}.{trycolCsName} 和 {tbrefCsName}.{tbrefPrimarysCsName} 类型不一致 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Navigation_ParsingError_NotFound_Property(System.Object,System.Object,System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             导航属性 {trytbTypeName}.{pnvName} 特性 [Navigate] 解析错误,在 {tbrefTypeName} 未找到属性:{bi} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.NoPrimaryKey_UseSetDto(System.Object)"> | ||||
|             <summary> | ||||
|             {tableTypeDisplayCsharp} 没有定义主键,无法使用 SetSource,请尝试 SetDto | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.CoreStrings.NoProperty_Defined"> | ||||
|             <summary> | ||||
|              没有定义属性  | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.CoreStrings.Not_Implemented"> | ||||
|             <summary> | ||||
|             未实现 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Not_Implemented_Expression(System.Object)"> | ||||
|             <summary> | ||||
|             未实现函数表达式 {exp} 解析 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Not_Implemented_Expression_ParameterUseConstant(System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             未实现函数表达式 {exp} 解析,参数 {expArguments} 必须为常量 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Not_Implemented_Expression_UseAsSelect(System.Object,System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             未实现函数表达式 {exp} 解析,如果正在操作导航属性集合,请使用 .AsSelect().{exp3MethodName}({exp3ArgumentsCount}) | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.CoreStrings.Not_Implemented_MemberAcess_Constant"> | ||||
|             <summary> | ||||
|             未实现 MemberAccess 下的 Constant | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Not_Implemented_Name(System.Object)"> | ||||
|             <summary> | ||||
|             未实现 {name} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.CoreStrings.Not_Support"> | ||||
|             <summary> | ||||
|             不支持 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Not_Support_OrderByRandom(System.Object)"> | ||||
|             <summary> | ||||
|             {dataType} 不支持 OrderByRandom 随机排序 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Not_Valid_Navigation_Property(System.Object)"> | ||||
|             <summary> | ||||
|             {property} 不是有效的导航属性 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.NotFound_Column(System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             {dbName} 找不到列 {memberName} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.NotFound_CsName_Column(System.Object)"> | ||||
|             <summary> | ||||
|             找不到 {CsName} 对应的列 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.NotFound_Property(System.Object)"> | ||||
|             <summary> | ||||
|             找不到属性:{memberName} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.NotFound_PropertyName(System.Object)"> | ||||
|             <summary> | ||||
|             找不到属性名 {proto} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.NotFound_Reflection(System.Object)"> | ||||
|             <summary> | ||||
|             Custom 找不到对应的{{ 反射信息 }}:{fiValueCustomArray} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.NotFound_Static_MethodName(System.Object)"> | ||||
|             <summary> | ||||
|             Custom 找不到对应的{{ 静态方法名 }}:{fiValueCustomArray} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.NotFound_Table_Property_AsTable(System.Object)"> | ||||
|             <summary> | ||||
|             [Table(AsTable = xx)] 设置的属性名 {atmGroupsValue} 不存在 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.CoreStrings.NotSpecified_UseConnectionString_UseConnectionFactory"> | ||||
|             <summary> | ||||
|             未指定 UseConnectionString 或者 UseConnectionFactory | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.ObjectPool_Get_Timeout(System.Object,System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             【{policyName}】ObjectPool.{GetName}() timeout {totalSeconds} seconds, see: https://github.com/dotnetcore/FreeSql/discussions/1081 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.ObjectPool_GetAsync_Queue_Long(System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             【{policyName}】ObjectPool.GetAsync() The queue is too long. Policy.AsyncGetCapacity = {asyncGetCapacity} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.OneToMany_NotFound_CorrespondingField(System.Object,System.Object,System.Object,System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             【OneToMany】导航属性 {trytbTypeName}.{pnvName} 在 {tbrefCsName} 中没有找到对应的字段,如:{findtrytb}{findtrytbPkCsName}、{findtrytb}_{findtrytbPkCsName} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.OneToMany_ParsingError_InconsistentType(System.Object,System.Object,System.Object,System.Object,System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             【OneToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,{trytbCsName}.{trytbPrimarysCsName} 和 {tbrefCsName}.{trycolCsName} 类型不一致 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.OneToMany_UseNavigate(System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             、{refpropName}{findtrytbPkCsName}、{refpropName}_{findtrytbPkCsName}。或者使用 [Navigate] 特性指定关系映射。 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.CoreStrings.Parameter_Field_NotSpecified"> | ||||
|             <summary> | ||||
|             参数 field 未指定 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.ParameterError_NotValid_Collection(System.Object)"> | ||||
|             <summary> | ||||
|             {property} 参数错误,它不是集合属性,必须为 IList<T> 或者 ICollection<T> | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.ParameterError_NotValid_Navigation(System.Object)"> | ||||
|             <summary> | ||||
|             {property} 参数错误,它不是有效的导航属性 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.ParameterError_NotValid_PropertyName(System.Object,System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             {where} 参数错误,{keyval} 不是有效的属性名,在实体类 {reftbTypeDisplayCsharp} 无法找到 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.ParameterError_NotValid_UseCommas(System.Object)"> | ||||
|             <summary> | ||||
|             {property} 参数错误,格式 "TopicId=Id,多组使用逗号连接"  | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Parsing_Failed(System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             解析失败 {callExpMethodName} {message} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Policy_ObjectPool_Dispose(System.Object)"> | ||||
|             <summary> | ||||
|             【{policyName}】The ObjectPool has been disposed, see: https://github.com/dotnetcore/FreeSql/discussions/1079 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Policy_Status_NotAvailable(System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             【{policyName}】状态不可用,等待后台检查程序恢复方可使用。{UnavailableExceptionMessage} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Properties_AsRowLock_Must_Numeric_Byte(System.Object)"> | ||||
|             <summary> | ||||
|             属性{trytbVersionColumnCsName} 被标注为行锁(乐观锁)(IsVersion),但其必须为数字类型 或者 byte[],并且不可为 Nullable | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.CoreStrings.Properties_Cannot_Null"> | ||||
|             <summary> | ||||
|             properties 参数不能为空 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Property_Cannot_Find(System.Object)"> | ||||
|             <summary> | ||||
|             {property} 属性名无法找到 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.CoreStrings.Range_Comma_Separateda_By2Char"> | ||||
|             <summary> | ||||
|             Range 要求 Value 应该逗号分割,并且长度为 2 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.CoreStrings.RollBack"> | ||||
|             <summary> | ||||
|             回滚 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.CoreStrings.RunTimeError_Reflection_IncludeMany"> | ||||
|             <summary> | ||||
|             运行时错误,反射获取 IncludeMany 方法失败 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Set_Column_IsNullable_False(System.Object)"> | ||||
|             <summary> | ||||
|             {qoteSql} is NULL,除非设置特性 [Column(IsNullable = false)] | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.SubTableFieldValue_CannotLessThen(System.Object,System.Object)"> | ||||
|             <summary> | ||||
|             分表字段值 "{dt}" 不能小于 "{beginTime} " | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.CoreStrings.SubTableFieldValue_IsNotNull"> | ||||
|             <summary> | ||||
|             分表字段值不能为 null | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.SubTableFieldValue_NotConvertDateTime(System.Object)"> | ||||
|             <summary> | ||||
|             分表字段值 "{columnValue}" 不能转化成 DateTime | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.SubTableFieldValue_NotMatchTable(System.Object)"> | ||||
|             <summary> | ||||
|             分表字段值 "{dt}" 未匹配到分表名 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.CoreStrings.T2_Type_Error"> | ||||
|             <summary> | ||||
|             T2 类型错误 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.TableName_Format_Error(System.Object)"> | ||||
|             <summary> | ||||
|             tableName 格式错误,示例:“log_{yyyyMMdd}” | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Type_AsType_Parameter_Error(System.Object)"> | ||||
|             <summary> | ||||
|             {Type}.AsType 参数错误,请传入正确的实体类型 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Type_Cannot_Access_Constructor(System.Object)"> | ||||
|             <summary> | ||||
|             {thatFullName} 类型无法访问构造函数 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Type_Error_Name(System.Object)"> | ||||
|             <summary> | ||||
|             {name} 类型错误 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.TypeAsType_NotSupport_Object(System.Object)"> | ||||
|             <summary> | ||||
|             {Type}.AsType 参数不支持指定为 object | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.TypeError_CannotUse_IncludeMany(System.Object)"> | ||||
|             <summary> | ||||
|             类型 {typeofFullName} 错误,不能使用 IncludeMany | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Unable_Parse_Expression(System.Object)"> | ||||
|             <summary> | ||||
|             无法解析表达式:{exp} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSql.CoreStrings.Unable_Parse_ExpressionMethod(System.Object)"> | ||||
|             <summary> | ||||
|             无法解析表达式方法 {exp3tmpCallMethodName} | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="P:FreeSql.CoreStrings.Use_InsertDict_Method"> | ||||
|             <summary> | ||||
|             请使用 fsql.InsertDict(dict) 方法插入字典数据 | ||||
|             </summary> | ||||
|         </member> | ||||
|         <member name="M:FreeSqlGlobalExpressionCallExtensions.Between(System.DateTime,System.DateTime,System.DateTime)"> | ||||
|             <summary> | ||||
|             C#: that >= between && that <= and<para></para> | ||||
|   | ||||
| @@ -39,7 +39,7 @@ namespace FreeSql | ||||
|         /// <returns></returns> | ||||
|         public FreeSqlBuilder UseConnectionString(DataType dataType, string connectionString, Type providerType = null) | ||||
|         { | ||||
|             if (_connectionFactory != null) throw new Exception("已经指定了 UseConnectionFactory,不能再指定 UseConnectionString"); | ||||
|             if (_connectionFactory != null) throw new Exception(CoreStrings.Has_Specified_Cannot_Specified_Second("UseConnectionFactory", "UseConnectionString")); | ||||
|             _dataType = dataType; | ||||
|             _masterConnectionString = connectionString; | ||||
|             _providerType = providerType; | ||||
| @@ -52,13 +52,13 @@ namespace FreeSql | ||||
|         /// <returns></returns> | ||||
|         public FreeSqlBuilder UseSlave(params string[] slaveConnectionString) | ||||
|         { | ||||
|             if (_connectionFactory != null) throw new Exception("已经指定了 UseConnectionFactory,不能再指定 UseSlave"); | ||||
|             if (_connectionFactory != null) throw new Exception(CoreStrings.Has_Specified_Cannot_Specified_Second("UseConnectionFactory", "UseSlave")); | ||||
|             _slaveConnectionString = slaveConnectionString; | ||||
|             return this; | ||||
|         } | ||||
|         public FreeSqlBuilder UseSlaveWeight(params int[] slaveWeights) | ||||
|         { | ||||
|             if (_slaveConnectionString?.Length != slaveWeights.Length) throw new Exception("SlaveConnectionString 数量与 SlaveWeights 不相同"); | ||||
|             if (_slaveConnectionString?.Length != slaveWeights.Length) throw new Exception(CoreStrings.Different_Number_SlaveConnectionString_SlaveWeights); | ||||
|             _slaveWeights = slaveWeights; | ||||
|             return this; | ||||
|         } | ||||
| @@ -71,8 +71,8 @@ namespace FreeSql | ||||
|         /// <returns></returns> | ||||
|         public FreeSqlBuilder UseConnectionFactory(DataType dataType, Func<DbConnection> connectionFactory, Type providerType = null) | ||||
|         { | ||||
|             if (string.IsNullOrEmpty(_masterConnectionString) == false) throw new Exception("已经指定了 UseConnectionString,不能再指定 UseConnectionFactory"); | ||||
|             if (_slaveConnectionString?.Any() == true) throw new Exception("已经指定了 UseSlave,不能再指定 UseConnectionFactory"); | ||||
|             if (string.IsNullOrEmpty(_masterConnectionString) == false) throw new Exception(CoreStrings.Has_Specified_Cannot_Specified_Second("UseConnectionString", "UseConnectionFactory")); | ||||
|             if (_slaveConnectionString?.Any() == true) throw new Exception(CoreStrings.Has_Specified_Cannot_Specified_Second("UseSlave", "UseConnectionFactory")); | ||||
|             _dataType = dataType; | ||||
|             _connectionFactory = connectionFactory; | ||||
|             _providerType = providerType; | ||||
| @@ -175,7 +175,7 @@ namespace FreeSql | ||||
|         public IFreeSql Build() => Build<IFreeSql>(); | ||||
|         public IFreeSql<TMark> Build<TMark>() | ||||
|         { | ||||
|             if (string.IsNullOrEmpty(_masterConnectionString) && _connectionFactory == null) throw new Exception("参数 masterConnectionString 不可为空,请检查 UseConnectionString"); | ||||
|             if (string.IsNullOrEmpty(_masterConnectionString) && _connectionFactory == null) throw new Exception(CoreStrings.Check_UseConnectionString); | ||||
|             IFreeSql<TMark> ret = null; | ||||
|             var type = _providerType; | ||||
|             if (type != null) | ||||
| @@ -185,7 +185,7 @@ namespace FreeSql | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 Action<string, string> throwNotFind = (dll, providerType) => throw new Exception($"缺少 FreeSql 数据库实现包:{dll},可前往 nuget 下载;如果存在 {dll} 依然报错(原因是环境问题导致反射不到类型),请在 UseConnectionString/UseConnectionFactory 第三个参数手工传入 typeof({providerType})"); | ||||
|                 Action<string, string> throwNotFind = (dll, providerType) => throw new Exception(CoreStrings.Missing_FreeSqlProvider_Package_Reason(dll, providerType)); | ||||
|                 switch (_dataType) | ||||
|                 { | ||||
|                     case DataType.MySql: | ||||
| @@ -283,7 +283,7 @@ namespace FreeSql | ||||
|                         if (type == null) throwNotFind("FreeSql.Provider.GBase.dll", "FreeSql.GBase.GBaseProvider<>"); | ||||
|                         break; | ||||
|  | ||||
|                     default: throw new Exception("未指定 UseConnectionString 或者 UseConnectionFactory"); | ||||
|                     default: throw new Exception(CoreStrings.NotSpecified_UseConnectionString_UseConnectionFactory); | ||||
|                 } | ||||
|             } | ||||
|             ret = Activator.CreateInstance(type, new object[] { _masterConnectionString, _slaveConnectionString, _connectionFactory }) as IFreeSql<TMark>; | ||||
|   | ||||
| @@ -135,7 +135,8 @@ namespace FreeSql.Internal | ||||
|                             if (index >= 0) field.Append(_common.FieldAsAlias($"as{++index}")); | ||||
|                             parent.Childs.Add(child); | ||||
|                         } | ||||
|                         if (_tables.Count > 1) { //如果下级导航属性被 Include 过,则将他们也查询出来 | ||||
|                         if (_tables.Count > 1) | ||||
|                         { //如果下级导航属性被 Include 过,则将他们也查询出来 | ||||
|                             foreach (var memProp in tb.Properties.Values) | ||||
|                             { | ||||
|                                 var memtbref = tb.GetTableRef(memProp.Name, false); | ||||
| @@ -162,8 +163,8 @@ namespace FreeSql.Internal | ||||
|                     } | ||||
|                     else | ||||
|                     { | ||||
|                         if (select != null && findIncludeMany != null && select._includeToList.Any() && exp.Type.IsGenericType &&  | ||||
|                             typeof(IEnumerable).IsAssignableFrom(exp.Type) &&  | ||||
|                         if (select != null && findIncludeMany != null && select._includeToList.Any() && exp.Type.IsGenericType && | ||||
|                             typeof(IEnumerable).IsAssignableFrom(exp.Type) && | ||||
|                             typeof(ICollection<>).MakeGenericType(exp.Type.GetGenericArguments().FirstOrDefault()).IsAssignableFrom(exp.Type)) | ||||
|                         { | ||||
|                             var includeKey = ""; | ||||
| @@ -285,7 +286,7 @@ namespace FreeSql.Internal | ||||
|                             ReadAnonymousField(_tables, field, child, ref index, initAssignExp.Expression, select, diymemexp, whereGlobalFilter, findIncludeMany, false); | ||||
|                         } | ||||
|                     } | ||||
|                     if (parent.Childs.Any() == false) throw new Exception($"映射异常:{initExp.NewExpression.Type.Name} 没有一个属性名相同"); | ||||
|                     if (parent.Childs.Any() == false) throw new Exception(CoreStrings.Mapping_Exception_HasNo_SamePropertyName(initExp.NewExpression.Type.Name)); | ||||
|                     return true; | ||||
|                 case ExpressionType.New: | ||||
|                     var newExp = exp as NewExpression; | ||||
| @@ -350,7 +351,7 @@ namespace FreeSql.Internal | ||||
|                             } | ||||
|                         } | ||||
|                     } | ||||
|                     if (parent.Childs.Any() == false) throw new Exception($"映射异常:{newExp.Type.Name} 没有一个属性名相同"); | ||||
|                     if (parent.Childs.Any() == false) throw new Exception(CoreStrings.Mapping_Exception_HasNo_SamePropertyName(newExp.Type.Name)); | ||||
|                     return true; | ||||
|             } | ||||
|             parent.DbField = $"({ExpressionLambdaToSql(exp, getTSC())})"; | ||||
| @@ -367,13 +368,13 @@ namespace FreeSql.Internal | ||||
|                 if (notRead) | ||||
|                 { | ||||
|                     ++index; | ||||
|                     if (parent.Property != null)  | ||||
|                     if (parent.Property != null) | ||||
|                         return Utils.GetDataReaderValue(parent.Property.PropertyType, null); | ||||
|                     return Utils.GetDataReaderValue(parent.CsType, null); | ||||
|                 } | ||||
|                 object objval = Utils.InternalDataReaderGetValue(_common, dr, ++index); // dr.GetValue(++index); | ||||
|                 if (dbValue != null) dbValue.DbValue = objval == DBNull.Value ? null : objval; | ||||
|                 if (parent.CsType != parent.MapType)  | ||||
|                 if (parent.CsType != parent.MapType) | ||||
|                     objval = Utils.GetDataReaderValue(parent.MapType, objval); | ||||
|                 objval = Utils.GetDataReaderValue(parent.CsType, objval); | ||||
|                 if (parent.Property != null && parent.CsType != parent.Property.PropertyType) | ||||
| @@ -468,7 +469,7 @@ namespace FreeSql.Internal | ||||
|                     var newArrMembers = new List<string>(); | ||||
|                     foreach (var newArrExp in newArr.Expressions) newArrMembers.AddRange(ExpressionSelectColumns_MemberAccess_New_NewArrayInit(_tables, newArrExp, isQuoteName, diymemexp)); | ||||
|                     return newArrMembers.Distinct().Select(a => a.Trim('\'')).ToArray(); | ||||
|                 default: throw new ArgumentException($"无法解析表达式:{exp}"); | ||||
|                 default: throw new ArgumentException(CoreStrings.Unable_Parse_Expression(exp)); | ||||
|             } | ||||
|             return new string[0]; | ||||
|         } | ||||
| @@ -623,9 +624,9 @@ namespace FreeSql.Internal | ||||
|             ColumnInfo rightMapColumn = null; | ||||
|             var isRightMapType = false; | ||||
|             if (isLeftMapType) oldMapType = tsc.SetMapTypeReturnOld(leftMapColumn.Attribute.MapType); | ||||
|              | ||||
|  | ||||
|             var right = ExpressionLambdaToSql(rightExp, tsc); | ||||
|             if (right != "NULL" && isLeftMapType &&  | ||||
|             if (right != "NULL" && isLeftMapType && | ||||
|                 //判断参数化后的bug | ||||
|                 !(right.Contains('@') || right.Contains('?') || right.Contains(':')) && | ||||
|                 //三元表达式后,取消此条件 #184 | ||||
| @@ -787,12 +788,13 @@ namespace FreeSql.Internal | ||||
|                         exp3.Method.GetCustomAttributes(typeof(ExpressionCallAttribute), true).Any() | ||||
|                         )) | ||||
|                     { | ||||
|                         var ecc = new ExpressionCallContext {  | ||||
|                             _commonExp = this,  | ||||
|                             _tsc = tsc,  | ||||
|                             DataType = _ado.DataType,  | ||||
|                             UserParameters = tsc.dbParams == null ? null : new List<DbParameter>(),  | ||||
|                             FormatSql = obj => formatSql(obj, null, null, null)  | ||||
|                         var ecc = new ExpressionCallContext | ||||
|                         { | ||||
|                             _commonExp = this, | ||||
|                             _tsc = tsc, | ||||
|                             DataType = _ado.DataType, | ||||
|                             UserParameters = tsc.dbParams == null ? null : new List<DbParameter>(), | ||||
|                             FormatSql = obj => formatSql(obj, null, null, null) | ||||
|                         }; | ||||
|                         var exp3MethodParams = exp3.Method.GetParameters(); | ||||
|                         var dbParamsIndex = tsc.dbParams?.Count; | ||||
| @@ -852,10 +854,10 @@ namespace FreeSql.Internal | ||||
|                             else | ||||
|                                 exp3InvokeParams[a] = ecc; | ||||
|                         } | ||||
|                         var eccFields = _dicTypeExpressionCallClassContextFields.GetOrAdd(exp3.Method.DeclaringType, dttp =>  | ||||
|                         var eccFields = _dicTypeExpressionCallClassContextFields.GetOrAdd(exp3.Method.DeclaringType, dttp => | ||||
|                             dttp.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.Static).Where(a => a.FieldType == typeof(ThreadLocal<ExpressionCallContext>)).ToArray()); | ||||
|                         if (eccFields.Any() == false) | ||||
|                             throw new Exception($"自定义表达式解析错误:类型 {exp3.Method.DeclaringType} 需要定义 static ThreadLocal<ExpressionCallContext> 字段、字段、字段(重要三次提醒)"); | ||||
|                             throw new Exception(CoreStrings.Custom_Expression_ParsingError(exp3.Method.DeclaringType)); | ||||
|                         foreach (var eccField in eccFields) | ||||
|                             typeof(ThreadLocal<ExpressionCallContext>).GetProperty("Value").SetValue(eccField.GetValue(null), ecc, null); | ||||
|                         try | ||||
| @@ -999,7 +1001,7 @@ namespace FreeSql.Internal | ||||
|                                                 fsql = Expression.Lambda(exp3tmpTestCall).Compile().DynamicInvoke(); | ||||
|                                                 var fsqlFindMethod = fsql.GetType().GetMethod(exp3tmpCall.Method.Name, exp3tmpCall.Arguments.Select(a => a.Type).ToArray()); | ||||
|                                                 if (fsqlFindMethod == null) | ||||
|                                                     throw new Exception($"无法解析表达式方法 {exp3tmpCall.Method.Name}"); | ||||
|                                                     throw new Exception(CoreStrings.Unable_Parse_ExpressionMethod(exp3tmpCall.Method.Name)); | ||||
|                                                 var exp3StackOld = exp3Stack; | ||||
|                                                 exp3Stack = new Stack<Expression>(); | ||||
|                                                 exp3Stack.Push(Expression.Call(Expression.Constant(fsql), fsqlFindMethod, exp3tmpCall.Arguments)); | ||||
| @@ -1010,7 +1012,8 @@ namespace FreeSql.Internal | ||||
|                                         fsqlType = fsql?.GetType(); | ||||
|                                         if (fsqlType == null) break; | ||||
|                                         var fsqlSelect0 = fsql as Select0Provider; | ||||
|                                         switch (exp3.Method.Name) { | ||||
|                                         switch (exp3.Method.Name) | ||||
|                                         { | ||||
|                                             case "Any": //exists | ||||
|                                                 switch (_ado.DataType) | ||||
|                                                 { | ||||
| @@ -1035,7 +1038,7 @@ namespace FreeSql.Internal | ||||
|                                         //fsqltables[0].Alias = $"{tsc._tables[0].Alias}_{fsqltables[0].Alias}"; | ||||
|                                         if (fsqltables != tsc._tables) | ||||
|                                         { | ||||
|                                             if (tsc._tables == null && tsc.diymemexp == null) throw new NotSupportedException($"这个特别的子查询不能解析"); //2020-12-11 IUpdate 条件不支持子查询 | ||||
|                                             if (tsc._tables == null && tsc.diymemexp == null) throw new NotSupportedException(CoreStrings.EspeciallySubquery_Cannot_Parsing); //2020-12-11 IUpdate 条件不支持子查询 | ||||
|                                             if (tsc._tables != null) //groupby is null | ||||
|                                             { | ||||
|                                                 fsqltables.AddRange(tsc._tables.Select(a => new SelectTableInfo | ||||
| @@ -1230,7 +1233,7 @@ namespace FreeSql.Internal | ||||
|                                                         var exp3Args0 = (exp3.Arguments[0] as UnaryExpression)?.Operand as LambdaExpression; | ||||
|                                                         manySubSelectAggMethod = _dicSelectMethodToSql.GetOrAdd(fsqlType, fsqlType2 => | ||||
|                                                             fsqlType2.GetMethods().Where(a => a.Name == "ToSql" && a.GetParameters().Length == 2 && a.GetParameters()[1].ParameterType == typeof(FieldAliasOptions) && a.GetGenericArguments().Length == 1).FirstOrDefault()); | ||||
|                                                         if (manySubSelectAggMethod == null || exp3Args0 == null) throw new ArgumentException($"ManyToMany 导航属性 .AsSelect() 暂时不可用于 Sum/Avg/Max/Min/First/ToOne/ToList 方法"); | ||||
|                                                         if (manySubSelectAggMethod == null || exp3Args0 == null) throw new ArgumentException(CoreStrings.ManyToMany_AsSelect_NotSupport_Sum_Avg_etc); | ||||
|                                                         manySubSelectAggMethod = manySubSelectAggMethod.MakeGenericMethod(exp3Args0.ReturnType); | ||||
|                                                         var fsqls0p = fsql as Select0Provider; | ||||
|                                                         var fsqls0pWhere = fsqls0p._where.ToString(); | ||||
| @@ -1358,8 +1361,8 @@ namespace FreeSql.Internal | ||||
|                     other3Exp = ExpressionLambdaToSqlOther(exp3, tsc); | ||||
|                     if (string.IsNullOrEmpty(other3Exp) == false) return other3Exp; | ||||
|                     if (exp3.IsParameter() == false) return formatSql(Expression.Lambda(exp3).Compile().DynamicInvoke(), tsc.mapType, tsc.mapColumnTmp, tsc.dbParams); | ||||
|                     if (exp3.Method.DeclaringType == typeof(Enumerable)) throw new Exception($"未实现函数表达式 {exp3} 解析。如果正在操作导航属性集合,请使用 .AsSelect().{exp3.Method.Name}({(exp3.Arguments.Count > 1 ? "..." : "")})"); | ||||
|                     throw new Exception($"未实现函数表达式 {exp3} 解析"); | ||||
|                     if (exp3.Method.DeclaringType == typeof(Enumerable)) throw new Exception(CoreStrings.Not_Implemented_Expression_UseAsSelect(exp3, exp3.Method.Name, (exp3.Arguments.Count > 1 ? "..." : ""))); | ||||
|                     throw new Exception(CoreStrings.Not_Implemented_Expression(exp3)); | ||||
|                 case ExpressionType.Parameter: | ||||
|                 case ExpressionType.MemberAccess: | ||||
|                     var exp4 = exp as MemberExpression; | ||||
| @@ -1434,7 +1437,7 @@ namespace FreeSql.Internal | ||||
|                                     break; | ||||
|                                 case ExpressionType.MemberAccess: | ||||
|                                     var expStackFirstMem = expStack.First() as MemberExpression; | ||||
|                                     if (expStackFirstMem.Expression?.NodeType == ExpressionType.Constant)  | ||||
|                                     if (expStackFirstMem.Expression?.NodeType == ExpressionType.Constant) | ||||
|                                         firstValue = (expStackFirstMem.Expression as ConstantExpression)?.Value; | ||||
|                                     else | ||||
|                                         return formatSql(Expression.Lambda(exp).Compile().DynamicInvoke(), tsc.mapType, tsc.mapColumnTmp, tsc.dbParams); | ||||
| @@ -1479,8 +1482,8 @@ namespace FreeSql.Internal | ||||
|                         if (tb.ColumnsByCs.ContainsKey(memberExp.Member.Name) == false) | ||||
|                         { | ||||
|                             if (tb.ColumnsByCsIgnore.ContainsKey(memberExp.Member.Name)) | ||||
|                                 throw new ArgumentException($"{tb.DbName}.{memberExp.Member.Name} 被忽略,请检查 IsIgnore 设置,确认 get/set 为 public"); | ||||
|                             throw new ArgumentException($"{tb.DbName} 找不到列 {memberExp.Member.Name}"); | ||||
|                                 throw new ArgumentException(CoreStrings.Ignored_Check_Confirm_PublicGetSet(tb.DbName, memberExp.Member.Name)); | ||||
|                             throw new ArgumentException(CoreStrings.NotFound_Column(tb.DbName, memberExp.Member.Name)); | ||||
|                         } | ||||
|                         var curcol = tb.ColumnsByCs[memberExp.Member.Name]; | ||||
|                         if (tsc._selectColumnMap != null) | ||||
| @@ -1497,7 +1500,7 @@ namespace FreeSql.Internal | ||||
|                         if (tsc.style == ExpressionStyle.SelectColumns) | ||||
|                         { | ||||
|                             finds = tsc._tables.Where(a => a.Table.Type == tbtmp.Type && a.Alias == alias).ToArray(); | ||||
|                             if (finds.Any() == false && alias.Contains("__") == false)  | ||||
|                             if (finds.Any() == false && alias.Contains("__") == false) | ||||
|                                 finds = tsc._tables.Where(a => a.Table.Type == tbtmp.Type).ToArray(); | ||||
|                             if (finds.Any()) finds = new[] { finds.First() }; | ||||
|                         } | ||||
| @@ -1595,7 +1598,7 @@ namespace FreeSql.Internal | ||||
|                         switch (exp2.NodeType) | ||||
|                         { | ||||
|                             case ExpressionType.Constant: | ||||
|                                 throw new NotImplementedException("未实现 MemberAccess 下的 Constant"); | ||||
|                                 throw new NotImplementedException($"{CoreStrings.Not_Implemented_MemberAcess_Constant}"); | ||||
|                             case ExpressionType.Parameter: | ||||
|                             case ExpressionType.MemberAccess: | ||||
|  | ||||
| @@ -1666,10 +1669,10 @@ namespace FreeSql.Internal | ||||
|                                         } | ||||
|                                     } | ||||
|                                     if (tb2.ColumnsByCsIgnore.ContainsKey(mp2.Member.Name)) | ||||
|                                         throw new ArgumentException($"{tb2.DbName}.{mp2.Member.Name} 被忽略,请检查 IsIgnore 设置,确认 get/set 为 public"); | ||||
|                                         throw new ArgumentException(CoreStrings.Ignored_Check_Confirm_PublicGetSet(tb2.DbName, mp2.Member.Name)); | ||||
|                                     if (tb2.GetTableRef(mp2.Member.Name, false) != null) | ||||
|                                         throw new ArgumentException($"{tb2.DbName}.{mp2.Member.Name} 导航属性集合忘了 .AsSelect() 吗?如果在 ToList(a => a.{mp2.Member.Name}) 中使用,请移步参考 IncludeMany 文档。"); | ||||
|                                     throw new ArgumentException($"{tb2.DbName} 找不到列 {mp2.Member.Name}"); | ||||
|                                         throw new ArgumentException(CoreStrings.Navigation_Missing_AsSelect(tb2.DbName, mp2.Member.Name)); | ||||
|                                     throw new ArgumentException(CoreStrings.NotFound_Column(tb2.DbName, mp2.Member.Name)); | ||||
|                                 } | ||||
|                                 col2 = tb2.ColumnsByCs[mp2.Member.Name]; | ||||
|                                 if (tsc._selectColumnMap != null && find2 != null) | ||||
| @@ -1834,9 +1837,19 @@ namespace FreeSql.Internal | ||||
|                             new ReplaceParameterVisitor().Modify(fl.Where, newParameter), | ||||
|                             newParameter | ||||
|                         ); | ||||
|                         var whereSql = ExpressionLambdaToSql(expExp.Body, new ExpTSC { _tables =  | ||||
|                             isMultitb ? new List<SelectTableInfo>(new[] { tb }) : null,  | ||||
|                             _selectColumnMap = null, diymemexp = null, tbtype = SelectTableInfoType.From, isQuoteName = true, isDisableDiyParse = false, style = ExpressionStyle.Where, currentTable = tb.Table, alias001 = tb.Alias }); | ||||
|                         var whereSql = ExpressionLambdaToSql(expExp.Body, new ExpTSC | ||||
|                         { | ||||
|                             _tables = | ||||
|                             isMultitb ? new List<SelectTableInfo>(new[] { tb }) : null, | ||||
|                             _selectColumnMap = null, | ||||
|                             diymemexp = null, | ||||
|                             tbtype = SelectTableInfoType.From, | ||||
|                             isQuoteName = true, | ||||
|                             isDisableDiyParse = false, | ||||
|                             style = ExpressionStyle.Where, | ||||
|                             currentTable = tb.Table, | ||||
|                             alias001 = tb.Alias | ||||
|                         }); | ||||
|                         whereSql = GetBoolString(expExp.Body, whereSql); | ||||
|                         if (isEmpty == false) | ||||
|                             sb.Append(" AND "); | ||||
| @@ -2121,7 +2134,7 @@ namespace FreeSql.Internal | ||||
|                                 e.Result = $"({select.ToSql().Replace(" \r\n", " \r\n    ")})"; | ||||
|                                 return; | ||||
|                             } | ||||
|                             throw throwCallExp(" 不支持"); | ||||
|                             throw throwCallExp(CoreStrings.Not_Support); | ||||
|                         case "ToList": | ||||
|                             if (callExp.Arguments.Count == 1) | ||||
|                             { | ||||
| @@ -2130,7 +2143,7 @@ namespace FreeSql.Internal | ||||
|                                 e.Result = $"({select.ToSql().Replace(" \r\n", " \r\n    ")})"; | ||||
|                                 return; | ||||
|                             } | ||||
|                             throw throwCallExp(" 不支持"); | ||||
|                             throw throwCallExp(CoreStrings.Not_Support); | ||||
|                         case "Contains": | ||||
|                             if (callExp.Arguments.Count == 2) | ||||
|                             { | ||||
| @@ -2148,7 +2161,7 @@ namespace FreeSql.Internal | ||||
|                                 select.Distinct(); | ||||
|                                 break; | ||||
|                             } | ||||
|                             throw throwCallExp(" 不支持"); | ||||
|                             throw throwCallExp(CoreStrings.Not_Support); | ||||
|                         case "OrderBy": | ||||
|                             select._tables[0].Parameter = (callExp.Arguments[1] as LambdaExpression)?.Parameters.FirstOrDefault(); | ||||
|                             LocalSetSelectProviderAlias(select._tables[0].Parameter.Name); | ||||
| @@ -2179,7 +2192,7 @@ namespace FreeSql.Internal | ||||
|                                 select.InternalWhere(whereParam); | ||||
|                                 break; | ||||
|                             } | ||||
|                             throw throwCallExp(" 不支持"); | ||||
|                             throw throwCallExp(CoreStrings.Not_Support); | ||||
|  | ||||
|                         case "Skip": | ||||
|                             select.Offset((int)callExp.Arguments[1].GetConstExprValue()); | ||||
| @@ -2197,9 +2210,9 @@ namespace FreeSql.Internal | ||||
|                                 select._selectExpression = selectParam; | ||||
|                                 break; | ||||
|                             } | ||||
|                             throw throwCallExp(" 不支持"); | ||||
|                             throw throwCallExp(CoreStrings.Not_Support); | ||||
|                     } | ||||
|                     Exception throwCallExp(string message) => new Exception($"解析失败 {callExp.Method.Name} {message}"); | ||||
|                     Exception throwCallExp(string message) => new Exception(CoreStrings.Parsing_Failed(callExp.Method.Name,message)); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|   | ||||
| @@ -2,7 +2,6 @@ | ||||
| using FreeSql.Internal.ObjectPool; | ||||
| using System; | ||||
| using System.Collections; | ||||
| using System.Collections.Concurrent; | ||||
| using System.Collections.Generic; | ||||
| using System.Data; | ||||
| using System.Data.Common; | ||||
| @@ -631,7 +630,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|                             ReturnConnection(pool, conn, ex); //pool.Return(conn, ex); | ||||
|                             if (IsTracePerformance) logtxt.Append("Pool.Return: ").Append(DateTime.Now.Subtract(logtxt_dt).TotalMilliseconds).Append("ms Total: ").Append(DateTime.Now.Subtract(dt).TotalMilliseconds).Append("ms"); | ||||
|                         } | ||||
|                         LoggerException(pool, pc, new Exception($"连接失败,准备切换其他可用服务器"), dt, logtxt, false); | ||||
|                         LoggerException(pool, pc, new Exception(CoreStrings.Connection_Failed_Switch_Servers), dt, logtxt, false); | ||||
|                         pc.cmd.Parameters.Clear(); | ||||
|                         if (DataType == DataType.Sqlite) pc.cmd.Dispose(); | ||||
|                         ExecuteReaderMultiple(multipleResult, connection, transaction, fetchHandler, schemaHandler, cmdType, cmdText, cmdTimeout, cmdParms); | ||||
|   | ||||
| @@ -537,7 +537,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|                             ReturnConnection(pool, conn, ex); //pool.Return(conn, ex); | ||||
|                             if (IsTracePerformance) logtxt.Append("Pool.Return: ").Append(DateTime.Now.Subtract(logtxt_dt).TotalMilliseconds).Append("ms Total: ").Append(DateTime.Now.Subtract(dt).TotalMilliseconds).Append("ms"); | ||||
|                         } | ||||
|                         LoggerException(pool, pc, new Exception($"连接失败,准备切换其他可用服务器"), dt, logtxt, false); | ||||
|                         LoggerException(pool, pc, new Exception(CoreStrings.Connection_Failed_Switch_Servers), dt, logtxt, false); | ||||
|                         pc.cmd.Parameters.Clear(); | ||||
|                         if (DataType == DataType.Sqlite) pc.cmd.Dispose(); | ||||
|                         await ExecuteReaderMultipleAsync(multipleResult, connection, transaction, fetchHandler, schemaHandler, cmdType, cmdText, cmdTimeout, cmdParms, cancellationToken); | ||||
|   | ||||
| @@ -78,7 +78,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|             _trans.TryRemove(tran.Connection.LastGetThreadId, out var oldtran); | ||||
|  | ||||
|             Exception ex = null; | ||||
|             if (string.IsNullOrEmpty(remark)) remark = isCommit ? "提交" : "回滚"; | ||||
|             if (string.IsNullOrEmpty(remark)) remark = isCommit ? CoreStrings.Commit : CoreStrings.RollBack; | ||||
|             try | ||||
|             { | ||||
|                 if (tran.Transaction.Connection != null) //用户自行 Commit、Rollback | ||||
|   | ||||
| @@ -18,23 +18,23 @@ namespace FreeSql.Internal.CommonProvider | ||||
|         public IInsert<T1> Insert<T1>() where T1 : class => CreateInsertProvider<T1>(); | ||||
|         public IInsert<T1> Insert<T1>(T1 source) where T1 : class | ||||
|         { | ||||
|             if (typeof(T1) == typeof(Dictionary<string, object>)) throw new Exception("请使用 fsql.InsertDict(dict) 方法插入字典数据"); | ||||
|             if (typeof(T1) == typeof(Dictionary<string, object>)) throw new Exception(CoreStrings.Use_InsertDict_Method); | ||||
|             return this.Insert<T1>().AppendData(source); | ||||
|         } | ||||
|         public IInsert<T1> Insert<T1>(T1[] source) where T1 : class | ||||
|         { | ||||
|             if (typeof(T1) == typeof(Dictionary<string, object>)) throw new Exception("请使用 fsql.InsertDict(dict) 方法插入字典数据"); | ||||
|             if (typeof(T1) == typeof(Dictionary<string, object>)) throw new Exception(CoreStrings.Use_InsertDict_Method); | ||||
|             return this.Insert<T1>().AppendData(source); | ||||
|         } | ||||
|         public IInsert<T1> Insert<T1>(List<T1> source) where T1 : class | ||||
|         { | ||||
|  | ||||
|             if (typeof(T1) == typeof(Dictionary<string, object>)) throw new Exception("请使用 fsql.InsertDict(dict) 方法插入字典数据"); | ||||
|             if (typeof(T1) == typeof(Dictionary<string, object>)) throw new Exception(CoreStrings.Use_InsertDict_Method); | ||||
|             return this.Insert<T1>().AppendData(source); | ||||
|         } | ||||
|         public IInsert<T1> Insert<T1>(IEnumerable<T1> source) where T1 : class | ||||
|         { | ||||
|             if (typeof(T1) == typeof(Dictionary<string, object>)) throw new Exception("请使用 fsql.InsertDict(dict) 方法插入字典数据"); | ||||
|             if (typeof(T1) == typeof(Dictionary<string, object>)) throw new Exception(CoreStrings.Use_InsertDict_Method); | ||||
|             return this.Insert<T1>().AppendData(source); | ||||
|         } | ||||
|         public IUpdate<T1> Update<T1>() where T1 : class => CreateUpdateProvider<T1>(null); | ||||
|   | ||||
| @@ -160,10 +160,10 @@ namespace FreeSql.Internal.CommonProvider | ||||
|         } | ||||
|         public IDelete<T1> AsType(Type entityType) | ||||
|         { | ||||
|             if (entityType == typeof(object)) throw new Exception("IDelete.AsType 参数不支持指定为 object"); | ||||
|             if (entityType == typeof(object)) throw new Exception(CoreStrings.TypeAsType_NotSupport_Object("IDelete")); | ||||
|             if (entityType == _table.Type) return this; | ||||
|             var newtb = _commonUtils.GetTableByEntity(entityType); | ||||
|             _table = newtb ?? throw new Exception("IDelete.AsType 参数错误,请传入正确的实体类型"); | ||||
|             _table = newtb ?? throw new Exception(CoreStrings.Type_AsType_Parameter_Error("IDelete")); | ||||
|             if (_orm.CodeFirst.IsAutoSyncStructure) _orm.CodeFirst.SyncStructure(entityType); | ||||
|             return this; | ||||
|         } | ||||
|   | ||||
| @@ -38,7 +38,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|             _commonExpression = commonExpression; | ||||
|             _table = _commonUtils.GetTableByEntity(typeof(T1)); | ||||
|             if (_table == null && typeof(T1) != typeof(Dictionary<string, object>)) | ||||
|                 throw new Exception($"InsertOrUpdate<>的泛型参数 不支持 {typeof(T1)},请传递您的实体类"); | ||||
|                 throw new Exception(CoreStrings.InsertOrUpdate_NotSuport_Generic_UseEntity(typeof(T1))); | ||||
|             if (_orm.CodeFirst.IsAutoSyncStructure && typeof(T1) != typeof(object)) _orm.CodeFirst.SyncStructure<T1>(); | ||||
|             IdentityColumn = _table?.Primarys.Where(a => a.Attribute.IsIdentity).FirstOrDefault(); | ||||
|         } | ||||
| @@ -88,7 +88,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|         { | ||||
|             if (data == null || table == null) return; | ||||
|             if (typeof(T1) == typeof(object) && new[] { table.Type, table.TypeLazy }.Contains(data.GetType()) == false) | ||||
|                 throw new Exception($"操作的数据类型({data.GetType().DisplayCsharp()}) 与 AsType({table.Type.DisplayCsharp()}) 不一致,请检查。"); | ||||
|                 throw new Exception(CoreStrings.DataType_AsType_Inconsistent(data.GetType().DisplayCsharp(), table.Type.DisplayCsharp())); | ||||
|             if (orm.Aop.AuditValueHandler == null) return; | ||||
|             foreach (var col in table.Columns.Values) | ||||
|             { | ||||
| @@ -157,10 +157,10 @@ namespace FreeSql.Internal.CommonProvider | ||||
|         } | ||||
|         public IInsertOrUpdate<T1> AsType(Type entityType) | ||||
|         { | ||||
|             if (entityType == typeof(object)) throw new Exception("IInsertOrUpdate.AsType 参数不支持指定为 object"); | ||||
|             if (entityType == typeof(object)) throw new Exception(CoreStrings.TypeAsType_NotSupport_Object("IInsertOrUpdate")); | ||||
|             if (entityType == _table.Type) return this; | ||||
|             var newtb = _commonUtils.GetTableByEntity(entityType); | ||||
|             _table = newtb ?? throw new Exception("IInsertOrUpdate.AsType 参数错误,请传入正确的实体类型"); | ||||
|             _table = newtb ?? throw new Exception(CoreStrings.Type_AsType_Parameter_Error("IInsertOrUpdate")); | ||||
|             if (_orm.CodeFirst.IsAutoSyncStructure) _orm.CodeFirst.SyncStructure(entityType); | ||||
|             IdentityColumn = _table.Primarys.Where(a => a.Attribute.IsIdentity).FirstOrDefault(); | ||||
|             return this; | ||||
| @@ -267,7 +267,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|                     _SplitSourceByIdentityValueIsNullFlag = 1; | ||||
|                     foreach (var tmpsource in ss.Item1) | ||||
|                     { | ||||
|                         _source = tmpsource;  | ||||
|                         _source = tmpsource; | ||||
|                         affrows += this.RawExecuteAffrows(); | ||||
|                     } | ||||
|                     _SplitSourceByIdentityValueIsNullFlag = 2; | ||||
| @@ -299,12 +299,12 @@ namespace FreeSql.Internal.CommonProvider | ||||
|                                 affrows += this.RawExecuteAffrows(); | ||||
|                             } | ||||
|                             _transaction.Commit(); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "提交", null)); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.Commit, null)); | ||||
|                         } | ||||
|                         catch (Exception ex) | ||||
|                         { | ||||
|                             _transaction.Rollback(); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "回滚", ex)); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.RollBack, ex)); | ||||
|                             throw; | ||||
|                         } | ||||
|                         _transaction = null; | ||||
| @@ -417,12 +417,12 @@ namespace FreeSql.Internal.CommonProvider | ||||
|                                 affrows += await this.RawExecuteAffrowsAsync(cancellationToken); | ||||
|                             } | ||||
|                             _transaction.Commit(); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "提交", null)); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.Commit, null)); | ||||
|                         } | ||||
|                         catch (Exception ex) | ||||
|                         { | ||||
|                             _transaction.Rollback(); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "回滚", ex)); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.RollBack, ex)); | ||||
|                             throw; | ||||
|                         } | ||||
|                         _transaction = null; | ||||
|   | ||||
| @@ -161,7 +161,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|         { | ||||
|             if (data == null || table == null) return; | ||||
|             if (typeof(T1) == typeof(object) && new[] { table.Type, table.TypeLazy }.Contains(data.GetType()) == false) | ||||
|                 throw new Exception($"操作的数据类型({data.GetType().DisplayCsharp()}) 与 AsType({table.Type.DisplayCsharp()}) 不一致,请检查。"); | ||||
|                 throw new Exception(CoreStrings.DataType_AsType_Inconsistent(data.GetType().DisplayCsharp(), table.Type.DisplayCsharp())); | ||||
|             foreach (var col in table.Columns.Values) | ||||
|             { | ||||
|                 object val = col.GetValue(data); | ||||
| @@ -281,7 +281,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     if (_orm.Ado.MasterPool == null) throw new Exception("Ado.MasterPool 值为 null,该操作无法自启用事务,请显式传递【事务对象】解决"); | ||||
|                     if (_orm.Ado.MasterPool == null) throw new Exception(CoreStrings.MasterPool_IsNull_UseTransaction); | ||||
|                     using (var conn = _orm.Ado.MasterPool.Get()) | ||||
|                     { | ||||
|                         _transaction = conn.Value.BeginTransaction(); | ||||
| @@ -296,12 +296,12 @@ namespace FreeSql.Internal.CommonProvider | ||||
|                                 ret += this.RawExecuteAffrows(); | ||||
|                             } | ||||
|                             _transaction.Commit(); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "提交", null)); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.Commit, null)); | ||||
|                         } | ||||
|                         catch (Exception ex) | ||||
|                         { | ||||
|                             _transaction.Rollback(); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "回滚", ex)); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.RollBack, ex)); | ||||
|                             throw; | ||||
|                         } | ||||
|                         _transaction = null; | ||||
| @@ -361,7 +361,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     if (_orm.Ado.MasterPool == null) throw new Exception("Ado.MasterPool 值为 null,该操作无法自启用事务,请显式传递【事务对象】解决"); | ||||
|                     if (_orm.Ado.MasterPool == null) throw new Exception(CoreStrings.MasterPool_IsNull_UseTransaction); | ||||
|                     using (var conn = _orm.Ado.MasterPool.Get()) | ||||
|                     { | ||||
|                         _transaction = conn.Value.BeginTransaction(); | ||||
| @@ -377,12 +377,12 @@ namespace FreeSql.Internal.CommonProvider | ||||
|                                 else ret = this.RawExecuteIdentity(); | ||||
|                             } | ||||
|                             _transaction.Commit(); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "提交", null)); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.Commit, null)); | ||||
|                         } | ||||
|                         catch (Exception ex) | ||||
|                         { | ||||
|                             _transaction.Rollback(); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "回滚", ex)); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.RollBack, ex)); | ||||
|                             throw; | ||||
|                         } | ||||
|                         _transaction = null; | ||||
| @@ -441,7 +441,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     if (_orm.Ado.MasterPool == null) throw new Exception("Ado.MasterPool 值为 null,该操作无法自启用事务,请显式传递【事务对象】解决"); | ||||
|                     if (_orm.Ado.MasterPool == null) throw new Exception(CoreStrings.MasterPool_IsNull_UseTransaction); | ||||
|                     using (var conn = _orm.Ado.MasterPool.Get()) | ||||
|                     { | ||||
|                         _transaction = conn.Value.BeginTransaction(); | ||||
| @@ -456,12 +456,12 @@ namespace FreeSql.Internal.CommonProvider | ||||
|                                 ret.AddRange(this.RawExecuteInserted()); | ||||
|                             } | ||||
|                             _transaction.Commit(); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "提交", null)); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.Commit, null)); | ||||
|                         } | ||||
|                         catch (Exception ex) | ||||
|                         { | ||||
|                             _transaction.Rollback(); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "回滚", ex)); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.RollBack, ex)); | ||||
|                             throw; | ||||
|                         } | ||||
|                         _transaction = null; | ||||
| @@ -571,11 +571,11 @@ namespace FreeSql.Internal.CommonProvider | ||||
|         } | ||||
|         public IInsert<T1> AsType(Type entityType) | ||||
|         { | ||||
|             if (entityType == typeof(object)) throw new Exception("IInsert.AsType 参数不支持指定为 object"); | ||||
|             if (entityType == typeof(object)) throw new Exception(CoreStrings.TypeAsType_NotSupport_Object("IInsert")); | ||||
|             if (entityType == typeof(T1)) return this; | ||||
|             if (entityType == _table.Type) return this; | ||||
|             var newtb = _commonUtils.GetTableByEntity(entityType); | ||||
|             _table = newtb ?? throw new Exception("IInsert.AsType 参数错误,请传入正确的实体类型"); | ||||
|             _table = newtb ?? throw new Exception(CoreStrings.Type_AsType_Parameter_Error("IInsert")); | ||||
|             if (_orm.CodeFirst.IsAutoSyncStructure) _orm.CodeFirst.SyncStructure(entityType); | ||||
|             IgnoreCanInsert(); | ||||
|             return this; | ||||
|   | ||||
| @@ -55,7 +55,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     if (_orm.Ado.MasterPool == null) throw new Exception("Ado.MasterPool 值为 null,该操作无法自启用事务,请显式传递【事务对象】解决"); | ||||
|                     if (_orm.Ado.MasterPool == null) throw new Exception(CoreStrings.MasterPool_IsNull_UseTransaction); | ||||
|                     using (var conn = await _orm.Ado.MasterPool.GetAsync()) | ||||
|                     { | ||||
|                         _transaction = conn.Value.BeginTransaction(); | ||||
| @@ -70,12 +70,12 @@ namespace FreeSql.Internal.CommonProvider | ||||
|                                 ret += await this.RawExecuteAffrowsAsync(cancellationToken); | ||||
|                             } | ||||
|                             _transaction.Commit(); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "提交", null)); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.Commit, null)); | ||||
|                         } | ||||
|                         catch (Exception ex) | ||||
|                         { | ||||
|                             _transaction.Rollback(); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "回滚", ex)); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.RollBack, ex)); | ||||
|                             throw; | ||||
|                         } | ||||
|                         _transaction = null; | ||||
| @@ -135,7 +135,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     if (_orm.Ado.MasterPool == null) throw new Exception("Ado.MasterPool 值为 null,该操作无法自启用事务,请显式传递【事务对象】解决"); | ||||
|                     if (_orm.Ado.MasterPool == null) throw new Exception(CoreStrings.MasterPool_IsNull_UseTransaction); | ||||
|                     using (var conn = await _orm.Ado.MasterPool.GetAsync()) | ||||
|                     { | ||||
|                         _transaction = conn.Value.BeginTransaction(); | ||||
| @@ -151,12 +151,12 @@ namespace FreeSql.Internal.CommonProvider | ||||
|                                 else ret = await this.RawExecuteIdentityAsync(cancellationToken); | ||||
|                             } | ||||
|                             _transaction.Commit(); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "提交", null)); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.Commit, null)); | ||||
|                         } | ||||
|                         catch (Exception ex) | ||||
|                         { | ||||
|                             _transaction.Rollback(); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "回滚", ex)); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.RollBack, ex)); | ||||
|                             throw; | ||||
|                         } | ||||
|                         _transaction = null; | ||||
| @@ -215,7 +215,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     if (_orm.Ado.MasterPool == null) throw new Exception("Ado.MasterPool 值为 null,该操作无法自启用事务,请显式传递【事务对象】解决"); | ||||
|                     if (_orm.Ado.MasterPool == null) throw new Exception(CoreStrings.MasterPool_IsNull_UseTransaction); | ||||
|                     using (var conn = await _orm.Ado.MasterPool.GetAsync()) | ||||
|                     { | ||||
|                         _transaction = conn.Value.BeginTransaction(); | ||||
| @@ -230,12 +230,12 @@ namespace FreeSql.Internal.CommonProvider | ||||
|                                 ret.AddRange(await this.RawExecuteInsertedAsync(cancellationToken)); | ||||
|                             } | ||||
|                             _transaction.Commit(); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "提交", null)); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.Commit, null)); | ||||
|                         } | ||||
|                         catch (Exception ex) | ||||
|                         { | ||||
|                             _transaction.Rollback(); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "回滚", ex)); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.RollBack, ex)); | ||||
|                             throw; | ||||
|                         } | ||||
|                         _transaction = null; | ||||
|   | ||||
| @@ -144,7 +144,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|                         break; | ||||
|                     } | ||||
|                 } | ||||
|                 if (exp == null) throw new Exception($"无法匹配 {property}"); | ||||
|                 if (exp == null) throw new Exception(CoreStrings.Cannot_Match_Property(property)); | ||||
|             } | ||||
|             else | ||||
|             { | ||||
| @@ -160,7 +160,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|                 { | ||||
|                     var tmp1 = field[x]; | ||||
|                     if (_commonUtils.GetTableByEntity(currentType).Properties.TryGetValue(tmp1, out var prop) == false) | ||||
|                         throw new ArgumentException($"{currentType.DisplayCsharp()} 无法找到属性名 {tmp1}"); | ||||
|                         throw new ArgumentException($"{currentType.DisplayCsharp()} {CoreStrings.NotFound_PropertyName(tmp1)}"); | ||||
|                     currentType = prop.PropertyType; | ||||
|                     currentExp = Expression.MakeMemberAccess(currentExp, prop); | ||||
|                 } | ||||
| @@ -176,7 +176,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|         public static MethodInfo GetMethodEnumerable(string methodName) => MethodEnumerableDic.GetOrAdd(methodName, et => | ||||
|         { | ||||
|             var methods = typeof(Enumerable).GetMethods().Where(a => a.Name == et); | ||||
|             if (et == "Select")  | ||||
|             if (et == "Select") | ||||
|                 return methods.Where(a => a.GetParameters()[1].ParameterType.GetGenericTypeDefinition() == typeof(Func<,>)).FirstOrDefault(); | ||||
|             return methods.FirstOrDefault(); | ||||
|         }); | ||||
| @@ -254,7 +254,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|         } | ||||
|         public TSelect RightJoin(Expression<Func<T1, bool>> exp) | ||||
|         { | ||||
|             if (exp == null) return this as TSelect;  | ||||
|             if (exp == null) return this as TSelect; | ||||
|             _tables[0].Parameter = exp.Parameters[0]; | ||||
|             return this.InternalJoin(exp?.Body, SelectTableInfoType.RightJoin); | ||||
|         } | ||||
| @@ -402,7 +402,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|         } | ||||
|         public IDelete<T1> ToDelete() | ||||
|         { | ||||
|             if (_tables[0].Table.Primarys.Any() == false) throw new Exception($"ToDelete 功能要求实体类 {_tables[0].Table.CsName} 必须有主键"); | ||||
|             if (_tables[0].Table.Primarys.Any() == false) throw new Exception(CoreStrings.Entity_Must_Primary_Key("ToDelete", _tables[0].Table.CsName)); | ||||
|             var del = (_orm as BaseDbProvider).CreateDeleteProvider<T1>(null) as DeleteProvider<T1>; | ||||
|             if (_tables[0].Table.Type != typeof(T1)) del.AsType(_tables[0].Table.Type); | ||||
|             if (_params.Any()) del._params = new List<DbParameter>(_params.ToArray()); | ||||
| @@ -436,7 +436,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|         } | ||||
|         public IUpdate<T1> ToUpdate() | ||||
|         { | ||||
|             if (_tables[0].Table.Primarys.Any() == false) throw new Exception($"ToUpdate 功能要求实体类 {_tables[0].Table.CsName} 必须有主键"); | ||||
|             if (_tables[0].Table.Primarys.Any() == false) throw new Exception(CoreStrings.Entity_Must_Primary_Key("ToUpdate", _tables[0].Table.CsName)); | ||||
|             var upd = (_orm as BaseDbProvider).CreateUpdateProvider<T1>(null) as UpdateProvider<T1>; | ||||
|             if (_tables[0].Table.Type != typeof(T1)) upd.AsType(_tables[0].Table.Type); | ||||
|             if (_params.Any()) upd._params = new List<DbParameter>(_params.ToArray()); | ||||
| @@ -472,7 +472,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|         protected List<Dictionary<Type, string>> GetTableRuleUnions() | ||||
|         { | ||||
|             var unions = new List<Dictionary<Type, string>>(); | ||||
|             var trs = _tableRules.Any() ? _tableRules : new List<Func<Type, string, string>>(new [] { new Func<Type, string, string>((type, oldname) => null) }); | ||||
|             var trs = _tableRules.Any() ? _tableRules : new List<Func<Type, string, string>>(new[] { new Func<Type, string, string>((type, oldname) => null) }); | ||||
|  | ||||
|             if (trs.Count == 1 && _tables.Any(a => a.Table.AsTableImpl != null && string.IsNullOrWhiteSpace(trs[0](a.Table.Type, a.Table.DbName)) == true)) | ||||
|             { | ||||
| @@ -571,10 +571,10 @@ namespace FreeSql.Internal.CommonProvider | ||||
|         } | ||||
|         public TSelect AsType(Type entityType) | ||||
|         { | ||||
|             if (entityType == typeof(object)) throw new Exception("ISelect.AsType 参数不支持指定为 object"); | ||||
|             if (entityType == typeof(object)) throw new Exception(CoreStrings.TypeAsType_NotSupport_Object("ISelect")); | ||||
|             if (entityType == _tables[0].Table.Type) return this as TSelect; | ||||
|             var newtb = _commonUtils.GetTableByEntity(entityType); | ||||
|             _tables[0].Table = newtb ?? throw new Exception("ISelect.AsType 参数错误,请传入正确的实体类型"); | ||||
|             _tables[0].Table = newtb ?? throw new Exception(CoreStrings.Type_AsType_Parameter_Error("ISelect")); | ||||
|             if (_orm.CodeFirst.IsAutoSyncStructure) _orm.CodeFirst.SyncStructure(entityType); | ||||
|             return this as TSelect; | ||||
|         } | ||||
| @@ -619,14 +619,14 @@ namespace FreeSql.Internal.CommonProvider | ||||
|                     { | ||||
|                         case DynamicFilterOperator.Custom: | ||||
|                             var fiValueCustomArray = fi.Field?.ToString().Split(new[] { ' ' }, 2); | ||||
|                             if (fiValueCustomArray.Length != 2) throw new ArgumentException("Custom 要求 Field 应该空格分割,并且长度为 2,格式:{静态方法名}{空格}{反射信息}"); | ||||
|                             if (string.IsNullOrWhiteSpace(fiValueCustomArray[0])) throw new ArgumentException("Custom {静态方法名}不能为空,格式:{静态方法名}{空格}{反射信息}"); | ||||
|                             if (string.IsNullOrWhiteSpace(fiValueCustomArray[1])) throw new ArgumentException("Custom {反射信息}不能为空,格式:{静态方法名}{空格}{反射信息}"); | ||||
|                             if (fiValueCustomArray.Length != 2) throw new ArgumentException(CoreStrings.CustomFieldSeparatedBySpaces); | ||||
|                             if (string.IsNullOrWhiteSpace(fiValueCustomArray[0])) throw new ArgumentException(CoreStrings.Custom_StaticMethodName_IsNotNull); | ||||
|                             if (string.IsNullOrWhiteSpace(fiValueCustomArray[1])) throw new ArgumentException(CoreStrings.Custom_Reflection_IsNotNull); | ||||
|                             var fiValue1Type = Type.GetType(fiValueCustomArray[1]); | ||||
|                             if (fiValue1Type == null) throw new ArgumentException($"Custom 找不到对应的{{反射信息}}:{fiValueCustomArray[1]}"); | ||||
|                             if (fiValue1Type == null) throw new ArgumentException(CoreStrings.NotFound_Reflection(fiValueCustomArray[1])); | ||||
|                             var fiValue0Method = fiValue1Type.GetMethod(fiValueCustomArray[0], new Type[] { typeof(string) }); | ||||
|                             if (fiValue0Method == null) throw new ArgumentException($"Custom 找不到对应的{{静态方法名}}:{fiValueCustomArray[0]}"); | ||||
|                             if (MethodIsDynamicFilterCustomAttribute(fiValue0Method) == false) throw new ArgumentException($"Custom 对应的{{静态方法名}}:{fiValueCustomArray[0]} 未设置 [DynamicFilterCustomAttribute] 特性"); | ||||
|                             if (fiValue0Method == null) throw new ArgumentException(CoreStrings.NotFound_Static_MethodName(fiValueCustomArray[0])); | ||||
|                             if (MethodIsDynamicFilterCustomAttribute(fiValue0Method) == false) throw new ArgumentException(CoreStrings.Custom_StaticMethodName_NotSet_DynamicFilterCustom(fiValueCustomArray[0])); | ||||
|                             var fiValue0MethodReturn = fiValue0Method?.Invoke(null, new object[] { fi.Value?.ToString() })?.ToString(); | ||||
|                             exp = Expression.Call(typeof(SqlExt).GetMethod("InternalRawSql", BindingFlags.NonPublic | BindingFlags.Static), Expression.Constant(fiValue0MethodReturn, typeof(string))); | ||||
|                             break; | ||||
| @@ -664,20 +664,20 @@ namespace FreeSql.Internal.CommonProvider | ||||
|                         case DynamicFilterOperator.LessThanOrEqual: exp = Expression.Call(typeof(SqlExt).GetMethod("LessThanOrEqual").MakeGenericMethod(exp.Type), exp, Expression.Constant(Utils.GetDataReaderValue(exp.Type, fi.Value?.ToString()), exp.Type)); break; | ||||
|                         case DynamicFilterOperator.Range: | ||||
|                             var fiValueRangeArray = getFiListValue(); | ||||
|                             if (fiValueRangeArray.Length != 2) throw new ArgumentException($"Range 要求 Value 应该逗号分割,并且长度为 2"); | ||||
|                             if (fiValueRangeArray.Length != 2) throw new ArgumentException(CoreStrings.Range_Comma_Separateda_By2Char); | ||||
|                             exp = Expression.AndAlso( | ||||
|                                 Expression.GreaterThanOrEqual(exp, Expression.Constant(Utils.GetDataReaderValue(exp.Type, fiValueRangeArray[0]), exp.Type)), | ||||
|                                 Expression.LessThan(exp, Expression.Constant(Utils.GetDataReaderValue(exp.Type, fiValueRangeArray[1]), exp.Type))); | ||||
|                             break; | ||||
|                         case DynamicFilterOperator.DateRange: | ||||
|                             var fiValueDateRangeArray = getFiListValue(); | ||||
|                             if (fiValueDateRangeArray?.Length != 2) throw new ArgumentException($"DateRange 要求 Value 应该逗号分割,并且长度为 2"); | ||||
|                             if (fiValueDateRangeArray?.Length != 2) throw new ArgumentException(CoreStrings.DateRange_Comma_Separateda_By2Char); | ||||
|                             if (Regex.IsMatch(fiValueDateRangeArray[1], @"^\d\d\d\d[\-/]\d\d?[\-/]\d\d?$")) fiValueDateRangeArray[1] = DateTime.Parse(fiValueDateRangeArray[1]).AddDays(1).ToString("yyyy-MM-dd HH:mm:ss"); | ||||
|                             else if (Regex.IsMatch(fiValueDateRangeArray[1], @"^\d\d\d\d[\-/]\d\d?$")) fiValueDateRangeArray[1] = DateTime.Parse($"{fiValueDateRangeArray[1]}-01").AddMonths(1).ToString("yyyy-MM-dd HH:mm:ss"); | ||||
|                             else if (Regex.IsMatch(fiValueDateRangeArray[1], @"^\d\d\d\d$")) fiValueDateRangeArray[1] = DateTime.Parse($"{fiValueDateRangeArray[1]}-01-01").AddYears(1).ToString("yyyy-MM-dd HH:mm:ss"); | ||||
|                             else if (Regex.IsMatch(fiValueDateRangeArray[1], @"^\d\d\d\d[\-/]\d\d?[\-/]\d\d? \d\d?$")) fiValueDateRangeArray[1] = DateTime.Parse($"{fiValueDateRangeArray[1]}:00:00").AddHours(1).ToString("yyyy-MM-dd HH:mm:ss"); | ||||
|                             else if (Regex.IsMatch(fiValueDateRangeArray[1], @"^\d\d\d\d[\-/]\d\d?[\-/]\d\d? \d\d?:\d\d?$")) fiValueDateRangeArray[1] = DateTime.Parse($"{fiValueDateRangeArray[1]}:00").AddMinutes(1).ToString("yyyy-MM-dd HH:mm:ss"); | ||||
|                             else throw new ArgumentException($"DateRange 要求 Value[1] 格式必须为:yyyy、yyyy-MM、yyyy-MM-dd、yyyy-MM-dd HH、yyyy、yyyy-MM-dd HH:mm"); | ||||
|                             else throw new ArgumentException(CoreStrings.DateRange_DateFormat_yyyy); | ||||
|  | ||||
|                             if (Regex.IsMatch(fiValueDateRangeArray[0], @"^\d\d\d\d[\-/]\d\d?$")) fiValueDateRangeArray[0] = DateTime.Parse($"{fiValueDateRangeArray[0]}-01").ToString("yyyy-MM-dd HH:mm:ss"); | ||||
|                             else if (Regex.IsMatch(fiValueDateRangeArray[0], @"^\d\d\d\d$")) fiValueDateRangeArray[0] = DateTime.Parse($"{fiValueDateRangeArray[0]}-01-01").ToString("yyyy-MM-dd HH:mm:ss"); | ||||
| @@ -774,7 +774,8 @@ namespace FreeSql.Internal.CommonProvider | ||||
|             } | ||||
|             catch { } | ||||
|  | ||||
|             var dyattr = attrs?.Where(a => { | ||||
|             var dyattr = attrs?.Where(a => | ||||
|             { | ||||
|                 return ((a as Attribute)?.TypeId as Type)?.Name == "DynamicFilterCustomAttribute"; | ||||
|             }).FirstOrDefault(); | ||||
|             return dyattr != null; | ||||
| @@ -800,7 +801,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|         public TSelect ForUpdate(bool noawait = false) | ||||
|         { | ||||
|             if (_transaction == null && _orm.Ado.TransactionCurrentThread == null) | ||||
|                 throw new Exception("安全起见,请务必在事务开启之后,再使用 ForUpdate"); | ||||
|                 throw new Exception($"{CoreStrings.Begin_Transaction_Then_ForUpdate}"); | ||||
|             switch (_orm.Ado.DataType) | ||||
|             { | ||||
|                 case DataType.MySql: | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| using FreeSql.Internal.Model; | ||||
| using FreeSql.Internal.Model; | ||||
| using System; | ||||
| using System.Collections; | ||||
| using System.Collections.Concurrent; | ||||
| @@ -21,13 +21,13 @@ namespace FreeSql.Internal.CommonProvider | ||||
|     { | ||||
|         public DataTable ToDataTableByPropertyName(string[] properties) | ||||
|         { | ||||
|             if (properties?.Any() != true) throw new ArgumentException($"properties 参数不能为空"); | ||||
|             if (properties?.Any() != true) throw new ArgumentException($"{CoreStrings.Properties_Cannot_Null}"); | ||||
|             var sbfield = new StringBuilder(); | ||||
|             for (var propIdx = 0; propIdx < properties.Length; propIdx++) | ||||
|             { | ||||
|                 var property = properties[propIdx]; | ||||
|                 var exp = ConvertStringPropertyToExpression(property); | ||||
|                 if (exp == null) throw new Exception($"{property} 属性名无法找到"); | ||||
|                 if (exp == null) throw new Exception(CoreStrings.Property_Cannot_Find(property)); | ||||
|                 var field = _commonExpression.ExpressionSelectColumn_MemberAccess(_tables, null, SelectTableInfoType.From, exp, true, null); | ||||
|                 if (propIdx > 0) sbfield.Append(", "); | ||||
|                 sbfield.Append(field); | ||||
| @@ -225,7 +225,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|         } | ||||
|         public void ToChunk(int size, Action<FetchCallbackArgs<List<T1>>> done, bool includeNestedMembers = false) | ||||
|         { | ||||
|             if (_selectExpression != null) throw new ArgumentException("Chunk 功能之前不可使用 Select"); | ||||
|             if (_selectExpression != null) throw new ArgumentException(CoreStrings.Before_Chunk_Cannot_Use_Select); | ||||
|             this.ToListChunkPrivate(size, done, includeNestedMembers == false ? this.GetAllFieldExpressionTreeLevel2() : this.GetAllFieldExpressionTreeLevelAll(), null); | ||||
|         } | ||||
|  | ||||
| @@ -776,7 +776,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|         protected TSelect InternalJoin<T2>(Expression exp, SelectTableInfoType joinType) | ||||
|         { | ||||
|             var tb = _commonUtils.GetTableByEntity(typeof(T2)); | ||||
|             if (tb == null) throw new ArgumentException("T2 类型错误"); | ||||
|             if (tb == null) throw new ArgumentException(CoreStrings.T2_Type_Error); | ||||
|             _tables.Add(new SelectTableInfo { Table = tb, Alias = $"IJ{_tables.Count}", On = null, Type = joinType }); | ||||
|             _commonExpression.ExpressionJoinLambda(_tables, joinType, exp, null, _whereGlobalFilter); | ||||
|             return this as TSelect; | ||||
| @@ -817,7 +817,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|         protected string InternalGetInsertIntoToSql<TTargetEntity>(string tableName, Expression select) | ||||
|         { | ||||
|             var tb = _orm.CodeFirst.GetTableByEntity(typeof(TTargetEntity)); | ||||
|             if (tb == null) throw new ArgumentException($"ISelect.InsertInto() 类型错误: {typeof(TTargetEntity).DisplayCsharp()}"); | ||||
|             if (tb == null) throw new ArgumentException(CoreStrings.InsertInto_TypeError(typeof(TTargetEntity).DisplayCsharp())); | ||||
|             if (string.IsNullOrEmpty(tableName)) tableName = tb.DbName; | ||||
|             if (_orm.CodeFirst.IsSyncStructureToLower) tableName = tableName.ToLower(); | ||||
|             if (_orm.CodeFirst.IsSyncStructureToUpper) tableName = tableName.ToUpper(); | ||||
| @@ -829,8 +829,8 @@ namespace FreeSql.Internal.CommonProvider | ||||
|             _commonExpression.ReadAnonymousField(_tables, field, map, ref index, select, null, null, _whereGlobalFilter, null, false); //不走 DTO 映射,不处理 IncludeMany | ||||
|              | ||||
|             var childs = map.Childs; | ||||
|             if (childs.Any() == false) throw new ArgumentException($"ISelect.InsertInto() 未选择属性: {typeof(TTargetEntity).DisplayCsharp()}"); | ||||
|             foreach(var col in tb.Columns.Values) | ||||
|             if (childs.Any() == false) throw new ArgumentException(CoreStrings.InsertInto_No_Property_Selected(typeof(TTargetEntity).DisplayCsharp())); | ||||
|             foreach (var col in tb.Columns.Values) | ||||
|             { | ||||
|                 if (col.Attribute.IsIdentity && string.IsNullOrEmpty(col.DbInsertValue)) continue; | ||||
|                 if (col.Attribute.CanInsert == false) continue; | ||||
| @@ -923,13 +923,13 @@ namespace FreeSql.Internal.CommonProvider | ||||
| #else | ||||
|         public Task<DataTable> ToDataTableByPropertyNameAsync(string[] properties, CancellationToken cancellationToken) | ||||
|         { | ||||
|             if (properties?.Any() != true) throw new ArgumentException($"properties 参数不能为空"); | ||||
|             if (properties?.Any() != true) throw new ArgumentException($"{CoreStrings.Properties_Cannot_Null}"); | ||||
|             var sbfield = new StringBuilder(); | ||||
|             for (var propIdx = 0; propIdx < properties.Length; propIdx++) | ||||
|             { | ||||
|                 var property = properties[propIdx]; | ||||
|                 var exp = ConvertStringPropertyToExpression(property); | ||||
|                 if (exp == null) throw new Exception($"{property} 属性名无法找到"); | ||||
|                 if (exp == null) throw new Exception(CoreStrings.Property_Cannot_Find(property)); | ||||
|                 var field = _commonExpression.ExpressionSelectColumn_MemberAccess(_tables, null, SelectTableInfoType.From, exp, true, null); | ||||
|                 if (propIdx > 0) sbfield.Append(", "); | ||||
|                 sbfield.Append(field); | ||||
|   | ||||
| @@ -32,7 +32,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|                 for (var a = 1; a < lambdaExp.Parameters.Count; a++) | ||||
|                 { | ||||
|                     var tb = _commonUtils.GetTableByEntity(lambdaExp.Parameters[a].Type); | ||||
|                     if (tb == null) throw new ArgumentException($"{lambdaExp.Parameters[a].Name} 类型错误"); | ||||
|                     if (tb == null) throw new ArgumentException(CoreStrings.Type_Error_Name(lambdaExp.Parameters[a].Name)); | ||||
|                     _tables.Add(new SelectTableInfo { Table = tb, Alias = lambdaExp.Parameters[a].Name, On = null, Type = SelectTableInfoType.From }); | ||||
|                 } | ||||
|             } | ||||
| @@ -81,8 +81,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|                         case "LeftJoin": this.InternalJoin(expCall.Arguments[0], SelectTableInfoType.LeftJoin); break; | ||||
|                         case "InnerJoin": this.InternalJoin(expCall.Arguments[0], SelectTableInfoType.InnerJoin); break; | ||||
|                         case "RightJoin": this.InternalJoin(expCall.Arguments[0], SelectTableInfoType.RightJoin); break; | ||||
|  | ||||
|                         default: throw new NotImplementedException($"未实现 {expCall.Method.Name}"); | ||||
|                         default: throw new NotImplementedException(CoreStrings.Not_Implemented_Name(expCall.Method.Name)); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| @@ -118,7 +117,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|         public abstract ISelect<T1, T2, T3, T4, T5, T6, T7, T8> From<T2, T3, T4, T5, T6, T7, T8>(Expression<Func<ISelectFromExpression<T1>, T2, T3, T4, T5, T6, T7, T8, ISelectFromExpression<T1>>> exp) where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class where T7 : class where T8 : class; | ||||
|         public abstract ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9> From<T2, T3, T4, T5, T6, T7, T8, T9>(Expression<Func<ISelectFromExpression<T1>, T2, T3, T4, T5, T6, T7, T8, T9, ISelectFromExpression<T1>>> exp) where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class where T7 : class where T8 : class where T9 : class; | ||||
|         public abstract ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> From<T2, T3, T4, T5, T6, T7, T8, T9, T10>(Expression<Func<ISelectFromExpression<T1>, T2, T3, T4, T5, T6, T7, T8, T9, T10, ISelectFromExpression<T1>>> exp) where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class where T7 : class where T8 : class where T9 : class where T10 : class; | ||||
|          | ||||
|  | ||||
|         public abstract ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> From<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(Expression<Func<ISelectFromExpression<T1>, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, ISelectFromExpression<T1>>> exp) where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class where T7 : class where T8 : class where T9 : class where T10 : class where T11 : class; | ||||
|         public abstract ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> From<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(Expression<Func<ISelectFromExpression<T1>, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, ISelectFromExpression<T1>>> exp) where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class where T7 : class where T8 : class where T9 : class where T10 : class where T11 : class where T12 : class; | ||||
|         public abstract ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> From<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(Expression<Func<ISelectFromExpression<T1>, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, ISelectFromExpression<T1>>> exp) where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class where T7 : class where T8 : class where T9 : class where T10 : class where T11 : class where T12 : class where T13 : class; | ||||
| @@ -244,7 +243,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|                 var splitKeys = fim.Item1.Split('.'); | ||||
|                 var otherRetItem = otherRet[fim.Item3]; | ||||
|                 var otherRetItemType = _tables[0].Table.Type; | ||||
|                 foreach(var splitKey in splitKeys) | ||||
|                 foreach (var splitKey in splitKeys) | ||||
|                 { | ||||
|                     otherRetItem = _orm.GetEntityValueWithPropertyName(otherRetItemType, otherRetItem, splitKey); | ||||
|                     otherRetItemType = _orm.CodeFirst.GetTableByEntity(otherRetItemType).Properties[splitKey].PropertyType; | ||||
| @@ -263,7 +262,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|                 .Where(a => a.Value.CsType != a.Value.Attribute.MapType) | ||||
|                 .Select(a => new { DtoProperty = typeof(TDto).GetProperty(a.Value.CsName), EntityProperty = _tables[0].Table.Properties[a.Value.CsName], Column = a.Value }) | ||||
|                 .Where(a => a.DtoProperty != null) | ||||
|                 .Select(a =>  | ||||
|                 .Select(a => | ||||
|                     a.DtoProperty.PropertyType == a.EntityProperty.PropertyType ? | ||||
|                     Expression.Bind(a.DtoProperty, Expression.MakeMemberAccess(expParam, a.EntityProperty)) : | ||||
|                     Expression.Bind(a.DtoProperty, Expression.Convert(Expression.MakeMemberAccess(expParam, a.EntityProperty), a.DtoProperty.PropertyType)) | ||||
| @@ -408,13 +407,13 @@ namespace FreeSql.Internal.CommonProvider | ||||
|         public ISelect<T1> IncludeByPropertyName(string property) | ||||
|         { | ||||
|             var exp = ConvertStringPropertyToExpression(property, true); | ||||
|             if (exp == null) throw new ArgumentException($"{nameof(property)} 无法解析为表达式树"); | ||||
|             if (exp == null) throw new ArgumentException($"{CoreStrings.Cannot_Resolve_ExpressionTree(nameof(property))}"); | ||||
|             var memExp = exp as MemberExpression; | ||||
|             if (memExp == null) throw new ArgumentException($"{nameof(property)} 无法解析为表达式树2"); | ||||
|             if (memExp == null) throw new ArgumentException($"{CoreStrings.Cannot_Resolve_ExpressionTree(nameof(property))}2"); | ||||
|             var parTb = _commonUtils.GetTableByEntity(memExp.Expression.Type); | ||||
|             if (parTb == null) throw new ArgumentException($"{nameof(property)} 无法解析为表达式树3"); | ||||
|             if (parTb == null) throw new ArgumentException($"{CoreStrings.Cannot_Resolve_ExpressionTree(nameof(property))}3"); | ||||
|             var parTbref = parTb.GetTableRef(memExp.Member.Name, true); | ||||
|             if (parTbref == null) throw new ArgumentException($"{nameof(property)} 不是有效的导航属性"); | ||||
|             if (parTbref == null) throw new ArgumentException(CoreStrings.Not_Valid_Navigation_Property(nameof(property))); | ||||
|             switch (parTbref.RefType) | ||||
|             { | ||||
|                 case TableRefType.ManyToMany: | ||||
| @@ -422,7 +421,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|                     var funcType = typeof(Func<,>).MakeGenericType(_tables[0].Table.Type, typeof(IEnumerable<>).MakeGenericType(parTbref.RefEntityType)); | ||||
|                     var navigateSelector = Expression.Lambda(funcType, exp, _tables[0].Parameter); | ||||
|                     var incMethod = this.GetType().GetMethod("IncludeMany"); | ||||
|                     if (incMethod == null) throw new Exception("运行时错误,反射获取 IncludeMany 方法失败"); | ||||
|                     if (incMethod == null) throw new Exception(CoreStrings.RunTimeError_Reflection_IncludeMany); | ||||
|                     incMethod.MakeGenericMethod(parTbref.RefEntityType).Invoke(this, new object[] { navigateSelector, null }); | ||||
|                     break; | ||||
|                 case TableRefType.ManyToOne: | ||||
| @@ -441,10 +440,10 @@ namespace FreeSql.Internal.CommonProvider | ||||
|         { | ||||
|             var expBody = navigateSelector?.Body; | ||||
|             if (expBody == null) return this; | ||||
|             if (expBody.NodeType != ExpressionType.MemberAccess) throw new Exception("Include 参数类型错误,表达式类型应该为 MemberAccess"); | ||||
|             if (typeof(IEnumerable).IsAssignableFrom(expBody.Type)) throw new Exception("Include 参数类型错误,集合属性请使用 IncludeMany"); | ||||
|             if (expBody.NodeType != ExpressionType.MemberAccess) throw new Exception(CoreStrings.Include_ParameterType_Error_Use_MemberAccess); | ||||
|             if (typeof(IEnumerable).IsAssignableFrom(expBody.Type)) throw new Exception(CoreStrings.Include_ParameterType_Error_Use_IncludeMany); | ||||
|             var tb = _commonUtils.GetTableByEntity(expBody.Type); | ||||
|             if (tb == null) throw new Exception("Include 参数类型错误"); | ||||
|             if (tb == null) throw new Exception(CoreStrings.Include_ParameterType_Error); | ||||
|  | ||||
|             _isIncluded = true; | ||||
|             _tables[0].Parameter = navigateSelector.Parameters[0]; | ||||
| @@ -472,18 +471,18 @@ namespace FreeSql.Internal.CommonProvider | ||||
|                         isbreak = true; | ||||
|                         break; | ||||
|                     default: | ||||
|                         throw new Exception($"表达式错误,它不是连续的 MemberAccess 类型:{exp}"); | ||||
|                         throw new Exception(CoreStrings.Expression_Error_Use_Successive_MemberAccess_Type(exp)); | ||||
|                 } | ||||
|             } | ||||
|             if (param == null) throw new Exception($"表达式错误,它的顶级对象不是 ParameterExpression:{exp}"); | ||||
|             if (param == null) throw new Exception(CoreStrings.Expression_Error_Use_ParameterExpression(exp)); | ||||
|             return NativeTuple.Create(param, members.ToList()); | ||||
|         } | ||||
|         static MethodInfo GetEntityValueWithPropertyNameMethod = typeof(EntityUtilExtensions).GetMethod("GetEntityValueWithPropertyName"); | ||||
|         static ConcurrentDictionary<Type, ConcurrentDictionary<string, MethodInfo>> _dicTypeMethod = new ConcurrentDictionary<Type, ConcurrentDictionary<string, MethodInfo>>(); | ||||
|         public ISelect<T1> IncludeMany<TNavigate>(Expression<Func<T1, IEnumerable<TNavigate>>> navigateSelector, Action<ISelect<TNavigate>> then = null) where TNavigate : class | ||||
|         { | ||||
|             var throwNavigateSelector = new Exception("IncludeMany 参数1 类型错误,表达式类型应该为 MemberAccess"); | ||||
|  | ||||
|             var throwNavigateSelector = new Exception(CoreStrings.IncludeMany_ParameterType_Error_Use_MemberAccess); | ||||
|              | ||||
|             var expBody = navigateSelector?.Body; | ||||
|             if (expBody == null) return this; | ||||
|             if (expBody.NodeType == ExpressionType.Convert) expBody = (expBody as UnaryExpression)?.Operand; //- 兼容 Vb.Net 无法使用 IncludeMany 的问题; | ||||
| @@ -492,7 +491,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|             Expression<Func<TNavigate, TNavigate>> selectExp = null; | ||||
|             while (expBody.NodeType == ExpressionType.Call) | ||||
|             { | ||||
|                 throwNavigateSelector = new Exception($"IncludeMany {nameof(navigateSelector)} 参数类型错误,正确格式: a.collections.Take(1).Where(c => c.aid == a.id).Select(a => new TNavigate {{ }})"); | ||||
|                 throwNavigateSelector = new Exception(CoreStrings.IncludeMany_ParameterTypeError(nameof(navigateSelector))); | ||||
|                 var callExp = (expBody as MethodCallExpression); | ||||
|                 switch (callExp.Method.Name) | ||||
|                 { | ||||
| @@ -504,7 +503,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|                         break; | ||||
|                     case "Select": | ||||
|                         selectExp = (callExp.Arguments[1] as Expression<Func<TNavigate, TNavigate>>); | ||||
|                         if (selectExp?.Parameters.Count != 1) throw new Exception($"IncludeMany {nameof(navigateSelector)} 参数错误,Select 只可以使用一个参数的方法,正确格式: .Select(t => new TNavigate {{ }})"); | ||||
|                         if (selectExp?.Parameters.Count != 1) throw new Exception(CoreStrings.IncludeMany_ParameterError_OnlyUseOneParameter(nameof(navigateSelector))); | ||||
|                         break; | ||||
|                     default: throw throwNavigateSelector; | ||||
|                 } | ||||
| @@ -519,10 +518,10 @@ namespace FreeSql.Internal.CommonProvider | ||||
|             var tb = _commonUtils.GetTableByEntity(collMem.Expression.Type); | ||||
|             if (tb == null) throw throwNavigateSelector; | ||||
|             var collMemElementType = (collMem.Type.IsGenericType ? collMem.Type.GetGenericArguments().FirstOrDefault() : collMem.Type.GetElementType()); | ||||
|             if (typeof(TNavigate) != collMemElementType)  | ||||
|                 throw new Exception($"IncludeMany {nameof(navigateSelector)} 参数错误,Select lambda参数返回值必须和 {collMemElementType} 类型一致"); | ||||
|             if (typeof(TNavigate) != collMemElementType) | ||||
|                 throw new Exception(CoreStrings.IncludeMany_ParameterError_Select_ReturnConsistentType(nameof(navigateSelector), collMemElementType)); | ||||
|             var tbNav = _commonUtils.GetTableByEntity(typeof(TNavigate)); | ||||
|             if (tbNav == null) throw new Exception($"类型 {typeof(TNavigate).FullName} 错误,不能使用 IncludeMany"); | ||||
|             if (tbNav == null) throw new Exception(CoreStrings.TypeError_CannotUse_IncludeMany(typeof(TNavigate).FullName)); | ||||
|  | ||||
|             if (collMem.Expression.NodeType != ExpressionType.Parameter) | ||||
|                 _commonExpression.ExpressionWhereLambda(_tables, Expression.MakeMemberAccess(collMem.Expression, tb.Properties[tb.ColumnsByCs.First().Value.CsName]), null, null, null); | ||||
| @@ -532,7 +531,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|             if (whereExp == null) | ||||
|             { | ||||
|                 tbref = tb.GetTableRef(collMem.Member.Name, true); | ||||
|                 if (tbref == null) throw new Exception($"IncludeMany 类型 {tb.Type.DisplayCsharp()} 的属性 {collMem.Member.Name} 不是有效的导航属性,提示:IsIgnore = true 不会成为导航属性"); | ||||
|                 if (tbref == null) throw new Exception(CoreStrings.IncludeMany_NotValid_Navigation(tb.Type.DisplayCsharp(), collMem.Member.Name)); | ||||
|             } | ||||
|             else | ||||
|             { | ||||
| @@ -834,7 +833,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|                     dicList.Clear(); | ||||
|                 }; | ||||
|  | ||||
|                 if (tbref.RefType ==  TableRefType.OneToMany && _includeManySubListOneToManyTempValue1 != null && _includeManySubListOneToManyTempValue1 is List<TNavigate>) | ||||
|                 if (tbref.RefType == TableRefType.OneToMany && _includeManySubListOneToManyTempValue1 != null && _includeManySubListOneToManyTempValue1 is List<TNavigate>) | ||||
|                 { | ||||
|                     fillOneToManyData(_includeManySubListOneToManyTempValue1 as List<TNavigate>, _commonUtils.GetTableByEntity(tbref.RefEntityType)); | ||||
|                     return; | ||||
|   | ||||
| @@ -150,7 +150,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|         public string InternalToSql(string field) | ||||
|         { | ||||
|             if (string.IsNullOrEmpty(field)) | ||||
|                 throw new ArgumentException("参数 field 未指定"); | ||||
|                 throw new ArgumentException(CoreStrings.Parameter_Field_NotSpecified); | ||||
|  | ||||
|             var isNestedPageSql = false; | ||||
|             switch (_orm.Ado.DataType) | ||||
|   | ||||
| @@ -132,7 +132,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|             if (_table.VersionColumn != null && _source.Count > 0) | ||||
|             { | ||||
|                 if (affrows != _source.Count) | ||||
|                     throw new DbUpdateVersionException($"记录可能不存在,或者【行级乐观锁】版本过旧,更新数量{_source.Count},影响的行数{affrows}。", _table, sql, dbParms, affrows, _source.Select(a => (object)a)); | ||||
|                     throw new DbUpdateVersionException(CoreStrings.DbUpdateVersionException_RowLevelOptimisticLock(_source.Count, affrows), _table, sql, dbParms, affrows, _source.Select(a => (object)a)); | ||||
|                 foreach (var d in _source) | ||||
|                 { | ||||
|                     if (_table.VersionColumn.Attribute.MapType == typeof(byte[])) | ||||
| @@ -224,7 +224,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     if (_orm.Ado.MasterPool == null) throw new Exception("Ado.MasterPool 值为 null,该操作无法自启用事务,请显式传递【事务对象】解决"); | ||||
|                     if (_orm.Ado.MasterPool == null) throw new Exception(CoreStrings.MasterPool_IsNull_UseTransaction); | ||||
|                     using (var conn = _orm.Ado.MasterPool.Get()) | ||||
|                     { | ||||
|                         _transaction = conn.Value.BeginTransaction(); | ||||
| @@ -239,12 +239,12 @@ namespace FreeSql.Internal.CommonProvider | ||||
|                                 ret += this.RawExecuteAffrows(); | ||||
|                             } | ||||
|                             _transaction.Commit(); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "提交", null)); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.Commit, null)); | ||||
|                         } | ||||
|                         catch (Exception ex) | ||||
|                         { | ||||
|                             _transaction.Rollback(); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "回滚", ex)); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.RollBack, ex)); | ||||
|                             throw; | ||||
|                         } | ||||
|                         _transaction = null; | ||||
| @@ -298,7 +298,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     if (_orm.Ado.MasterPool == null) throw new Exception("Ado.MasterPool 值为 null,该操作无法自启用事务,请显式传递【事务对象】解决"); | ||||
|                     if (_orm.Ado.MasterPool == null) throw new Exception(CoreStrings.MasterPool_IsNull_UseTransaction); | ||||
|                     using (var conn = _orm.Ado.MasterPool.Get()) | ||||
|                     { | ||||
|                         _transaction = conn.Value.BeginTransaction(); | ||||
| @@ -313,12 +313,12 @@ namespace FreeSql.Internal.CommonProvider | ||||
|                                 ret.AddRange(this.RawExecuteUpdated()); | ||||
|                             } | ||||
|                             _transaction.Commit(); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "提交", null)); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.Commit, null)); | ||||
|                         } | ||||
|                         catch (Exception ex) | ||||
|                         { | ||||
|                             _transaction.Rollback(); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "回滚", ex)); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.RollBack, ex)); | ||||
|                             throw; | ||||
|                         } | ||||
|                         _transaction = null; | ||||
| @@ -428,7 +428,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|             if (orm.Aop.AuditValueHandler == null) return; | ||||
|             if (data == null || table == null) return; | ||||
|             if (typeof(T1) == typeof(object) && new[] { table.Type, table.TypeLazy }.Contains(data.GetType()) == false) | ||||
|                 throw new Exception($"操作的数据类型({data.GetType().DisplayCsharp()}) 与 AsType({table.Type.DisplayCsharp()}) 不一致,请检查。"); | ||||
|                 throw new Exception(CoreStrings.DataType_AsType_Inconsistent(data.GetType().DisplayCsharp(), table.Type.DisplayCsharp())); | ||||
|             foreach (var col in table.Columns.Values) | ||||
|             { | ||||
|                 object val = col.GetValue(data); | ||||
| @@ -558,9 +558,12 @@ namespace FreeSql.Internal.CommonProvider | ||||
|                             if (initAssignExp == null) continue; | ||||
|                             var memberName = initExp.Bindings[a].Member.Name; | ||||
|                             if (_table.ColumnsByCsIgnore.ContainsKey(memberName)) continue; | ||||
|                             if (_table.ColumnsByCs.TryGetValue(memberName, out var col) == false) throw new Exception($"找不到属性:{memberName}"); | ||||
|                             var memberValue = _commonExpression.ExpressionLambdaToSql(initAssignExp.Expression, new CommonExpression.ExpTSC { isQuoteName = true,  | ||||
|                                 mapType = initAssignExp.Expression is BinaryExpression ? null : col.Attribute.MapType }); | ||||
|                             if (_table.ColumnsByCs.TryGetValue(memberName, out var col) == false) throw new Exception(CoreStrings.NotFound_Property(memberName)); | ||||
|                             var memberValue = _commonExpression.ExpressionLambdaToSql(initAssignExp.Expression, new CommonExpression.ExpTSC | ||||
|                             { | ||||
|                                 isQuoteName = true, | ||||
|                                 mapType = initAssignExp.Expression is BinaryExpression ? null : col.Attribute.MapType | ||||
|                             }); | ||||
|                             _setIncr.Append(", ").Append(_commonUtils.QuoteSqlName(col.Attribute.Name)).Append(" = ").Append(memberValue); | ||||
|                         } | ||||
|                     } | ||||
| @@ -573,9 +576,12 @@ namespace FreeSql.Internal.CommonProvider | ||||
|                         { | ||||
|                             var memberName = newExp.Members[a].Name; | ||||
|                             if (_table.ColumnsByCsIgnore.ContainsKey(memberName)) continue; | ||||
|                             if (_table.ColumnsByCs.TryGetValue(memberName, out var col) == false) throw new Exception($"找不到属性:{memberName}"); | ||||
|                             var memberValue = _commonExpression.ExpressionLambdaToSql(newExp.Arguments[a], new CommonExpression.ExpTSC { isQuoteName = true,  | ||||
|                                 mapType = newExp.Arguments[a] is BinaryExpression ? null : col.Attribute.MapType }); | ||||
|                             if (_table.ColumnsByCs.TryGetValue(memberName, out var col) == false) throw new Exception(CoreStrings.NotFound_Property(memberName)); | ||||
|                             var memberValue = _commonExpression.ExpressionLambdaToSql(newExp.Arguments[a], new CommonExpression.ExpTSC | ||||
|                             { | ||||
|                                 isQuoteName = true, | ||||
|                                 mapType = newExp.Arguments[a] is BinaryExpression ? null : col.Attribute.MapType | ||||
|                             }); | ||||
|                             _setIncr.Append(", ").Append(_commonUtils.QuoteSqlName(col.Attribute.Name)).Append(" = ").Append(memberValue); | ||||
|                         } | ||||
|                     } | ||||
| @@ -672,7 +678,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|         protected string WhereCaseSource(string CsName, Func<string, string> thenValue) | ||||
|         { | ||||
|             if (_source.Any() == false) return null; | ||||
|             if (_table.ColumnsByCs.ContainsKey(CsName) == false) throw new Exception($"找不到 {CsName} 对应的列"); | ||||
|             if (_table.ColumnsByCs.ContainsKey(CsName) == false) throw new Exception(CoreStrings.NotFound_CsName_Column(CsName)); | ||||
|             if (thenValue == null) throw new ArgumentNullException(nameof(thenValue)); | ||||
|  | ||||
|             if (_source.Count == 0) return null; | ||||
| @@ -757,10 +763,10 @@ namespace FreeSql.Internal.CommonProvider | ||||
|         } | ||||
|         public IUpdate<T1> AsType(Type entityType) | ||||
|         { | ||||
|             if (entityType == typeof(object)) throw new Exception("IUpdate.AsType 参数不支持指定为 object"); | ||||
|             if (entityType == typeof(object)) throw new Exception(CoreStrings.TypeAsType_NotSupport_Object("IUpdate")); | ||||
|             if (entityType == _table.Type) return this; | ||||
|             var newtb = _commonUtils.GetTableByEntity(entityType); | ||||
|             _table = newtb ?? throw new Exception("IUpdate.AsType 参数错误,请传入正确的实体类型"); | ||||
|             _table = newtb ?? throw new Exception(CoreStrings.Type_AsType_Parameter_Error("IUpdate")); | ||||
|             _tempPrimarys = _table.Primarys; | ||||
|             if (_orm.CodeFirst.IsAutoSyncStructure) _orm.CodeFirst.SyncStructure(entityType); | ||||
|             IgnoreCanUpdate(); | ||||
| @@ -1003,7 +1009,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|             sb.Append(" \r\nWHERE "); | ||||
|             if (_source.Any()) | ||||
|             { | ||||
|                 if (_tempPrimarys.Any() == false) throw new ArgumentException($"{_table.Type.DisplayCsharp()} 没有定义主键,无法使用 SetSource,请尝试 SetDto"); | ||||
|                 if (_tempPrimarys.Any() == false) throw new ArgumentException(CoreStrings.NoPrimaryKey_UseSetDto(_table.Type.DisplayCsharp())); | ||||
|                 sb.Append('(').Append(_commonUtils.WhereItems(_tempPrimarys, "", _source)).Append(')'); | ||||
|             } | ||||
|  | ||||
|   | ||||
| @@ -51,7 +51,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     if (_orm.Ado.MasterPool == null) throw new Exception("Ado.MasterPool 值为 null,该操作无法自启用事务,请显式传递【事务对象】解决"); | ||||
|                     if (_orm.Ado.MasterPool == null) throw new Exception(CoreStrings.MasterPool_IsNull_UseTransaction); | ||||
|                     using (var conn = await _orm.Ado.MasterPool.GetAsync()) | ||||
|                     { | ||||
|                         _transaction = conn.Value.BeginTransaction(); | ||||
| @@ -66,12 +66,12 @@ namespace FreeSql.Internal.CommonProvider | ||||
|                                 ret += await this.RawExecuteAffrowsAsync(cancellationToken); | ||||
|                             } | ||||
|                             _transaction.Commit(); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "提交", null)); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.Commit, null)); | ||||
|                         } | ||||
|                         catch (Exception ex) | ||||
|                         { | ||||
|                             _transaction.Rollback(); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "回滚", ex)); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.RollBack, ex)); | ||||
|                             throw; | ||||
|                         } | ||||
|                         _transaction = null; | ||||
| @@ -124,7 +124,7 @@ namespace FreeSql.Internal.CommonProvider | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     if (_orm.Ado.MasterPool == null) throw new Exception("Ado.MasterPool 值为 null,该操作无法自启用事务,请显式传递【事务对象】解决"); | ||||
|                     if (_orm.Ado.MasterPool == null) throw new Exception(CoreStrings.MasterPool_IsNull_UseTransaction); | ||||
|                     using (var conn = await _orm.Ado.MasterPool.GetAsync()) | ||||
|                     { | ||||
|                         _transaction = conn.Value.BeginTransaction(); | ||||
| @@ -139,12 +139,12 @@ namespace FreeSql.Internal.CommonProvider | ||||
|                                 ret.AddRange(await this.RawExecuteUpdatedAsync(cancellationToken)); | ||||
|                             } | ||||
|                             _transaction.Commit(); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "提交", null)); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.Commit, null)); | ||||
|                         } | ||||
|                         catch (Exception ex) | ||||
|                         { | ||||
|                             _transaction.Rollback(); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "回滚", ex)); | ||||
|                             _orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, CoreStrings.RollBack, ex)); | ||||
|                             throw; | ||||
|                         } | ||||
|                         _transaction = null; | ||||
|   | ||||
| @@ -123,12 +123,12 @@ namespace FreeSql.Internal.ObjectPool | ||||
|                     { | ||||
|  | ||||
|                         var conn = GetFree(false); | ||||
|                         if (conn == null) throw new Exception($"CheckAvailable: Failed to get resource {this.Statistics}"); | ||||
|  | ||||
|                         if (conn == null) throw new Exception(CoreStrings.Available_Failed_Get_Resource("CheckAvailable", this.Statistics)); | ||||
|                          | ||||
|                         try | ||||
|                         { | ||||
|  | ||||
|                             if (Policy.OnCheckAvailable(conn) == false) throw new Exception("CheckAvailable: An exception needs to be thrown"); | ||||
|                             if (Policy.OnCheckAvailable(conn) == false) throw new Exception(CoreStrings.Available_Thrown_Exception("CheckAvailable")); | ||||
|                             break; | ||||
|  | ||||
|                         } | ||||
| @@ -187,22 +187,22 @@ namespace FreeSql.Internal.ObjectPool | ||||
|  | ||||
|             try | ||||
|             { | ||||
|  | ||||
|                  | ||||
|                 var conn = GetFree(false); | ||||
|                 if (conn == null) throw new Exception($"LiveCheckAvailable: Failed to get resource {this.Statistics}"); | ||||
|  | ||||
|                 if (conn == null) throw new Exception(CoreStrings.Available_Failed_Get_Resource("LiveCheckAvailable", this.Statistics)); | ||||
|                | ||||
|                 try | ||||
|                 { | ||||
|  | ||||
|                     if (Policy.OnCheckAvailable(conn) == false) throw new Exception("LiveCheckAvailable: An exception needs to be thrown"); | ||||
|  | ||||
|                      | ||||
|                     if (Policy.OnCheckAvailable(conn) == false) throw new Exception(CoreStrings.Available_Thrown_Exception("LiveCheckAvailable")); | ||||
|                      | ||||
|                 } | ||||
|                 finally | ||||
|                 { | ||||
|  | ||||
|                   | ||||
|                     Return(conn); | ||||
|                 } | ||||
|  | ||||
|                  | ||||
|             } | ||||
|             catch | ||||
|             { | ||||
| @@ -275,11 +275,10 @@ namespace FreeSql.Internal.ObjectPool | ||||
|         { | ||||
|  | ||||
|             if (running == false) | ||||
|                 throw new ObjectDisposedException($"【{Policy.Name}】The ObjectPool has been disposed, see: https://github.com/dotnetcore/FreeSql/discussions/1079"); | ||||
|                 throw new ObjectDisposedException(CoreStrings.Policy_ObjectPool_Dispose(Policy.Name)); | ||||
|  | ||||
|             if (checkAvailable && UnavailableException != null) | ||||
|                 throw new Exception($"【{Policy.Name}】Block access and wait for recovery: {UnavailableException?.Message}, see: https://github.com/dotnetcore/FreeSql/discussions/1080", UnavailableException); | ||||
|             //throw new Exception($"【{Policy.Name}】状态不可用,等待后台检查程序恢复方可使用。{UnavailableException?.Message}"); | ||||
|                 throw new Exception(CoreStrings.Policy_Status_NotAvailable(Policy.Name,UnavailableException?.Message), UnavailableException); | ||||
|  | ||||
|             if ((_freeObjects.TryPop(out var obj) == false || obj == null) && _allObjects.Count < Policy.PoolSize) | ||||
|             { | ||||
| @@ -341,7 +340,7 @@ namespace FreeSql.Internal.ObjectPool | ||||
|                     Policy.OnGetTimeout(); | ||||
|  | ||||
|                     if (Policy.IsThrowGetTimeoutException) | ||||
|                         throw new TimeoutException($"【{Policy.Name}】ObjectPool.Get() timeout {timeout.Value.TotalSeconds} seconds, see: https://github.com/dotnetcore/FreeSql/discussions/1081"); | ||||
|                         throw new TimeoutException(CoreStrings.ObjectPool_Get_Timeout(Policy.Name, "Get", timeout.Value.TotalSeconds)); | ||||
|  | ||||
|                     return null; | ||||
|                 } | ||||
| @@ -375,7 +374,7 @@ namespace FreeSql.Internal.ObjectPool | ||||
|             { | ||||
|  | ||||
|                 if (Policy.AsyncGetCapacity > 0 && _getAsyncQueue.Count >= Policy.AsyncGetCapacity - 1) | ||||
|                     throw new OutOfMemoryException($"【{Policy.Name}】ObjectPool.GetAsync() The queue is too long. Policy.AsyncGetCapacity = {Policy.AsyncGetCapacity}"); | ||||
|                     throw new OutOfMemoryException(CoreStrings.ObjectPool_GetAsync_Queue_Long(Policy.Name, Policy.AsyncGetCapacity)); | ||||
|  | ||||
|                 var tcs = new TaskCompletionSource<Object<T>>(); | ||||
|  | ||||
|   | ||||
| @@ -87,7 +87,7 @@ namespace FreeSql.Internal | ||||
|                     else colattr.IsIgnore = true; | ||||
|                     //Navigate 错误提示 | ||||
|                     var pnvAttr = common.GetEntityNavigateAttribute(trytb.Type, p); | ||||
|                     if (pnvAttr != null) throw new Exception($"【导航属性】{trytb.Type.DisplayCsharp()}.{p.Name} 缺少 set 属性"); | ||||
|                     if (pnvAttr != null) throw new Exception(CoreStrings.Navigation_Missing_SetProperty(trytb.Type.DisplayCsharp(),p.Name)); | ||||
|                 } | ||||
|                 if (tp == null && colattr?.IsIgnore != true) | ||||
|                 { | ||||
| @@ -381,8 +381,8 @@ namespace FreeSql.Internal | ||||
|                     colattr.DbType = Regex.Replace(colattr.DbType, decimalPatten, $"$1({colattr.Precision},{colattr.Scale})"); | ||||
|                 } | ||||
|  | ||||
|                 if (trytb.Columns.ContainsKey(colattr.Name)) throw new Exception($"ColumnAttribute.Name {colattr.Name} 重复存在,请检查(注意:不区分大小写)"); | ||||
|                 if (trytb.ColumnsByCs.ContainsKey(p.Name)) throw new Exception($"属性名 {p.Name} 重复存在,请检查(注意:不区分大小写)"); | ||||
|                 if (trytb.Columns.ContainsKey(colattr.Name)) throw new Exception(CoreStrings.Duplicate_ColumnAttribute(colattr.Name)); | ||||
|                 if (trytb.ColumnsByCs.ContainsKey(p.Name)) throw new Exception(CoreStrings.Duplicate_PropertyName(p.Name)); | ||||
|  | ||||
|                 trytb.Columns.Add(colattr.Name, col); | ||||
|                 trytb.ColumnsByCs.Add(p.Name, col); | ||||
| @@ -392,7 +392,7 @@ namespace FreeSql.Internal | ||||
|             if (trytb.VersionColumn != null) | ||||
|             { | ||||
|                 if (trytb.VersionColumn.Attribute.MapType.IsNullableType() || trytb.VersionColumn.Attribute.MapType.IsNumberType() == false && trytb.VersionColumn.Attribute.MapType != typeof(byte[])) | ||||
|                     throw new Exception($"属性{trytb.VersionColumn.CsName} 被标注为行锁(乐观锁)(IsVersion),但其必须为数字类型 或者 byte[],并且不可为 Nullable"); | ||||
|                     throw new Exception(CoreStrings.Properties_AsRowLock_Must_Numeric_Byte(trytb.VersionColumn.CsName)); | ||||
|             } | ||||
|             tbattr?.ParseAsTable(trytb); | ||||
|  | ||||
| @@ -550,7 +550,7 @@ namespace FreeSql.Internal | ||||
|             StringBuilder cscode = null; | ||||
|             if (common.CodeFirst.IsLazyLoading && propsLazy.Any()) | ||||
|             { | ||||
|                 if (trytb.Type.IsPublic == false && trytb.Type.IsNestedPublic == false) throw new Exception($"【延时加载】实体类型 {trytbTypeName} 必须声明为 public"); | ||||
|                 if (trytb.Type.IsPublic == false && trytb.Type.IsNestedPublic == false) throw new Exception(CoreStrings.LazyLoading_EntityMustDeclarePublic(trytbTypeName)); | ||||
|  | ||||
|                 trytbTypeLazyName = $"FreeSqlLazyEntity__{Regex.Replace(trytbTypeName, @"[^\w\d]", "_")}"; | ||||
|  | ||||
| @@ -576,14 +576,14 @@ namespace FreeSql.Internal | ||||
|             { | ||||
|                 cscode.AppendLine("}"); | ||||
|                 Assembly assembly = null; | ||||
|                 if (MethodLazyLoadingComplier.Value == null) throw new Exception("【延时加载】功能需要安装 FreeSql.Extensions.LazyLoading.dll,可前往 nuget 下载"); | ||||
|                 if (MethodLazyLoadingComplier.Value == null) throw new Exception(CoreStrings.Install_FreeSql_Extensions_LazyLoading); | ||||
|                 try | ||||
|                 { | ||||
|                     assembly = MethodLazyLoadingComplier.Value.Invoke(null, new object[] { cscode.ToString() }) as Assembly; | ||||
|                 } | ||||
|                 catch (Exception ex) | ||||
|                 { | ||||
|                     throw new Exception($"【延时加载】{trytbTypeName} 编译错误:{ex.Message}\r\n\r\n{cscode}"); | ||||
|                     throw new Exception(CoreStrings.LazyLoading_CompilationError(trytbTypeName, ex.Message, cscode)); ; | ||||
|                 } | ||||
|                 var type = assembly.GetExportedTypes()/*.DefinedTypes*/.Where(a => a.FullName.EndsWith(trytbTypeLazyName)).FirstOrDefault(); | ||||
|                 trytb.TypeLazy = type; | ||||
| @@ -618,7 +618,7 @@ namespace FreeSql.Internal | ||||
|                 if (typeof(IEnumerable).IsAssignableFrom(pnv.PropertyType) == false) return; | ||||
|                 if (trytb.Primarys.Any() == false) | ||||
|                 { | ||||
|                     nvref.Exception = new Exception($"导航属性 {trytbTypeName}.{pnv.Name} 解析错误,实体类型 {trytbTypeName} 缺少主键标识,[Column(IsPrimary = true)]"); | ||||
|                     nvref.Exception = new Exception(CoreStrings.Navigation_ParsingError_EntityMissingPrimaryKey(trytbTypeName, pnv.Name, trytbTypeName)); | ||||
|                     trytb.AddOrUpdateTableRef(pnv.Name, nvref); | ||||
|                     //if (isLazy) throw nvref.Exception; | ||||
|                     return; | ||||
| @@ -651,7 +651,7 @@ namespace FreeSql.Internal | ||||
|  | ||||
|                     if (isManyToMany == false) | ||||
|                     { | ||||
|                         nvref.Exception = new Exception($"【ManyToMany】导航属性 {trytbTypeName}.{pnv.Name} 解析错误,实体类型 {tbrefTypeName} 必须存在对应的 [Navigate(ManyToMany = x)] 集合属性"); | ||||
|                         nvref.Exception = new Exception(CoreStrings.ManyToMany_ParsingError_EntityMustHas_NavigateCollection(trytbTypeName, pnv.Name, tbrefTypeName)); | ||||
|                         trytb.AddOrUpdateTableRef(pnv.Name, nvref); | ||||
|                         //if (isLazy) throw nvref.Exception; | ||||
|                         return; | ||||
| @@ -674,7 +674,7 @@ namespace FreeSql.Internal | ||||
|                 { | ||||
|                     if (tbref.Primarys.Any() == false) | ||||
|                     { | ||||
|                         nvref.Exception = new Exception($"【ManyToMany】导航属性 {trytbTypeName}.{pnv.Name} 解析错误,实体类型 {tbrefTypeName} 缺少主键标识,[Column(IsPrimary = true)]"); | ||||
|                         nvref.Exception = new Exception(CoreStrings.ManyToMany_ParsingError_EntityMissing_PrimaryKey(trytbTypeName, pnv.Name, tbrefTypeName)); | ||||
|                         trytb.AddOrUpdateTableRef(pnv.Name, nvref); | ||||
|                         //if (isLazy) throw nvref.Exception; | ||||
|                         return; | ||||
| @@ -773,7 +773,7 @@ namespace FreeSql.Internal | ||||
|                         } | ||||
|                         catch (Exception ex) | ||||
|                         { | ||||
|                             nvref.Exception = new Exception($"【ManyToMany】导航属性 {trytbTypeName}.{pnv.Name} 解析错误,中间类 {tbmid.CsName}.{midTypePropsTrytb.Name} 错误:{ex.Message}"); | ||||
|                             nvref.Exception = new Exception(CoreStrings.ManyToMany_ParsingError_IntermediateClass_ErrorMessage(trytbTypeName, pnv.Name, tbmid.CsName, midTypePropsTrytb.Name, ex.Message)); | ||||
|                             trytb.AddOrUpdateTableRef(pnv.Name, nvref); | ||||
|                             //if (isLazy) throw nvref.Exception; | ||||
|                         } | ||||
| @@ -781,7 +781,7 @@ namespace FreeSql.Internal | ||||
|                         { | ||||
|                             if (trytbTf.RefType != TableRefType.ManyToOne && trytbTf.RefType != TableRefType.OneToOne) | ||||
|                             { | ||||
|                                 nvref.Exception = new Exception($"【ManyToMany】导航属性 {trytbTypeName}.{pnv.Name} 解析错误,中间类 {tbmid.CsName}.{midTypePropsTrytb.Name} 导航属性不是【ManyToOne】或【OneToOne】"); | ||||
|                                 nvref.Exception = new Exception(CoreStrings.ManyToMany_ParsingError_IntermediateClass_NotManyToOne_OneToOne(trytbTypeName, pnv.Name, tbmid.CsName, midTypePropsTrytb.Name)); | ||||
|                                 trytb.AddOrUpdateTableRef(pnv.Name, nvref); | ||||
|                                 //if (isLazy) throw nvref.Exception; | ||||
|                             } | ||||
| @@ -820,7 +820,7 @@ namespace FreeSql.Internal | ||||
|                             } | ||||
|                             catch (Exception ex) | ||||
|                             { | ||||
|                                 nvref.Exception = new Exception($"【ManyToMany】导航属性 {tbrefTypeName}.{pnv.Name} 解析错误,中间类 {tbmid.CsName}.{midTypePropsTbref.Name} 错误:{ex.Message}"); | ||||
|                                 nvref.Exception = new Exception(CoreStrings.ManyToMany_ParsingError_IntermediateClass_ErrorMessage(trytbTypeName, pnv.Name, tbmid.CsName, midTypePropsTbref.Name, ex.Message)); | ||||
|                                 trytb.AddOrUpdateTableRef(pnv.Name, nvref); | ||||
|                                 //if (isLazy) throw nvref.Exception; | ||||
|                             } | ||||
| @@ -828,7 +828,7 @@ namespace FreeSql.Internal | ||||
|                             { | ||||
|                                 if (tbrefTf.RefType != TableRefType.ManyToOne && tbrefTf.RefType != TableRefType.OneToOne) | ||||
|                                 { | ||||
|                                     nvref.Exception = new Exception($"【ManyToMany】导航属性 {tbrefTypeName}.{pnv.Name} 解析错误,中间类 {tbmid.CsName}.{midTypePropsTbref.Name} 导航属性不是【ManyToOne】或【OneToOne】"); | ||||
|                                     nvref.Exception = new Exception(CoreStrings.ManyToMany_ParsingError_IntermediateClass_NotManyToOne_OneToOne(trytbTypeName, pnv.Name, tbmid.CsName, midTypePropsTbref.Name)); | ||||
|                                     trytb.AddOrUpdateTableRef(pnv.Name, nvref); | ||||
|                                     //if (isLazy) throw nvref.Exception; | ||||
|                                 } | ||||
| @@ -866,14 +866,14 @@ namespace FreeSql.Internal | ||||
|                             } | ||||
|                             if (trycol != null && trycol.CsType.NullableTypeOrThis() != trytb.Primarys[a].CsType.NullableTypeOrThis()) | ||||
|                             { | ||||
|                                 nvref.Exception = new Exception($"【ManyToMany】导航属性 {trytbTypeName}.{pnv.Name} 解析错误,{tbmid.CsName}.{trycol.CsName} 和 {trytb.CsName}.{trytb.Primarys[a].CsName} 类型不一致"); | ||||
|                                 nvref.Exception = new Exception(CoreStrings.ManyToMany_ParsingError_InconsistentType(trytbTypeName, pnv.Name, tbmid.CsName, trycol.CsName, trytb.CsName, trytb.Primarys[a].CsName)); | ||||
|                                 trytb.AddOrUpdateTableRef(pnv.Name, nvref); | ||||
|                                 //if (isLazy) throw nvref.Exception; | ||||
|                                 break; | ||||
|                             } | ||||
|                             if (trycol == null) | ||||
|                             { | ||||
|                                 nvref.Exception = new Exception($"【ManyToMany】导航属性 {trytbTypeName}.{pnv.Name} 在 {tbmid.CsName} 中没有找到对应的字段,如:{midTypePropsTrytb.Name}{findtrytbPkCsName}、{midTypePropsTrytb.Name}_{findtrytbPkCsName}"); | ||||
|                                 nvref.Exception = new Exception(CoreStrings.ManyToMany_NotFound_CorrespondingField(trytbTypeName, pnv.Name, tbmid.CsName, midTypePropsTrytb.Name, findtrytbPkCsName)); | ||||
|                                 trytb.AddOrUpdateTableRef(pnv.Name, nvref); | ||||
|                                 //if (isLazy) throw nvref.Exception; | ||||
|                                 break; | ||||
| @@ -906,14 +906,14 @@ namespace FreeSql.Internal | ||||
|                                 } | ||||
|                                 if (trycol != null && trycol.CsType.NullableTypeOrThis() != tbref.Primarys[a].CsType.NullableTypeOrThis()) | ||||
|                                 { | ||||
|                                     nvref.Exception = new Exception($"【ManyToMany】导航属性 {trytbTypeName}.{pnv.Name} 解析错误,{tbmid.CsName}.{trycol.CsName} 和 {tbref.CsName}.{tbref.Primarys[a].CsName} 类型不一致"); | ||||
|                                     nvref.Exception = new Exception(CoreStrings.ManyToMany_ParsingError_InconsistentType(trytbTypeName, pnv.Name, tbmid.CsName, trycol.CsName, trytb.CsName, trytb.Primarys[a].CsName)); | ||||
|                                     trytb.AddOrUpdateTableRef(pnv.Name, nvref); | ||||
|                                     //if (isLazy) throw nvref.Exception; | ||||
|                                     break; | ||||
|                                 } | ||||
|                                 if (trycol == null) | ||||
|                                 { | ||||
|                                     nvref.Exception = new Exception($"【ManyToMany】导航属性 {trytbTypeName}.{pnv.Name} 在 {tbmid.CsName} 中没有找到对应的字段,如:{midTypePropsTbref.Name}{findtbrefPkCsName}、{midTypePropsTbref.Name}_{findtbrefPkCsName}"); | ||||
|                                     nvref.Exception = new Exception(CoreStrings.ManyToMany_NotFound_CorrespondingField(trytbTypeName, pnv.Name, tbmid.CsName, midTypePropsTrytb.Name, findtbrefPkCsName)); | ||||
|                                     trytb.AddOrUpdateTableRef(pnv.Name, nvref); | ||||
|                                     //if (isLazy) throw nvref.Exception; | ||||
|                                     break; | ||||
| @@ -987,7 +987,7 @@ namespace FreeSql.Internal | ||||
|                         { | ||||
|                             if (tbref.ColumnsByCs.TryGetValue(bi, out var trybindcol) == false) | ||||
|                             { | ||||
|                                 nvref.Exception = new Exception($"导航属性 {trytbTypeName}.{pnv.Name} 特性 [Navigate] 解析错误,在 {tbrefTypeName} 未找到属性:{bi}"); | ||||
|                                 nvref.Exception = new Exception(CoreStrings.Navigation_ParsingError_NotFound_Property(trytbTypeName, pnv.Name, tbrefTypeName, bi)); | ||||
|                                 trytb.AddOrUpdateTableRef(pnv.Name, nvref); | ||||
|                                 //if (isLazy) throw nvref.Exception; | ||||
|                                 break; | ||||
| @@ -1003,7 +1003,7 @@ namespace FreeSql.Internal | ||||
|  | ||||
|                     if (nvref.Exception == null && bindColumns.Any() && bindColumns.Count != trytb.Primarys.Length) | ||||
|                     { | ||||
|                         nvref.Exception = new Exception($"导航属性 {trytbTypeName}.{pnv.Name} 特性 [Navigate] Bind 数目({bindColumns.Count}) 与 内部主键数目({trytb.Primarys.Length}) 不相同"); | ||||
|                         nvref.Exception = new Exception(CoreStrings.Navigation_Bind_Number_Different(trytbTypeName, pnv.Name, bindColumns.Count, trytb.Primarys.Length)); | ||||
|                         trytb.AddOrUpdateTableRef(pnv.Name, nvref); | ||||
|                         //if (isLazy) throw nvref.Exception; | ||||
|                     } | ||||
| @@ -1043,14 +1043,15 @@ namespace FreeSql.Internal | ||||
|                         } | ||||
|                         if (trycol != null && trycol.CsType.NullableTypeOrThis() != trytb.Primarys[a].CsType.NullableTypeOrThis()) | ||||
|                         { | ||||
|                             nvref.Exception = new Exception($"【OneToMany】导航属性 {trytbTypeName}.{pnv.Name} 解析错误,{trytb.CsName}.{trytb.Primarys[a].CsName} 和 {tbref.CsName}.{trycol.CsName} 类型不一致"); | ||||
|                             nvref.Exception = new Exception(CoreStrings.OneToMany_ParsingError_InconsistentType(trytbTypeName, pnv.Name, trytb.CsName, trytb.Primarys[a].CsName, tbref.CsName, trycol.CsName)); | ||||
|                             trytb.AddOrUpdateTableRef(pnv.Name, nvref); | ||||
|                             //if (isLazy) throw nvref.Exception; | ||||
|                             break; | ||||
|                         } | ||||
|                         if (trycol == null) | ||||
|                         { | ||||
|                             nvref.Exception = new Exception($"【OneToMany】导航属性 {trytbTypeName}.{pnv.Name} 在 {tbref.CsName} 中没有找到对应的字段,如:{findtrytb}{findtrytbPkCsName}、{findtrytb}_{findtrytbPkCsName}" + (refprop == null ? "" : $"、{refprop.Name}{findtrytbPkCsName}、{refprop.Name}_{findtrytbPkCsName}。或者使用 [Navigate] 特性指定关系映射。")); | ||||
|                             nvref.Exception = new Exception(CoreStrings.OneToMany_NotFound_CorrespondingField(trytbTypeName, pnv.Name, tbref.CsName, findtrytb, findtrytbPkCsName) | ||||
|                                 + (refprop == null ? "" : CoreStrings.OneToMany_UseNavigate(refprop.Name, findtrytbPkCsName))); | ||||
|                             trytb.AddOrUpdateTableRef(pnv.Name, nvref); | ||||
|                             //if (isLazy) throw nvref.Exception; | ||||
|                             break; | ||||
| @@ -1127,7 +1128,7 @@ namespace FreeSql.Internal | ||||
|                 if (tbref == null) return; | ||||
|                 if (tbref.Primarys.Any() == false) | ||||
|                 { | ||||
|                     nvref.Exception = new Exception($"导航属性 {trytbTypeName}.{pnv.Name} 解析错误,实体类型 {propTypeName} 缺少主键标识,[Column(IsPrimary = true)]"); | ||||
|                     nvref.Exception = new Exception(CoreStrings.Navigation_ParsingError_EntityMissingPrimaryKey(trytbTypeName, pnv.Name, propTypeName)); | ||||
|                     trytb.AddOrUpdateTableRef(pnv.Name, nvref); | ||||
|                     //if (isLazy) throw nvref.Exception; | ||||
|                 } | ||||
| @@ -1144,7 +1145,7 @@ namespace FreeSql.Internal | ||||
|                     { | ||||
|                         if (trytb.ColumnsByCs.TryGetValue(bi, out var trybindcol) == false) | ||||
|                         { | ||||
|                             nvref.Exception = new Exception($"导航属性 {trytbTypeName}.{pnv.Name} 特性 [Navigate] 解析错误,在 {trytbTypeName} 未找到属性:{bi}"); | ||||
|                             nvref.Exception = new Exception(CoreStrings.Navigation_ParsingError_NotFound_Property(trytbTypeName, pnv.Name, trytbTypeName, bi)); | ||||
|                             trytb.AddOrUpdateTableRef(pnv.Name, nvref); | ||||
|                             //if (isLazy) throw nvref.Exception; | ||||
|                             break; | ||||
| @@ -1156,7 +1157,7 @@ namespace FreeSql.Internal | ||||
|  | ||||
|                 if (nvref.Exception == null && bindColumns.Any() && bindColumns.Count != tbref.Primarys.Length) | ||||
|                 { | ||||
|                     nvref.Exception = new Exception($"导航属性 {trytbTypeName}.{pnv.Name} 特性 [Navigate] Bind 数目({bindColumns.Count}) 与 外部主键数目({tbref.Primarys.Length}) 不相同"); | ||||
|                     nvref.Exception = new Exception(CoreStrings.Navigation_Bind_Number_Different(trytbTypeName, pnv.Name, bindColumns.Count, tbref.Primarys.Length)); | ||||
|                     trytb.AddOrUpdateTableRef(pnv.Name, nvref); | ||||
|                     //if (isLazy) throw nvref.Exception; | ||||
|                 } | ||||
| @@ -1211,14 +1212,14 @@ namespace FreeSql.Internal | ||||
|                     } | ||||
|                     if (trycol != null && trycol.CsType.NullableTypeOrThis() != tbref.Primarys[a].CsType.NullableTypeOrThis()) | ||||
|                     { | ||||
|                         nvref.Exception = new Exception($"导航属性 {trytbTypeName}.{pnv.Name} 解析错误,{trytb.CsName}.{trycol.CsName} 和 {tbref.CsName}.{tbref.Primarys[a].CsName} 类型不一致"); | ||||
|                         nvref.Exception = new Exception(CoreStrings.Navigation_ParsingError_InconsistentType(trytbTypeName, pnv.Name, trytb.CsName, trycol.CsName, tbref.CsName, tbref.Primarys[a].CsName)); | ||||
|                         trytb.AddOrUpdateTableRef(pnv.Name, nvref); | ||||
|                         //if (isLazy) throw nvref.Exception; | ||||
|                         break; | ||||
|                     } | ||||
|                     if (trycol == null) | ||||
|                     { | ||||
|                         nvref.Exception = new Exception($"导航属性 {trytbTypeName}.{pnv.Name} 没有找到对应的字段,如:{pnv.Name}{findtbrefPkCsName}、{pnv.Name}_{findtbrefPkCsName}。或者使用 [Navigate] 特性指定关系映射。"); | ||||
|                         nvref.Exception = new Exception(CoreStrings.Navigation_NotFound_CorrespondingField(trytbTypeName, pnv.Name, findtbrefPkCsName)); | ||||
|                         trytb.AddOrUpdateTableRef(pnv.Name, nvref); | ||||
|                         //if (isLazy) throw nvref.Exception; | ||||
|                         break; | ||||
| @@ -1793,7 +1794,7 @@ namespace FreeSql.Internal | ||||
|                 var parmValue = Expression.Parameter(typeof(object), "value"); | ||||
|                 Expression exp = Expression.Convert(parmInfo, typeObj); | ||||
|                 foreach (var pro in memberAccessPath.Split('.')) | ||||
|                     exp = Expression.PropertyOrField(exp, pro) ?? throw new Exception(string.Concat(exp.Type.FullName, " 没有定义属性 ", pro)); | ||||
|                     exp = Expression.PropertyOrField(exp, pro) ?? throw new Exception(string.Concat(exp.Type.FullName, CoreStrings.NoProperty_Defined, pro)); | ||||
|  | ||||
|                 var value2 = Expression.Call(MethodGetDataReaderValue, Expression.Constant(exp.Type), parmValue); | ||||
|                 var value3 = Expression.Convert(parmValue, typeValue); | ||||
| @@ -2261,7 +2262,7 @@ namespace FreeSql.Internal | ||||
|             } | ||||
|             catch (Exception ex) | ||||
|             { | ||||
|                 throw new ArgumentException($"ExpressionTree 转换类型错误,值({string.Concat(value)}),类型({value.GetType().FullName}),目标类型({type.FullName}),{ex.Message}"); | ||||
|                 throw new ArgumentException(CoreStrings.ExpressionTree_Convert_Type_Error(string.Concat(value), value.GetType().FullName, type.FullName, ex.Message)); | ||||
|             } | ||||
|         } | ||||
|         public static string GetCsName(string name) | ||||
| @@ -2359,7 +2360,7 @@ namespace FreeSql.Internal | ||||
|                         var ltidx = ltidxStack.Pop(); | ||||
|                         var ltidx2 = ltidx; | ||||
|                         var sidx2 = sidx; | ||||
|                         while(sidx < locsql.Length) | ||||
|                         while (sidx < locsql.Length) | ||||
|                         { | ||||
|                             var chr2 = locsql[sidx]; | ||||
|                             if (chr2 == ')') | ||||
|   | ||||
							
								
								
									
										977
									
								
								FreeSql/Properties/CoreStrings.Designer.cs
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										977
									
								
								FreeSql/Properties/CoreStrings.Designer.cs
									
									
									
										generated
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,977 @@ | ||||
|  | ||||
| // <auto-generated /> | ||||
|  | ||||
| using System; | ||||
| using System.Reflection; | ||||
| using System.Resources; | ||||
| using System.Threading; | ||||
|  | ||||
| namespace FreeSql | ||||
| { | ||||
|     /// <summary> | ||||
|     ///     <para> | ||||
|     ///		    String resources used in FreeSql exceptions, etc. | ||||
|     ///     </para> | ||||
|     ///     <para> | ||||
|     ///		    These strings are exposed publicly for use by database providers and extensions. | ||||
|     ///         It is unusual for application code to need these strings. | ||||
|     ///     </para> | ||||
|     /// </summary> | ||||
|     public static class CoreStrings | ||||
|     { | ||||
|         private static readonly ResourceManager _resourceManager | ||||
|             = new ResourceManager("FreeSql.Properties.CoreStrings", typeof(CoreStrings).Assembly); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// [Table(AsTable = "{asTable}")] 特性值格式错误 | ||||
|         /// </summary> | ||||
|         public static string AsTable_PropertyName_FormatError(object asTable) | ||||
|             => string.Format( | ||||
|                 GetString("AsTable_PropertyName_FormatError", nameof(asTable)), | ||||
|                 asTable); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// [Table(AsTable = xx)] 设置的属性名 {atmGroupsValue} 不是 DateTime 类型 | ||||
|         /// </summary> | ||||
|         public static string AsTable_PropertyName_NotDateTime(object atmGroupsValue) | ||||
|             => string.Format( | ||||
|                 GetString("AsTable_PropertyName_NotDateTime", nameof(atmGroupsValue)), | ||||
|                 atmGroupsValue); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// {name}: Failed to get resource {statistics} | ||||
|         /// </summary> | ||||
|         public static string Available_Failed_Get_Resource(object name, object statistics) | ||||
|             => string.Format( | ||||
|                 GetString("Available_Failed_Get_Resource", nameof(name), nameof(statistics)), | ||||
|                 name, statistics); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// {name}: An exception needs to be thrown | ||||
|         /// </summary> | ||||
|         public static string Available_Thrown_Exception(object name) | ||||
|             => string.Format( | ||||
|                 GetString("Available_Thrown_Exception", nameof(name)), | ||||
|                 name); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 错误的表达式格式 {column} | ||||
|         /// </summary> | ||||
|         public static string Bad_Expression_Format(object column) | ||||
|             => string.Format( | ||||
|                 GetString("Bad_Expression_Format", nameof(column)), | ||||
|                 column); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Chunk 功能之前不可使用 Select | ||||
|         /// </summary> | ||||
|         public static string Before_Chunk_Cannot_Use_Select | ||||
|             => GetString("Before_Chunk_Cannot_Use_Select"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 安全起见,请务必在事务开启之后,再使用 ForUpdate | ||||
|         /// </summary> | ||||
|         public static string Begin_Transaction_Then_ForUpdate | ||||
|             => GetString("Begin_Transaction_Then_ForUpdate"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 不能为 null | ||||
|         /// </summary> | ||||
|         public static string Cannot_Be_NULL | ||||
|             => GetString("Cannot_Be_NULL"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// {name} 不能为 null | ||||
|         /// </summary> | ||||
|         public static string Cannot_Be_NULL_Name(object name) | ||||
|             => string.Format( | ||||
|                 GetString("Cannot_Be_NULL_Name", nameof(name)), | ||||
|                 name); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 无法匹配 {property} | ||||
|         /// </summary> | ||||
|         public static string Cannot_Match_Property(object property) | ||||
|             => string.Format( | ||||
|                 GetString("Cannot_Match_Property", nameof(property)), | ||||
|                 property); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// {property} 无法解析为表达式树 | ||||
|         /// </summary> | ||||
|         public static string Cannot_Resolve_ExpressionTree(object property) | ||||
|             => string.Format( | ||||
|                 GetString("Cannot_Resolve_ExpressionTree", nameof(property)), | ||||
|                 property); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 参数 masterConnectionString 不可为空,请检查 UseConnectionString | ||||
|         /// </summary> | ||||
|         public static string Check_UseConnectionString | ||||
|             => GetString("Check_UseConnectionString"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 提交 | ||||
|         /// </summary> | ||||
|         public static string Commit | ||||
|             => GetString("Commit"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 连接失败,准备切换其他可用服务器 | ||||
|         /// </summary> | ||||
|         public static string Connection_Failed_Switch_Servers | ||||
|             => GetString("Connection_Failed_Switch_Servers"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 自定义表达式解析错误:类型 {exp3MethodDeclaringType} 需要定义 static ThreadLocal<ExpressionCallContext> 字段、字段、字段(重要三次提醒) | ||||
|         /// </summary> | ||||
|         public static string Custom_Expression_ParsingError(object exp3MethodDeclaringType) | ||||
|             => string.Format( | ||||
|                 GetString("Custom_Expression_ParsingError", nameof(exp3MethodDeclaringType)), | ||||
|                 exp3MethodDeclaringType); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Custom { 反射信息 }不能为空,格式:{ 静态方法名 }{ 空格 }{ 反射信息 } | ||||
|         /// </summary> | ||||
|         public static string Custom_Reflection_IsNotNull | ||||
|             => GetString("Custom_Reflection_IsNotNull"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Custom { 静态方法名 }不能为空,格式:{ 静态方法名 }{ 空格 }{ 反射信息 } | ||||
|         /// </summary> | ||||
|         public static string Custom_StaticMethodName_IsNotNull | ||||
|             => GetString("Custom_StaticMethodName_IsNotNull"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Custom 对应的{{ 静态方法名 }}:{fiValueCustomArray} 未设置 [DynamicFilterCustomAttribute] 特性 | ||||
|         /// </summary> | ||||
|         public static string Custom_StaticMethodName_NotSet_DynamicFilterCustom(object fiValueCustomArray) | ||||
|             => string.Format( | ||||
|                 GetString("Custom_StaticMethodName_NotSet_DynamicFilterCustom", nameof(fiValueCustomArray)), | ||||
|                 fiValueCustomArray); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Custom 要求 Field 应该空格分割,并且长度为 2,格式:{ 静态方法名 }{ 空格 }{ 反射信息 } | ||||
|         /// </summary> | ||||
|         public static string CustomFieldSeparatedBySpaces | ||||
|             => GetString("CustomFieldSeparatedBySpaces"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 操作的数据类型({dataDisplayCsharp}) 与 AsType({tableTypeDisplayCsharp}) 不一致,请检查。 | ||||
|         /// </summary> | ||||
|         public static string DataType_AsType_Inconsistent(object dataDisplayCsharp, object tableTypeDisplayCsharp) | ||||
|             => string.Format( | ||||
|                 GetString("DataType_AsType_Inconsistent", nameof(dataDisplayCsharp), nameof(tableTypeDisplayCsharp)), | ||||
|                 dataDisplayCsharp, tableTypeDisplayCsharp); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// DateRange 要求 Value 应该逗号分割,并且长度为 2 | ||||
|         /// </summary> | ||||
|         public static string DateRange_Comma_Separateda_By2Char | ||||
|             => GetString("DateRange_Comma_Separateda_By2Char"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// DateRange 要求 Value[1] 格式必须为:yyyy、yyyy-MM、yyyy-MM-dd、yyyy-MM-dd HH、yyyy、yyyy-MM-dd HH:mm | ||||
|         /// </summary> | ||||
|         public static string DateRange_DateFormat_yyyy | ||||
|             => GetString("DateRange_DateFormat_yyyy"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 记录可能不存在,或者【行级乐观锁】版本过旧,更新数量{sourceCount},影响的行数{affrows}。 | ||||
|         /// </summary> | ||||
|         public static string DbUpdateVersionException_RowLevelOptimisticLock(object sourceCount, object affrows) | ||||
|             => string.Format( | ||||
|                 GetString("DbUpdateVersionException_RowLevelOptimisticLock", nameof(sourceCount), nameof(affrows)), | ||||
|                 sourceCount, affrows); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// SlaveConnectionString 数量与 SlaveWeights 不相同 | ||||
|         /// </summary> | ||||
|         public static string Different_Number_SlaveConnectionString_SlaveWeights | ||||
|             => GetString("Different_Number_SlaveConnectionString_SlaveWeights"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// ColumnAttribute.Name {colattrName} 重复存在,请检查(注意:不区分大小写) | ||||
|         /// </summary> | ||||
|         public static string Duplicate_ColumnAttribute(object colattrName) | ||||
|             => string.Format( | ||||
|                 GetString("Duplicate_ColumnAttribute", nameof(colattrName)), | ||||
|                 colattrName); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 属性名 {pName} 重复存在,请检查(注意:不区分大小写) | ||||
|         /// </summary> | ||||
|         public static string Duplicate_PropertyName(object pName) | ||||
|             => string.Format( | ||||
|                 GetString("Duplicate_PropertyName", nameof(pName)), | ||||
|                 pName); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// {function} 功能要求实体类 {tableCsName} 必须有主键 | ||||
|         /// </summary> | ||||
|         public static string Entity_Must_Primary_Key(object function, object tableCsName) | ||||
|             => string.Format( | ||||
|                 GetString("Entity_Must_Primary_Key", nameof(function), nameof(tableCsName)), | ||||
|                 function, tableCsName); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// {tbTypeFullName} 是父子关系,但是 MySql 8.0 以下版本中不支持组合多主键 | ||||
|         /// </summary> | ||||
|         public static string Entity_MySQL_VersionsBelow8_NotSupport_Multiple_PrimaryKeys(object tbTypeFullName) | ||||
|             => string.Format( | ||||
|                 GetString("Entity_MySQL_VersionsBelow8_NotSupport_Multiple_PrimaryKeys", nameof(tbTypeFullName)), | ||||
|                 tbTypeFullName); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// {tbTypeFullName} 不是父子关系,无法使用该功能 | ||||
|         /// </summary> | ||||
|         public static string Entity_NotParentChild_Relationship(object tbTypeFullName) | ||||
|             => string.Format( | ||||
|                 GetString("Entity_NotParentChild_Relationship", nameof(tbTypeFullName)), | ||||
|                 tbTypeFullName); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 这个特别的子查询不能解析 | ||||
|         /// </summary> | ||||
|         public static string EspeciallySubquery_Cannot_Parsing | ||||
|             => GetString("EspeciallySubquery_Cannot_Parsing"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 表达式错误,它的顶级对象不是 ParameterExpression:{exp} | ||||
|         /// </summary> | ||||
|         public static string Expression_Error_Use_ParameterExpression(object exp) | ||||
|             => string.Format( | ||||
|                 GetString("Expression_Error_Use_ParameterExpression", nameof(exp)), | ||||
|                 exp); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 表达式错误,它不是连续的 MemberAccess 类型:{exp} | ||||
|         /// </summary> | ||||
|         public static string Expression_Error_Use_Successive_MemberAccess_Type(object exp) | ||||
|             => string.Format( | ||||
|                 GetString("Expression_Error_Use_Successive_MemberAccess_Type", nameof(exp)), | ||||
|                 exp); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// ExpressionTree 转换类型错误,值({value}),类型({valueTypeFullName}),目标类型({typeFullName}),{exMessage} | ||||
|         /// </summary> | ||||
|         public static string ExpressionTree_Convert_Type_Error(object value, object valueTypeFullName, object typeFullName, object exMessage) | ||||
|             => string.Format( | ||||
|                 GetString("ExpressionTree_Convert_Type_Error", nameof(value), nameof(valueTypeFullName), nameof(typeFullName), nameof(exMessage)), | ||||
|                 value, valueTypeFullName, typeFullName, exMessage); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 未能解析分表字段值 {sqlWhere} | ||||
|         /// </summary> | ||||
|         public static string Failed_SubTable_FieldValue(object sqlWhere) | ||||
|             => string.Format( | ||||
|                 GetString("Failed_SubTable_FieldValue", nameof(sqlWhere)), | ||||
|                 sqlWhere); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// AsTable 未实现的功能 {asTable} | ||||
|         /// </summary> | ||||
|         public static string Functions_AsTable_NotImplemented(object asTable) | ||||
|             => string.Format( | ||||
|                 GetString("Functions_AsTable_NotImplemented", nameof(asTable)), | ||||
|                 asTable); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// GBase 暂时不支持逗号以外的分割符 | ||||
|         /// </summary> | ||||
|         public static string GBase_NotSupport_OtherThanCommas | ||||
|             => GetString("GBase_NotSupport_OtherThanCommas"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// tableName:{tableName} 生成了相同的分表名 | ||||
|         /// </summary> | ||||
|         public static string Generated_Same_SubTable(object tableName) | ||||
|             => string.Format( | ||||
|                 GetString("Generated_Same_SubTable", nameof(tableName)), | ||||
|                 tableName); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// GetPrimarys 传递的参数 "{primary}" 不正确,它不属于字典数据的键名 | ||||
|         /// </summary> | ||||
|         public static string GetPrimarys_ParameterError_IsNotDictKey (object primary) | ||||
|             => string.Format( | ||||
|                 GetString("GetPrimarys_ParameterError_IsNotDictKey ", nameof(primary)), | ||||
|                 primary); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 已经指定了 {first},不能再指定 {second} | ||||
|         /// </summary> | ||||
|         public static string Has_Specified_Cannot_Specified_Second(object first, object second) | ||||
|             => string.Format( | ||||
|                 GetString("Has_Specified_Cannot_Specified_Second", nameof(first), nameof(second)), | ||||
|                 first, second); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// {tb2DbName}.{mp2MemberName} 被忽略,请检查 IsIgnore 设置,确认 get/set 为 public | ||||
|         /// </summary> | ||||
|         public static string Ignored_Check_Confirm_PublicGetSet(object tb2DbName, object mp2MemberName) | ||||
|             => string.Format( | ||||
|                 GetString("Ignored_Check_Confirm_PublicGetSet", nameof(tb2DbName), nameof(mp2MemberName)), | ||||
|                 tb2DbName, mp2MemberName); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Include 参数类型错误 | ||||
|         /// </summary> | ||||
|         public static string Include_ParameterType_Error | ||||
|             => GetString("Include_ParameterType_Error"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Include 参数类型错误,集合属性请使用 IncludeMany | ||||
|         /// </summary> | ||||
|         public static string Include_ParameterType_Error_Use_IncludeMany | ||||
|             => GetString("Include_ParameterType_Error_Use_IncludeMany"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Include 参数类型错误,表达式类型应该为 MemberAccess | ||||
|         /// </summary> | ||||
|         public static string Include_ParameterType_Error_Use_MemberAccess | ||||
|             => GetString("Include_ParameterType_Error_Use_MemberAccess"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// IncludeMany 类型 {tbTypeDisplayCsharp} 的属性 {collMemMemberName} 不是有效的导航属性,提示:IsIgnore = true 不会成为导航属性 | ||||
|         /// </summary> | ||||
|         public static string IncludeMany_NotValid_Navigation(object tbTypeDisplayCsharp, object collMemMemberName) | ||||
|             => string.Format( | ||||
|                 GetString("IncludeMany_NotValid_Navigation", nameof(tbTypeDisplayCsharp), nameof(collMemMemberName)), | ||||
|                 tbTypeDisplayCsharp, collMemMemberName); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// IncludeMany {navigateSelector} 参数错误,Select 只可以使用一个参数的方法,正确格式:.Select(t =>new TNavigate {{}}) | ||||
|         /// </summary> | ||||
|         public static string IncludeMany_ParameterError_OnlyUseOneParameter(object navigateSelector) | ||||
|             => string.Format( | ||||
|                 GetString("IncludeMany_ParameterError_OnlyUseOneParameter", nameof(navigateSelector)), | ||||
|                 navigateSelector); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// IncludeMany {navigateSelector} 参数错误,Select lambda参数返回值必须和 {collMemElementType} 类型一致 | ||||
|         /// </summary> | ||||
|         public static string IncludeMany_ParameterError_Select_ReturnConsistentType(object navigateSelector, object collMemElementType) | ||||
|             => string.Format( | ||||
|                 GetString("IncludeMany_ParameterError_Select_ReturnConsistentType", nameof(navigateSelector), nameof(collMemElementType)), | ||||
|                 navigateSelector, collMemElementType); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// IncludeMany 参数1 类型错误,表达式类型应该为 MemberAccess | ||||
|         /// </summary> | ||||
|         public static string IncludeMany_ParameterType_Error_Use_MemberAccess | ||||
|             => GetString("IncludeMany_ParameterType_Error_Use_MemberAccess"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// IncludeMany {navigateSelector} 参数类型错误,正确格式: a.collections.Take(1).Where(c =>c.aid == a.id).Select(a=> new TNavigate{{}}) | ||||
|         /// </summary> | ||||
|         public static string IncludeMany_ParameterTypeError(object navigateSelector) | ||||
|             => string.Format( | ||||
|                 GetString("IncludeMany_ParameterTypeError", nameof(navigateSelector)), | ||||
|                 navigateSelector); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// ISelect.InsertInto() 未选择属性: {displayCsharp} | ||||
|         /// </summary> | ||||
|         public static string InsertInto_No_Property_Selected(object displayCsharp) | ||||
|             => string.Format( | ||||
|                 GetString("InsertInto_No_Property_Selected", nameof(displayCsharp)), | ||||
|                 displayCsharp); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// ISelect.InsertInto() 类型错误: {displayCsharp} | ||||
|         /// </summary> | ||||
|         public static string InsertInto_TypeError(object displayCsharp) | ||||
|             => string.Format( | ||||
|                 GetString("InsertInto_TypeError", nameof(displayCsharp)), | ||||
|                 displayCsharp); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// InsertOrUpdate 功能执行 merge into 要求实体类 {CsName} 必须有主键 | ||||
|         /// </summary> | ||||
|         public static string InsertOrUpdate_Must_Primary_Key(object CsName) | ||||
|             => string.Format( | ||||
|                 GetString("InsertOrUpdate_Must_Primary_Key", nameof(CsName)), | ||||
|                 CsName); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// InsertOrUpdate<>的泛型参数 不支持 {typeofT1},请传递您的实体类 | ||||
|         /// </summary> | ||||
|         public static string InsertOrUpdate_NotSuport_Generic_UseEntity(object typeofT1) | ||||
|             => string.Format( | ||||
|                 GetString("InsertOrUpdate_NotSuport_Generic_UseEntity", nameof(typeofT1)), | ||||
|                 typeofT1); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 【延时加载】功能需要安装 FreeSql.Extensions.LazyLoading.dll,可前往 nuget 下载 | ||||
|         /// </summary> | ||||
|         public static string Install_FreeSql_Extensions_LazyLoading | ||||
|             => GetString("Install_FreeSql_Extensions_LazyLoading"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 【延时加载】{trytbTypeName} 编译错误:{exMessage}\r\n\r\n{cscode} | ||||
|         /// </summary> | ||||
|         public static string LazyLoading_CompilationError(object trytbTypeName, object exMessage, object cscode) | ||||
|             => string.Format( | ||||
|                 GetString("LazyLoading_CompilationError", nameof(trytbTypeName), nameof(exMessage), nameof(cscode)), | ||||
|                 trytbTypeName, exMessage, cscode); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 【延时加载】实体类型 {trytbTypeName} 必须声明为 public | ||||
|         /// </summary> | ||||
|         public static string LazyLoading_EntityMustDeclarePublic(object trytbTypeName) | ||||
|             => string.Format( | ||||
|                 GetString("LazyLoading_EntityMustDeclarePublic", nameof(trytbTypeName)), | ||||
|                 trytbTypeName); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// ManyToMany 导航属性 .AsSelect() 暂时不可用于 Sum/Avg/Max/Min/First/ToOne/ToList 方法 | ||||
|         /// </summary> | ||||
|         public static string ManyToMany_AsSelect_NotSupport_Sum_Avg_etc | ||||
|             => GetString("ManyToMany_AsSelect_NotSupport_Sum_Avg_etc"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 在 {tbmidCsName} 中没有找到对应的字段,如:{midTypePropsTrytbName}{findtrytbPkCsName}、{midTypePropsTrytbName}_{findtrytbPkCsName} | ||||
|         /// </summary> | ||||
|         public static string ManyToMany_NotFound_CorrespondingField(object trytbTypeName, object pnvName, object tbmidCsName, object midTypePropsTrytbName, object findtrytbPkCsName) | ||||
|             => string.Format( | ||||
|                 GetString("ManyToMany_NotFound_CorrespondingField", nameof(trytbTypeName), nameof(pnvName), nameof(tbmidCsName), nameof(midTypePropsTrytbName), nameof(findtrytbPkCsName)), | ||||
|                 trytbTypeName, pnvName, tbmidCsName, midTypePropsTrytbName, findtrytbPkCsName); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,实体类型 {tbrefTypeName} 缺少主键标识,[Column(IsPrimary = true)] | ||||
|         /// </summary> | ||||
|         public static string ManyToMany_ParsingError_EntityMissing_PrimaryKey(object trytbTypeName, object pnvName, object tbrefTypeName) | ||||
|             => string.Format( | ||||
|                 GetString("ManyToMany_ParsingError_EntityMissing_PrimaryKey", nameof(trytbTypeName), nameof(pnvName), nameof(tbrefTypeName)), | ||||
|                 trytbTypeName, pnvName, tbrefTypeName); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,实体类型 {tbrefTypeName} 必须存在对应的 [Navigate(ManyToMany = x)] 集合属性 | ||||
|         /// </summary> | ||||
|         public static string ManyToMany_ParsingError_EntityMustHas_NavigateCollection(object trytbTypeName, object pnvName, object tbrefTypeName) | ||||
|             => string.Format( | ||||
|                 GetString("ManyToMany_ParsingError_EntityMustHas_NavigateCollection", nameof(trytbTypeName), nameof(pnvName), nameof(tbrefTypeName)), | ||||
|                 trytbTypeName, pnvName, tbrefTypeName); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,{tbmidCsName}.{trycolCsName} 和 {trytbCsName}.{trytbPrimarysCsName} 类型不一致 | ||||
|         /// </summary> | ||||
|         public static string ManyToMany_ParsingError_InconsistentType(object trytbTypeName, object pnvName, object tbmidCsName, object trycolCsName, object trytbCsName, object trytbPrimarysCsName) | ||||
|             => string.Format( | ||||
|                 GetString("ManyToMany_ParsingError_InconsistentType", nameof(trytbTypeName), nameof(pnvName), nameof(tbmidCsName), nameof(trycolCsName), nameof(trytbCsName), nameof(trytbPrimarysCsName)), | ||||
|                 trytbTypeName, pnvName, tbmidCsName, trycolCsName, trytbCsName, trytbPrimarysCsName); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,中间类 {tbmidCsName}.{midTypePropsTrytbName} 错误:{exMessage} | ||||
|         /// </summary> | ||||
|         public static string ManyToMany_ParsingError_IntermediateClass_ErrorMessage(object trytbTypeName, object pnvName, object tbmidCsName, object midTypePropsTrytbName, object exMessage) | ||||
|             => string.Format( | ||||
|                 GetString("ManyToMany_ParsingError_IntermediateClass_ErrorMessage", nameof(trytbTypeName), nameof(pnvName), nameof(tbmidCsName), nameof(midTypePropsTrytbName), nameof(exMessage)), | ||||
|                 trytbTypeName, pnvName, tbmidCsName, midTypePropsTrytbName, exMessage); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,中间类 {tbmidCsName}.{midTypePropsTrytbName} 导航属性不是【ManyToOne】或【OneToOne】 | ||||
|         /// </summary> | ||||
|         public static string ManyToMany_ParsingError_IntermediateClass_NotManyToOne_OneToOne(object trytbTypeName, object pnvName, object tbmidCsName, object midTypePropsTrytbName) | ||||
|             => string.Format( | ||||
|                 GetString("ManyToMany_ParsingError_IntermediateClass_NotManyToOne_OneToOne", nameof(trytbTypeName), nameof(pnvName), nameof(tbmidCsName), nameof(midTypePropsTrytbName)), | ||||
|                 trytbTypeName, pnvName, tbmidCsName, midTypePropsTrytbName); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 映射异常:{name} 没有一个属性名相同 | ||||
|         /// </summary> | ||||
|         public static string Mapping_Exception_HasNo_SamePropertyName(object name) | ||||
|             => string.Format( | ||||
|                 GetString("Mapping_Exception_HasNo_SamePropertyName", nameof(name)), | ||||
|                 name); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Ado.MasterPool 值为 null,该操作无法自启用事务,请显式传递【事务对象】解决 | ||||
|         /// </summary> | ||||
|         public static string MasterPool_IsNull_UseTransaction | ||||
|             => GetString("MasterPool_IsNull_UseTransaction"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 缺少 FreeSql 数据库实现包:FreeSql.Provider.{Provider}.dll,可前往 nuget 下载 | ||||
|         /// </summary> | ||||
|         public static string Missing_FreeSqlProvider_Package(object Provider) | ||||
|             => string.Format( | ||||
|                 GetString("Missing_FreeSqlProvider_Package", nameof(Provider)), | ||||
|                 Provider); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 缺少 FreeSql 数据库实现包:{dll},可前往 nuget 下载;如果存在 {dll} 依然报错(原因是环境问题导致反射不到类型),请在 UseConnectionString/UseConnectionFactory 第三个参数手工传入 typeof({providerType}) | ||||
|         /// </summary> | ||||
|         public static string Missing_FreeSqlProvider_Package_Reason(object dll, object providerType) | ||||
|             => string.Format( | ||||
|                 GetString("Missing_FreeSqlProvider_Package_Reason", nameof(dll), nameof(providerType)), | ||||
|                 dll, providerType); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 导航属性 {trytbTypeName}.{pnvName} 特性 [Navigate] Bind 数目({bindColumnsCount}) 与 外部主键数目({tbrefPrimarysLength}) 不相同 | ||||
|         /// </summary> | ||||
|         public static string Navigation_Bind_Number_Different(object trytbTypeName, object pnvName, object bindColumnsCount, object tbrefPrimarysLength) | ||||
|             => string.Format( | ||||
|                 GetString("Navigation_Bind_Number_Different", nameof(trytbTypeName), nameof(pnvName), nameof(bindColumnsCount), nameof(tbrefPrimarysLength)), | ||||
|                 trytbTypeName, pnvName, bindColumnsCount, tbrefPrimarysLength); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// {tb2DbName}.{mp2MemberName} 导航属性集合忘了 .AsSelect() 吗?如果在 ToList(a => a.{mp2MemberName}) 中使用,请移步参考 IncludeMany 文档。 | ||||
|         /// </summary> | ||||
|         public static string Navigation_Missing_AsSelect(object tb2DbName, object mp2MemberName) | ||||
|             => string.Format( | ||||
|                 GetString("Navigation_Missing_AsSelect", nameof(tb2DbName), nameof(mp2MemberName)), | ||||
|                 tb2DbName, mp2MemberName); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 【导航属性】{trytbTypeDisplayCsharp}.{pName} 缺少 set 属性 | ||||
|         /// </summary> | ||||
|         public static string Navigation_Missing_SetProperty(object trytbTypeDisplayCsharp, object pName) | ||||
|             => string.Format( | ||||
|                 GetString("Navigation_Missing_SetProperty", nameof(trytbTypeDisplayCsharp), nameof(pName)), | ||||
|                 trytbTypeDisplayCsharp, pName); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 导航属性 {trytbTypeName}.{pnvName} 没有找到对应的字段,如:{pnvName}{findtbrefPkCsName}、{pnvName}_{findtbrefPkCsName}。或者使用 [Navigate] 特性指定关系映射。 | ||||
|         /// </summary> | ||||
|         public static string Navigation_NotFound_CorrespondingField(object trytbTypeName, object pnvName, object findtbrefPkCsName) | ||||
|             => string.Format( | ||||
|                 GetString("Navigation_NotFound_CorrespondingField", nameof(trytbTypeName), nameof(pnvName), nameof(findtbrefPkCsName)), | ||||
|                 trytbTypeName, pnvName, findtbrefPkCsName); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 导航属性 {trytbTypeName}.{pnvName} 解析错误,实体类型 {trytcTypeName} 缺少主键标识,[Column(IsPrimary = true)] | ||||
|         /// </summary> | ||||
|         public static string Navigation_ParsingError_EntityMissingPrimaryKey(object trytbTypeName, object pnvName, object trytcTypeName) | ||||
|             => string.Format( | ||||
|                 GetString("Navigation_ParsingError_EntityMissingPrimaryKey", nameof(trytbTypeName), nameof(pnvName), nameof(trytcTypeName)), | ||||
|                 trytbTypeName, pnvName, trytcTypeName); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 导航属性 {trytbTypeName}.{pnvName} 解析错误,{trytbCsName}.{trycolCsName} 和 {tbrefCsName}.{tbrefPrimarysCsName} 类型不一致 | ||||
|         /// </summary> | ||||
|         public static string Navigation_ParsingError_InconsistentType(object trytbTypeName, object pnvName, object trytbCsName, object trycolCsName, object tbrefCsName, object tbrefPrimarysCsName) | ||||
|             => string.Format( | ||||
|                 GetString("Navigation_ParsingError_InconsistentType", nameof(trytbTypeName), nameof(pnvName), nameof(trytbCsName), nameof(trycolCsName), nameof(tbrefCsName), nameof(tbrefPrimarysCsName)), | ||||
|                 trytbTypeName, pnvName, trytbCsName, trycolCsName, tbrefCsName, tbrefPrimarysCsName); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 导航属性 {trytbTypeName}.{pnvName} 特性 [Navigate] 解析错误,在 {tbrefTypeName} 未找到属性:{bi} | ||||
|         /// </summary> | ||||
|         public static string Navigation_ParsingError_NotFound_Property(object trytbTypeName, object pnvName, object tbrefTypeName, object bi) | ||||
|             => string.Format( | ||||
|                 GetString("Navigation_ParsingError_NotFound_Property", nameof(trytbTypeName), nameof(pnvName), nameof(tbrefTypeName), nameof(bi)), | ||||
|                 trytbTypeName, pnvName, tbrefTypeName, bi); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// {tableTypeDisplayCsharp} 没有定义主键,无法使用 SetSource,请尝试 SetDto | ||||
|         /// </summary> | ||||
|         public static string NoPrimaryKey_UseSetDto(object tableTypeDisplayCsharp) | ||||
|             => string.Format( | ||||
|                 GetString("NoPrimaryKey_UseSetDto", nameof(tableTypeDisplayCsharp)), | ||||
|                 tableTypeDisplayCsharp); | ||||
|  | ||||
|         /// <summary> | ||||
|         ///  没有定义属性  | ||||
|         /// </summary> | ||||
|         public static string NoProperty_Defined | ||||
|             => GetString("NoProperty_Defined"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 未实现 | ||||
|         /// </summary> | ||||
|         public static string Not_Implemented | ||||
|             => GetString("Not_Implemented"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 未实现函数表达式 {exp} 解析 | ||||
|         /// </summary> | ||||
|         public static string Not_Implemented_Expression(object exp) | ||||
|             => string.Format( | ||||
|                 GetString("Not_Implemented_Expression", nameof(exp)), | ||||
|                 exp); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 未实现函数表达式 {exp} 解析,参数 {expArguments} 必须为常量 | ||||
|         /// </summary> | ||||
|         public static string Not_Implemented_Expression_ParameterUseConstant(object exp, object expArguments) | ||||
|             => string.Format( | ||||
|                 GetString("Not_Implemented_Expression_ParameterUseConstant", nameof(exp), nameof(expArguments)), | ||||
|                 exp, expArguments); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 未实现函数表达式 {exp} 解析,如果正在操作导航属性集合,请使用 .AsSelect().{exp3MethodName}({exp3ArgumentsCount}) | ||||
|         /// </summary> | ||||
|         public static string Not_Implemented_Expression_UseAsSelect(object exp, object exp3MethodName, object exp3ArgumentsCount) | ||||
|             => string.Format( | ||||
|                 GetString("Not_Implemented_Expression_UseAsSelect", nameof(exp), nameof(exp3MethodName), nameof(exp3ArgumentsCount)), | ||||
|                 exp, exp3MethodName, exp3ArgumentsCount); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 未实现 MemberAccess 下的 Constant | ||||
|         /// </summary> | ||||
|         public static string Not_Implemented_MemberAcess_Constant | ||||
|             => GetString("Not_Implemented_MemberAcess_Constant"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 未实现 {name} | ||||
|         /// </summary> | ||||
|         public static string Not_Implemented_Name(object name) | ||||
|             => string.Format( | ||||
|                 GetString("Not_Implemented_Name", nameof(name)), | ||||
|                 name); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 不支持 | ||||
|         /// </summary> | ||||
|         public static string Not_Support | ||||
|             => GetString("Not_Support"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// {dataType} 不支持 OrderByRandom 随机排序 | ||||
|         /// </summary> | ||||
|         public static string Not_Support_OrderByRandom(object dataType) | ||||
|             => string.Format( | ||||
|                 GetString("Not_Support_OrderByRandom", nameof(dataType)), | ||||
|                 dataType); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// {property} 不是有效的导航属性 | ||||
|         /// </summary> | ||||
|         public static string Not_Valid_Navigation_Property(object property) | ||||
|             => string.Format( | ||||
|                 GetString("Not_Valid_Navigation_Property", nameof(property)), | ||||
|                 property); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// {dbName} 找不到列 {memberName} | ||||
|         /// </summary> | ||||
|         public static string NotFound_Column(object dbName, object memberName) | ||||
|             => string.Format( | ||||
|                 GetString("NotFound_Column", nameof(dbName), nameof(memberName)), | ||||
|                 dbName, memberName); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 找不到 {CsName} 对应的列 | ||||
|         /// </summary> | ||||
|         public static string NotFound_CsName_Column(object CsName) | ||||
|             => string.Format( | ||||
|                 GetString("NotFound_CsName_Column", nameof(CsName)), | ||||
|                 CsName); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 找不到属性:{memberName} | ||||
|         /// </summary> | ||||
|         public static string NotFound_Property(object memberName) | ||||
|             => string.Format( | ||||
|                 GetString("NotFound_Property", nameof(memberName)), | ||||
|                 memberName); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 找不到属性名 {proto} | ||||
|         /// </summary> | ||||
|         public static string NotFound_PropertyName(object proto) | ||||
|             => string.Format( | ||||
|                 GetString("NotFound_PropertyName", nameof(proto)), | ||||
|                 proto); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Custom 找不到对应的{{ 反射信息 }}:{fiValueCustomArray} | ||||
|         /// </summary> | ||||
|         public static string NotFound_Reflection(object fiValueCustomArray) | ||||
|             => string.Format( | ||||
|                 GetString("NotFound_Reflection", nameof(fiValueCustomArray)), | ||||
|                 fiValueCustomArray); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Custom 找不到对应的{{ 静态方法名 }}:{fiValueCustomArray} | ||||
|         /// </summary> | ||||
|         public static string NotFound_Static_MethodName(object fiValueCustomArray) | ||||
|             => string.Format( | ||||
|                 GetString("NotFound_Static_MethodName", nameof(fiValueCustomArray)), | ||||
|                 fiValueCustomArray); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// [Table(AsTable = xx)] 设置的属性名 {atmGroupsValue} 不存在 | ||||
|         /// </summary> | ||||
|         public static string NotFound_Table_Property_AsTable(object atmGroupsValue) | ||||
|             => string.Format( | ||||
|                 GetString("NotFound_Table_Property_AsTable", nameof(atmGroupsValue)), | ||||
|                 atmGroupsValue); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 未指定 UseConnectionString 或者 UseConnectionFactory | ||||
|         /// </summary> | ||||
|         public static string NotSpecified_UseConnectionString_UseConnectionFactory | ||||
|             => GetString("NotSpecified_UseConnectionString_UseConnectionFactory"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 【{policyName}】ObjectPool.{GetName}() timeout {totalSeconds} seconds, see: https://github.com/dotnetcore/FreeSql/discussions/1081 | ||||
|         /// </summary> | ||||
|         public static string ObjectPool_Get_Timeout(object policyName, object GetName, object totalSeconds) | ||||
|             => string.Format( | ||||
|                 GetString("ObjectPool_Get_Timeout", nameof(policyName), nameof(GetName), nameof(totalSeconds)), | ||||
|                 policyName, GetName, totalSeconds); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 【{policyName}】ObjectPool.GetAsync() The queue is too long. Policy.AsyncGetCapacity = {asyncGetCapacity} | ||||
|         /// </summary> | ||||
|         public static string ObjectPool_GetAsync_Queue_Long(object policyName, object asyncGetCapacity) | ||||
|             => string.Format( | ||||
|                 GetString("ObjectPool_GetAsync_Queue_Long", nameof(policyName), nameof(asyncGetCapacity)), | ||||
|                 policyName, asyncGetCapacity); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 【OneToMany】导航属性 {trytbTypeName}.{pnvName} 在 {tbrefCsName} 中没有找到对应的字段,如:{findtrytb}{findtrytbPkCsName}、{findtrytb}_{findtrytbPkCsName} | ||||
|         /// </summary> | ||||
|         public static string OneToMany_NotFound_CorrespondingField(object trytbTypeName, object pnvName, object tbrefCsName, object findtrytb, object findtrytbPkCsName) | ||||
|             => string.Format( | ||||
|                 GetString("OneToMany_NotFound_CorrespondingField", nameof(trytbTypeName), nameof(pnvName), nameof(tbrefCsName), nameof(findtrytb), nameof(findtrytbPkCsName)), | ||||
|                 trytbTypeName, pnvName, tbrefCsName, findtrytb, findtrytbPkCsName); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 【OneToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,{trytbCsName}.{trytbPrimarysCsName} 和 {tbrefCsName}.{trycolCsName} 类型不一致 | ||||
|         /// </summary> | ||||
|         public static string OneToMany_ParsingError_InconsistentType(object trytbTypeName, object pnvName, object trytbCsName, object trytbPrimarysCsName, object tbrefCsName, object trycolCsName) | ||||
|             => string.Format( | ||||
|                 GetString("OneToMany_ParsingError_InconsistentType", nameof(trytbTypeName), nameof(pnvName), nameof(trytbCsName), nameof(trytbPrimarysCsName), nameof(tbrefCsName), nameof(trycolCsName)), | ||||
|                 trytbTypeName, pnvName, trytbCsName, trytbPrimarysCsName, tbrefCsName, trycolCsName); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 、{refpropName}{findtrytbPkCsName}、{refpropName}_{findtrytbPkCsName}。或者使用 [Navigate] 特性指定关系映射。 | ||||
|         /// </summary> | ||||
|         public static string OneToMany_UseNavigate(object refpropName, object findtrytbPkCsName) | ||||
|             => string.Format( | ||||
|                 GetString("OneToMany_UseNavigate", nameof(refpropName), nameof(findtrytbPkCsName)), | ||||
|                 refpropName, findtrytbPkCsName); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 参数 field 未指定 | ||||
|         /// </summary> | ||||
|         public static string Parameter_Field_NotSpecified | ||||
|             => GetString("Parameter_Field_NotSpecified"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// {property} 参数错误,它不是集合属性,必须为 IList<T> 或者 ICollection<T> | ||||
|         /// </summary> | ||||
|         public static string ParameterError_NotValid_Collection(object property) | ||||
|             => string.Format( | ||||
|                 GetString("ParameterError_NotValid_Collection", nameof(property)), | ||||
|                 property); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// {property} 参数错误,它不是有效的导航属性 | ||||
|         /// </summary> | ||||
|         public static string ParameterError_NotValid_Navigation(object property) | ||||
|             => string.Format( | ||||
|                 GetString("ParameterError_NotValid_Navigation", nameof(property)), | ||||
|                 property); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// {where} 参数错误,{keyval} 不是有效的属性名,在实体类 {reftbTypeDisplayCsharp} 无法找到 | ||||
|         /// </summary> | ||||
|         public static string ParameterError_NotValid_PropertyName(object where, object keyval, object reftbTypeDisplayCsharp) | ||||
|             => string.Format( | ||||
|                 GetString("ParameterError_NotValid_PropertyName", nameof(where), nameof(keyval), nameof(reftbTypeDisplayCsharp)), | ||||
|                 where, keyval, reftbTypeDisplayCsharp); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// {property} 参数错误,格式 "TopicId=Id,多组使用逗号连接"  | ||||
|         /// </summary> | ||||
|         public static string ParameterError_NotValid_UseCommas(object property) | ||||
|             => string.Format( | ||||
|                 GetString("ParameterError_NotValid_UseCommas", nameof(property)), | ||||
|                 property); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 解析失败 {callExpMethodName} {message} | ||||
|         /// </summary> | ||||
|         public static string Parsing_Failed(object callExpMethodName, object message) | ||||
|             => string.Format( | ||||
|                 GetString("Parsing_Failed", nameof(callExpMethodName), nameof(message)), | ||||
|                 callExpMethodName, message); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 【{policyName}】The ObjectPool has been disposed, see: https://github.com/dotnetcore/FreeSql/discussions/1079 | ||||
|         /// </summary> | ||||
|         public static string Policy_ObjectPool_Dispose(object policyName) | ||||
|             => string.Format( | ||||
|                 GetString("Policy_ObjectPool_Dispose", nameof(policyName)), | ||||
|                 policyName); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 【{policyName}】状态不可用,等待后台检查程序恢复方可使用。{UnavailableExceptionMessage} | ||||
|         /// </summary> | ||||
|         public static string Policy_Status_NotAvailable(object policyName, object UnavailableExceptionMessage) | ||||
|             => string.Format( | ||||
|                 GetString("Policy_Status_NotAvailable", nameof(policyName), nameof(UnavailableExceptionMessage)), | ||||
|                 policyName, UnavailableExceptionMessage); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 属性{trytbVersionColumnCsName} 被标注为行锁(乐观锁)(IsVersion),但其必须为数字类型 或者 byte[],并且不可为 Nullable | ||||
|         /// </summary> | ||||
|         public static string Properties_AsRowLock_Must_Numeric_Byte(object trytbVersionColumnCsName) | ||||
|             => string.Format( | ||||
|                 GetString("Properties_AsRowLock_Must_Numeric_Byte", nameof(trytbVersionColumnCsName)), | ||||
|                 trytbVersionColumnCsName); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// properties 参数不能为空 | ||||
|         /// </summary> | ||||
|         public static string Properties_Cannot_Null | ||||
|             => GetString("Properties_Cannot_Null"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// {property} 属性名无法找到 | ||||
|         /// </summary> | ||||
|         public static string Property_Cannot_Find(object property) | ||||
|             => string.Format( | ||||
|                 GetString("Property_Cannot_Find", nameof(property)), | ||||
|                 property); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Range 要求 Value 应该逗号分割,并且长度为 2 | ||||
|         /// </summary> | ||||
|         public static string Range_Comma_Separateda_By2Char | ||||
|             => GetString("Range_Comma_Separateda_By2Char"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 回滚 | ||||
|         /// </summary> | ||||
|         public static string RollBack | ||||
|             => GetString("RollBack"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 运行时错误,反射获取 IncludeMany 方法失败 | ||||
|         /// </summary> | ||||
|         public static string RunTimeError_Reflection_IncludeMany | ||||
|             => GetString("RunTimeError_Reflection_IncludeMany"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// {qoteSql} is NULL,除非设置特性 [Column(IsNullable = false)] | ||||
|         /// </summary> | ||||
|         public static string Set_Column_IsNullable_False(object qoteSql) | ||||
|             => string.Format( | ||||
|                 GetString("Set_Column_IsNullable_False", nameof(qoteSql)), | ||||
|                 qoteSql); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 分表字段值 "{dt}" 不能小于 "{beginTime} " | ||||
|         /// </summary> | ||||
|         public static string SubTableFieldValue_CannotLessThen(object dt, object beginTime) | ||||
|             => string.Format( | ||||
|                 GetString("SubTableFieldValue_CannotLessThen", nameof(dt), nameof(beginTime)), | ||||
|                 dt, beginTime); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 分表字段值不能为 null | ||||
|         /// </summary> | ||||
|         public static string SubTableFieldValue_IsNotNull | ||||
|             => GetString("SubTableFieldValue_IsNotNull"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 分表字段值 "{columnValue}" 不能转化成 DateTime | ||||
|         /// </summary> | ||||
|         public static string SubTableFieldValue_NotConvertDateTime(object columnValue) | ||||
|             => string.Format( | ||||
|                 GetString("SubTableFieldValue_NotConvertDateTime", nameof(columnValue)), | ||||
|                 columnValue); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 分表字段值 "{dt}" 未匹配到分表名 | ||||
|         /// </summary> | ||||
|         public static string SubTableFieldValue_NotMatchTable(object dt) | ||||
|             => string.Format( | ||||
|                 GetString("SubTableFieldValue_NotMatchTable", nameof(dt)), | ||||
|                 dt); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// T2 类型错误 | ||||
|         /// </summary> | ||||
|         public static string T2_Type_Error | ||||
|             => GetString("T2_Type_Error"); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// tableName 格式错误,示例:“log_{yyyyMMdd}” | ||||
|         /// </summary> | ||||
|         public static string TableName_Format_Error(object yyyyMMdd) | ||||
|             => string.Format( | ||||
|                 GetString("TableName_Format_Error", nameof(yyyyMMdd)), | ||||
|                 yyyyMMdd); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// {Type}.AsType 参数错误,请传入正确的实体类型 | ||||
|         /// </summary> | ||||
|         public static string Type_AsType_Parameter_Error(object Type) | ||||
|             => string.Format( | ||||
|                 GetString("Type_AsType_Parameter_Error", nameof(Type)), | ||||
|                 Type); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// {thatFullName} 类型无法访问构造函数 | ||||
|         /// </summary> | ||||
|         public static string Type_Cannot_Access_Constructor(object thatFullName) | ||||
|             => string.Format( | ||||
|                 GetString("Type_Cannot_Access_Constructor", nameof(thatFullName)), | ||||
|                 thatFullName); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// {name} 类型错误 | ||||
|         /// </summary> | ||||
|         public static string Type_Error_Name(object name) | ||||
|             => string.Format( | ||||
|                 GetString("Type_Error_Name", nameof(name)), | ||||
|                 name); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// {Type}.AsType 参数不支持指定为 object | ||||
|         /// </summary> | ||||
|         public static string TypeAsType_NotSupport_Object(object Type) | ||||
|             => string.Format( | ||||
|                 GetString("TypeAsType_NotSupport_Object", nameof(Type)), | ||||
|                 Type); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 类型 {typeofFullName} 错误,不能使用 IncludeMany | ||||
|         /// </summary> | ||||
|         public static string TypeError_CannotUse_IncludeMany(object typeofFullName) | ||||
|             => string.Format( | ||||
|                 GetString("TypeError_CannotUse_IncludeMany", nameof(typeofFullName)), | ||||
|                 typeofFullName); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 无法解析表达式:{exp} | ||||
|         /// </summary> | ||||
|         public static string Unable_Parse_Expression(object exp) | ||||
|             => string.Format( | ||||
|                 GetString("Unable_Parse_Expression", nameof(exp)), | ||||
|                 exp); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 无法解析表达式方法 {exp3tmpCallMethodName} | ||||
|         /// </summary> | ||||
|         public static string Unable_Parse_ExpressionMethod(object exp3tmpCallMethodName) | ||||
|             => string.Format( | ||||
|                 GetString("Unable_Parse_ExpressionMethod", nameof(exp3tmpCallMethodName)), | ||||
|                 exp3tmpCallMethodName); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 请使用 fsql.InsertDict(dict) 方法插入字典数据 | ||||
|         /// </summary> | ||||
|         public static string Use_InsertDict_Method | ||||
|             => GetString("Use_InsertDict_Method"); | ||||
|  | ||||
|         private static string GetString(string name, params string[] formatterNames) | ||||
|         { | ||||
|             var value = _resourceManager.GetString(name); | ||||
|             for (var i = 0; i < formatterNames.Length; i++) | ||||
|             { | ||||
|                 value = value.Replace("{" + formatterNames[i] + "}", "{" + i + "}"); | ||||
|             } | ||||
|  | ||||
|             return value; | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
							
								
								
									
										5
									
								
								FreeSql/Properties/CoreStrings.Designer.tt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								FreeSql/Properties/CoreStrings.Designer.tt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | ||||
| <# | ||||
|     Session["ResourceFile"] = "CoreStrings.resx"; | ||||
|     Session["AccessModifier"] = "public"; | ||||
| #> | ||||
| <#@ include file="Resources.tt" #> | ||||
							
								
								
									
										498
									
								
								FreeSql/Properties/CoreStrings.en-US.resx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										498
									
								
								FreeSql/Properties/CoreStrings.en-US.resx
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,498 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <root> | ||||
|   <!--  | ||||
|     Microsoft ResX Schema  | ||||
|      | ||||
|     Version 2.0 | ||||
|      | ||||
|     The primary goals of this format is to allow a simple XML format  | ||||
|     that is mostly human readable. The generation and parsing of the  | ||||
|     various data types are done through the TypeConverter classes  | ||||
|     associated with the data types. | ||||
|      | ||||
|     Example: | ||||
|      | ||||
|     ... ado.net/XML headers & schema ... | ||||
|     <resheader name="resmimetype">text/microsoft-resx</resheader> | ||||
|     <resheader name="version">2.0</resheader> | ||||
|     <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> | ||||
|     <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> | ||||
|     <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> | ||||
|     <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> | ||||
|     <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> | ||||
|         <value>[base64 mime encoded serialized .NET Framework object]</value> | ||||
|     </data> | ||||
|     <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | ||||
|         <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> | ||||
|         <comment>This is a comment</comment> | ||||
|     </data> | ||||
|                  | ||||
|     There are any number of "resheader" rows that contain simple  | ||||
|     name/value pairs. | ||||
|      | ||||
|     Each data row contains a name, and value. The row also contains a  | ||||
|     type or mimetype. Type corresponds to a .NET class that support  | ||||
|     text/value conversion through the TypeConverter architecture.  | ||||
|     Classes that don't support this are serialized and stored with the  | ||||
|     mimetype set. | ||||
|      | ||||
|     The mimetype is used for serialized objects, and tells the  | ||||
|     ResXResourceReader how to depersist the object. This is currently not  | ||||
|     extensible. For a given mimetype the value must be set accordingly: | ||||
|      | ||||
|     Note - application/x-microsoft.net.object.binary.base64 is the format  | ||||
|     that the ResXResourceWriter will generate, however the reader can  | ||||
|     read any of the formats listed below. | ||||
|      | ||||
|     mimetype: application/x-microsoft.net.object.binary.base64 | ||||
|     value   : The object must be serialized with  | ||||
|             : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter | ||||
|             : and then encoded with base64 encoding. | ||||
|      | ||||
|     mimetype: application/x-microsoft.net.object.soap.base64 | ||||
|     value   : The object must be serialized with  | ||||
|             : System.Runtime.Serialization.Formatters.Soap.SoapFormatter | ||||
|             : and then encoded with base64 encoding. | ||||
|  | ||||
|     mimetype: application/x-microsoft.net.object.bytearray.base64 | ||||
|     value   : The object must be serialized into a byte array  | ||||
|             : using a System.ComponentModel.TypeConverter | ||||
|             : and then encoded with base64 encoding. | ||||
|     --> | ||||
|   <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> | ||||
|     <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> | ||||
|     <xsd:element name="root" msdata:IsDataSet="true"> | ||||
|       <xsd:complexType> | ||||
|         <xsd:choice maxOccurs="unbounded"> | ||||
|           <xsd:element name="metadata"> | ||||
|             <xsd:complexType> | ||||
|               <xsd:sequence> | ||||
|                 <xsd:element name="value" type="xsd:string" minOccurs="0" /> | ||||
|               </xsd:sequence> | ||||
|               <xsd:attribute name="name" use="required" type="xsd:string" /> | ||||
|               <xsd:attribute name="type" type="xsd:string" /> | ||||
|               <xsd:attribute name="mimetype" type="xsd:string" /> | ||||
|               <xsd:attribute ref="xml:space" /> | ||||
|             </xsd:complexType> | ||||
|           </xsd:element> | ||||
|           <xsd:element name="assembly"> | ||||
|             <xsd:complexType> | ||||
|               <xsd:attribute name="alias" type="xsd:string" /> | ||||
|               <xsd:attribute name="name" type="xsd:string" /> | ||||
|             </xsd:complexType> | ||||
|           </xsd:element> | ||||
|           <xsd:element name="data"> | ||||
|             <xsd:complexType> | ||||
|               <xsd:sequence> | ||||
|                 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | ||||
|                 <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> | ||||
|               </xsd:sequence> | ||||
|               <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> | ||||
|               <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> | ||||
|               <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> | ||||
|               <xsd:attribute ref="xml:space" /> | ||||
|             </xsd:complexType> | ||||
|           </xsd:element> | ||||
|           <xsd:element name="resheader"> | ||||
|             <xsd:complexType> | ||||
|               <xsd:sequence> | ||||
|                 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | ||||
|               </xsd:sequence> | ||||
|               <xsd:attribute name="name" type="xsd:string" use="required" /> | ||||
|             </xsd:complexType> | ||||
|           </xsd:element> | ||||
|         </xsd:choice> | ||||
|       </xsd:complexType> | ||||
|     </xsd:element> | ||||
|   </xsd:schema> | ||||
|   <resheader name="resmimetype"> | ||||
|     <value>text/microsoft-resx</value> | ||||
|   </resheader> | ||||
|   <resheader name="version"> | ||||
|     <value>2.0</value> | ||||
|   </resheader> | ||||
|   <resheader name="reader"> | ||||
|     <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||||
|   </resheader> | ||||
|   <resheader name="writer"> | ||||
|     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||||
|   </resheader> | ||||
|   <data name="AsTable_PropertyName_FormatError" xml:space="preserve"> | ||||
|     <value>[Table(AsTable="{asTable}")] Property value formatted incorrectly</value> | ||||
|   </data> | ||||
|   <data name="AsTable_PropertyName_NotDateTime" xml:space="preserve"> | ||||
|     <value>The property name {atmGroupsValue} set by [Table (AsTable = xx)] is not of type DateTime</value> | ||||
|   </data> | ||||
|   <data name="Available_Failed_Get_Resource" xml:space="preserve"> | ||||
|     <value>{name}: Failed to get resource {statistics}</value> | ||||
|   </data> | ||||
|   <data name="Available_Thrown_Exception" xml:space="preserve"> | ||||
|     <value>{name}: An exception needs to be thrown</value> | ||||
|   </data> | ||||
|   <data name="Bad_Expression_Format" xml:space="preserve"> | ||||
|     <value>Wrong expression format {column}</value> | ||||
|   </data> | ||||
|   <data name="Before_Chunk_Cannot_Use_Select" xml:space="preserve"> | ||||
|     <value>Select is not available until the Chunk function</value> | ||||
|   </data> | ||||
|   <data name="Begin_Transaction_Then_ForUpdate" xml:space="preserve"> | ||||
|     <value>For security reasons, be sure to use ForUpdate after the transaction is open</value> | ||||
|   </data> | ||||
|   <data name="Cannot_Be_NULL" xml:space="preserve"> | ||||
|     <value>Cannot be null</value> | ||||
|   </data> | ||||
|   <data name="Cannot_Be_NULL_Name" xml:space="preserve"> | ||||
|     <value>{name} cannot be null</value> | ||||
|   </data> | ||||
|   <data name="Cannot_Match_Property" xml:space="preserve"> | ||||
|     <value>Unable to match {property}</value> | ||||
|   </data> | ||||
|   <data name="Cannot_Resolve_ExpressionTree" xml:space="preserve"> | ||||
|     <value>{property} cannot be resolved to an expression tree</value> | ||||
|   </data> | ||||
|   <data name="Check_UseConnectionString" xml:space="preserve"> | ||||
|     <value>The parameter master ConnectionString cannot be empty, check UseConnectionString</value> | ||||
|   </data> | ||||
|   <data name="Commit" xml:space="preserve"> | ||||
|     <value>Commit</value> | ||||
|   </data> | ||||
|   <data name="Connection_Failed_Switch_Servers" xml:space="preserve"> | ||||
|     <value>Connection failed, ready to switch other available servers</value> | ||||
|   </data> | ||||
|   <data name="Custom_Expression_ParsingError" xml:space="preserve"> | ||||
|     <value>Custom expression parsing error: type {exp3MethodDeclaringType} needs to define static ThreadLocal<ExpressionCallContext>field, field, field (important three reminders)</value> | ||||
|   </data> | ||||
|   <data name="Custom_Reflection_IsNotNull" xml:space="preserve"> | ||||
|     <value>Custom {Reflection Information} cannot be empty, format: {static method name}{space}{reflection information}</value> | ||||
|   </data> | ||||
|   <data name="Custom_StaticMethodName_IsNotNull" xml:space="preserve"> | ||||
|     <value>Custom {static method name} cannot be empty, format: {static method name}{space}{reflection information}</value> | ||||
|   </data> | ||||
|   <data name="Custom_StaticMethodName_NotSet_DynamicFilterCustom" xml:space="preserve"> | ||||
|     <value>Custom corresponding {{static method name}}:{fiValueCustomArray} The [DynamicFilterCustomAttribute] attribute is not set</value> | ||||
|   </data> | ||||
|   <data name="CustomFieldSeparatedBySpaces" xml:space="preserve"> | ||||
|     <value>Custom requires that Fields be space-split and 2-length in the format: {static method name}{space}{reflection information}</value> | ||||
|   </data> | ||||
|   <data name="DataType_AsType_Inconsistent" xml:space="preserve"> | ||||
|     <value>The data type of the operation ({dataDisplayCsharp}) is inconsistent with AsType ({tableTypeDisplayCsharp}). Please check.</value> | ||||
|   </data> | ||||
|   <data name="DateRange_Comma_Separateda_By2Char" xml:space="preserve"> | ||||
|     <value>DateRange requires that Value be comma-separated and 2-length</value> | ||||
|   </data> | ||||
|   <data name="DateRange_DateFormat_yyyy" xml:space="preserve"> | ||||
|     <value>DateRange requires that the Value [1] format must be: yyyy, yyyy-MM, yyyy-MM-dd, yyyyy-MM-dd HH, yyyy, yyyy-MM-dd HH:mm</value> | ||||
|   </data> | ||||
|   <data name="DbUpdateVersionException_RowLevelOptimisticLock" xml:space="preserve"> | ||||
|     <value>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}.</value> | ||||
|   </data> | ||||
|   <data name="Different_Number_SlaveConnectionString_SlaveWeights" xml:space="preserve"> | ||||
|     <value>The number of SlaveConnectionStrings is not the same as SlaveWeights</value> | ||||
|   </data> | ||||
|   <data name="Duplicate_ColumnAttribute" xml:space="preserve"> | ||||
|     <value>ColumnAttribute. Name {colattrName} exists repeatedly, please check (note: case insensitive)</value> | ||||
|   </data> | ||||
|   <data name="Duplicate_PropertyName" xml:space="preserve"> | ||||
|     <value>Property name {pName} exists repeatedly, please check (note: case insensitive)</value> | ||||
|   </data> | ||||
|   <data name="Entity_Must_Primary_Key" xml:space="preserve"> | ||||
|     <value>The {function} feature requires that the entity class {tableCsName} must have a primary key</value> | ||||
|   </data> | ||||
|   <data name="Entity_MySQL_VersionsBelow8_NotSupport_Multiple_PrimaryKeys" xml:space="preserve"> | ||||
|     <value>{tbTypeFullName} is a parent-child relationship, but combinations of multiple primary keys are not supported in versions below MySql 8.0</value> | ||||
|   </data> | ||||
|   <data name="Entity_NotParentChild_Relationship" xml:space="preserve"> | ||||
|     <value>{tbTypeFullName} is not a parent-child relationship and cannot be used</value> | ||||
|   </data> | ||||
|   <data name="EspeciallySubquery_Cannot_Parsing" xml:space="preserve"> | ||||
|     <value>This particular subquery cannot be resolved</value> | ||||
|   </data> | ||||
|   <data name="Expression_Error_Use_ParameterExpression" xml:space="preserve"> | ||||
|     <value>Expression error, its top object is not ParameterExpression:{exp}</value> | ||||
|   </data> | ||||
|   <data name="Expression_Error_Use_Successive_MemberAccess_Type" xml:space="preserve"> | ||||
|     <value>Expression error, it is not a continuous MemberAccess type: {exp}</value> | ||||
|   </data> | ||||
|   <data name="ExpressionTree_Convert_Type_Error" xml:space="preserve"> | ||||
|     <value>ExpressionTree conversion type error, value ({value}), type ({valueTypeFullName}), target type ({typeFullName}), Error:{exMessage}</value> | ||||
|   </data> | ||||
|   <data name="Failed_SubTable_FieldValue" xml:space="preserve"> | ||||
|     <value>Failed to parse table field value {sqlWhere}</value> | ||||
|   </data> | ||||
|   <data name="Functions_AsTable_NotImplemented" xml:space="preserve"> | ||||
|     <value>Function {asTable} not implemented by AsTable</value> | ||||
|   </data> | ||||
|   <data name="GBase_NotSupport_OtherThanCommas" xml:space="preserve"> | ||||
|     <value>GBase does not support separators other than commas at this time</value> | ||||
|   </data> | ||||
|   <data name="Generated_Same_SubTable" xml:space="preserve"> | ||||
|     <value>TableName:{tableName} generated the same table name</value> | ||||
|   </data> | ||||
|   <data name="GetPrimarys_ParameterError_IsNotDictKey " xml:space="preserve"> | ||||
|     <value>The parameter'{primary}'passed by GetPrimarys is incorrect and does not belong to the key name of the dictionary data</value> | ||||
|   </data> | ||||
|   <data name="Has_Specified_Cannot_Specified_Second" xml:space="preserve"> | ||||
|     <value>{first} has already been specified and {second} can no longer be specified</value> | ||||
|   </data> | ||||
|   <data name="Ignored_Check_Confirm_PublicGetSet" xml:space="preserve"> | ||||
|     <value>{tb2DbName}. {mp2MemberName} is ignored. Check the IsIgnore setting to make sure get/set is public</value> | ||||
|   </data> | ||||
|   <data name="Include_ParameterType_Error" xml:space="preserve"> | ||||
|     <value>Include parameter type error</value> | ||||
|   </data> | ||||
|   <data name="Include_ParameterType_Error_Use_IncludeMany" xml:space="preserve"> | ||||
|     <value>Include parameter type is wrong, use IncludeMany for collection properties</value> | ||||
|   </data> | ||||
|   <data name="Include_ParameterType_Error_Use_MemberAccess" xml:space="preserve"> | ||||
|     <value>Include parameter type is wrong, expression type should be MemberAccess</value> | ||||
|   </data> | ||||
|   <data name="IncludeMany_NotValid_Navigation" xml:space="preserve"> | ||||
|     <value>The property {collMemMemberName} of IncludeMany type {tbTypeDisplayCsharp} is not a valid navigation property, hint: IsIgnore = true will not be a navigation property</value> | ||||
|   </data> | ||||
|   <data name="IncludeMany_ParameterError_OnlyUseOneParameter" xml:space="preserve"> | ||||
|     <value>IncludeMany {navigateSelector} parameter is wrong, Select can only use one parameter's method, the correct format:.Select(t =>new TNavigate{{}})</value> | ||||
|   </data> | ||||
|   <data name="IncludeMany_ParameterError_Select_ReturnConsistentType" xml:space="preserve"> | ||||
|     <value>IncludeMany {navigateSelector} parameter error, Select lambda parameter return value must match {collMemElementType} type</value> | ||||
|   </data> | ||||
|   <data name="IncludeMany_ParameterType_Error_Use_MemberAccess" xml:space="preserve"> | ||||
|     <value>IncludeMany parameter 1 has wrong type, expression type should be MemberAccess</value> | ||||
|   </data> | ||||
|   <data name="IncludeMany_ParameterTypeError" xml:space="preserve"> | ||||
|     <value>IncludeMany {navigateSelector} parameter type is wrong, correct format: a.collections.Take(1).Where(c => C.A ID == a.id).Select (a => new TNavigate{{}})</value> | ||||
|   </data> | ||||
|   <data name="InsertInto_No_Property_Selected" xml:space="preserve"> | ||||
|     <value>ISelect. InsertInto() did not select an attribute: {displayCsharp}</value> | ||||
|   </data> | ||||
|   <data name="InsertInto_TypeError" xml:space="preserve"> | ||||
|     <value>ISelect. InsertInto() type error: {displayCsharp}</value> | ||||
|   </data> | ||||
|   <data name="InsertOrUpdate_Must_Primary_Key" xml:space="preserve"> | ||||
|     <value>The InsertOrUpdate function performs merge into requiring the entity class {CsName} to have a primary key</value> | ||||
|   </data> | ||||
|   <data name="InsertOrUpdate_NotSuport_Generic_UseEntity" xml:space="preserve"> | ||||
|     <value>The generic parameter for InsertOrUpdate<>does not support {typeofT1}. Pass in your entity class</value> | ||||
|   </data> | ||||
|   <data name="Install_FreeSql_Extensions_LazyLoading" xml:space="preserve"> | ||||
|     <value>FreeSql needs to be installed for Delayed Loading. Extensions. LazyLoading. Dll, downloadable to nuget</value> | ||||
|   </data> | ||||
|   <data name="LazyLoading_CompilationError" xml:space="preserve"> | ||||
|     <value>{trytbTypeName} Compilation error: {exMessage}\r\n\r\n{cscode}</value> | ||||
|   </data> | ||||
|   <data name="LazyLoading_EntityMustDeclarePublic" xml:space="preserve"> | ||||
|     <value>Entity type {trytbTypeName} must be declared public</value> | ||||
|   </data> | ||||
|   <data name="ManyToMany_AsSelect_NotSupport_Sum_Avg_etc" xml:space="preserve"> | ||||
|     <value>ManyToMany navigation properties. AsSelect() is temporarily unavailable for the Sum/Avg/Max/Min/First/ToOne/ToList method</value> | ||||
|   </data> | ||||
|   <data name="ManyToMany_NotFound_CorrespondingField" xml:space="preserve"> | ||||
|     <value>[ManyToMany] Navigation property {trytbTypeName}. {pnvName} did not find a corresponding field in {tbmidCsName}, such as: {midTypePropsTrytbName}{findtrytbPkCsName}, {midTypePropsTrytbName}_ {findtrytbPkCsName}</value> | ||||
|   </data> | ||||
|   <data name="ManyToMany_ParsingError_EntityMissing_PrimaryKey" xml:space="preserve"> | ||||
|     <value>[ManyToMany] Navigation property {trytbTypeName}. {pnvName} parsing error, entity type {tbrefTypeName} missing primary key identity, [Column (IsPrimary = true)]</value> | ||||
|   </data> | ||||
|   <data name="ManyToMany_ParsingError_EntityMustHas_NavigateCollection" xml:space="preserve"> | ||||
|     <value>[ManyToMany] Navigation property {trytbTypeName}. {pnvName} parsing error, entity type {tbrefTypeName} must have a corresponding [Navigate (ManyToMany = x)] collection property</value> | ||||
|   </data> | ||||
|   <data name="ManyToMany_ParsingError_InconsistentType" xml:space="preserve"> | ||||
|     <value>[ManyToMany] Navigation property {trytbTypeName}. {pnvName} parsing error, {tbmidCsName}. {trycolCsName} and {trytbCsName}. {trytbPrimarysCsName} type inconsistent</value> | ||||
|   </data> | ||||
|   <data name="ManyToMany_ParsingError_IntermediateClass_ErrorMessage" xml:space="preserve"> | ||||
|     <value>[ManyToMany] Navigation property {trytbTypeName}. {pnvName} parsing error, intermediate class {tbmidCsName}.{midTypePropsTrytbName} Error: {exMessage}</value> | ||||
|   </data> | ||||
|   <data name="ManyToMany_ParsingError_IntermediateClass_NotManyToOne_OneToOne" xml:space="preserve"> | ||||
|     <value>[ManyToMany] Navigation property {trytbTypeName}. {pnvName} parsing error, intermediate class {tbmidCsName}. The {midTypePropsTrytbName} navigation property is not ManyToOne or OneToOne</value> | ||||
|   </data> | ||||
|   <data name="Mapping_Exception_HasNo_SamePropertyName" xml:space="preserve"> | ||||
|     <value>Mapping exception: {name} None of the property names are the same</value> | ||||
|   </data> | ||||
|   <data name="MasterPool_IsNull_UseTransaction" xml:space="preserve"> | ||||
|     <value>Ado. MasterPool value is null, this operation cannot self-enable transactions, please explicitly pass [transaction object] resolution</value> | ||||
|   </data> | ||||
|   <data name="Missing_FreeSqlProvider_Package" xml:space="preserve"> | ||||
|     <value>Missing FreeSql database implementation package: FreeSql. Provider. {Provider}. Dll, downloadable to nuget</value> | ||||
|   </data> | ||||
|   <data name="Missing_FreeSqlProvider_Package_Reason" xml:space="preserve"> | ||||
|     <value>The FreeSql database implementation package is missing: {dll} can be downloaded to nuget; If there is {dll} and an error still occurs (due to environmental issues that cause the type to be unreflected), manually pass in typeof ({providerType}) in the third parameter of UseConnectionString/UseConnectionFactory</value> | ||||
|   </data> | ||||
|   <data name="Navigation_Bind_Number_Different" xml:space="preserve"> | ||||
|     <value>Navigation property {trytbTypeName}. The number of {pnvName} attributes [Navigate] Binds ({bindColumnsCount}) is different from the number of external primary keys ({tbrefPrimarysLength})</value> | ||||
|   </data> | ||||
|   <data name="Navigation_Missing_AsSelect" xml:space="preserve"> | ||||
|     <value>{tb2DbName}. {mp2MemberName} Navigation Property Collection forgotten. AsSelect()? If used in ToList (a => a. {mp2MemberName}), step by step to refer to the IncludeMany document.</value> | ||||
|   </data> | ||||
|   <data name="Navigation_Missing_SetProperty" xml:space="preserve"> | ||||
|     <value>[Navigation Properties]{trytbTypeDisplayCsharp}. Missing set attribute for {pName}</value> | ||||
|   </data> | ||||
|   <data name="Navigation_NotFound_CorrespondingField" xml:space="preserve"> | ||||
|     <value>Navigation property {trytbTypeName}. {pnvName} No corresponding fields were found, such as: {pnvName}{findtbrefPkCsName}, {pnvName}_ {findtbrefPkCsName}. Or use the [Navigate] attribute to specify the relationship mapping.</value> | ||||
|   </data> | ||||
|   <data name="Navigation_ParsingError_EntityMissingPrimaryKey" xml:space="preserve"> | ||||
|     <value>Navigation property {trytbTypeName}. {pnvName} parsing error, entity type {trytcTypeName} missing primary key identity, [Column (IsPrimary = true)]</value> | ||||
|   </data> | ||||
|   <data name="Navigation_ParsingError_InconsistentType" xml:space="preserve"> | ||||
|     <value>Navigation property {trytbTypeName}. {pnvName} parsing error, {trytbCsName}. {trycolCsName} and {tbrefCsName}. {tbrefPrimarysCsName} type inconsistent</value> | ||||
|   </data> | ||||
|   <data name="Navigation_ParsingError_NotFound_Property" xml:space="preserve"> | ||||
|     <value>Navigation property {trytbTypeName}. {pnvName} attribute [Navigate] parsing error, property not found at {tbrefTypeName}: {bi}</value> | ||||
|   </data> | ||||
|   <data name="NoPrimaryKey_UseSetDto" xml:space="preserve"> | ||||
|     <value>{tableTypeDisplayCsharp} has no primary key defined and cannot use SetSource. Try SetDto</value> | ||||
|   </data> | ||||
|   <data name="NoProperty_Defined" xml:space="preserve"> | ||||
|     <value>No properties defined</value> | ||||
|   </data> | ||||
|   <data name="Not_Implemented" xml:space="preserve"> | ||||
|     <value>Not implemented</value> | ||||
|   </data> | ||||
|   <data name="Not_Implemented_Expression" xml:space="preserve"> | ||||
|     <value>Function expression {exp} parsing not implemented</value> | ||||
|   </data> | ||||
|   <data name="Not_Implemented_Expression_ParameterUseConstant" xml:space="preserve"> | ||||
|     <value>Function expression {exp} parsing not implemented, parameter {expArguments} must be constant</value> | ||||
|   </data> | ||||
|   <data name="Not_Implemented_Expression_UseAsSelect" xml:space="preserve"> | ||||
|     <value>Function expression {exp} parsing is not implemented. Use if you are working on a navigation property collection. AsSelect (). {exp3MethodName} ({exp3ArgumentsCount})</value> | ||||
|   </data> | ||||
|   <data name="Not_Implemented_MemberAcess_Constant" xml:space="preserve"> | ||||
|     <value>Constant under MemberAccess is not implemented</value> | ||||
|   </data> | ||||
|   <data name="Not_Implemented_Name" xml:space="preserve"> | ||||
|     <value>{name} is not implemented</value> | ||||
|   </data> | ||||
|   <data name="Not_Support" xml:space="preserve"> | ||||
|     <value>I won't support it</value> | ||||
|   </data> | ||||
|   <data name="Not_Support_OrderByRandom" xml:space="preserve"> | ||||
|     <value>{dataType} does not support OrderByRandom sorting</value> | ||||
|   </data> | ||||
|   <data name="Not_Valid_Navigation_Property" xml:space="preserve"> | ||||
|     <value>{property} is not a valid navigation property</value> | ||||
|   </data> | ||||
|   <data name="NotFound_Column" xml:space="preserve"> | ||||
|     <value>{dbName} Column {memberName} not found</value> | ||||
|   </data> | ||||
|   <data name="NotFound_CsName_Column" xml:space="preserve"> | ||||
|     <value>Cannot find the column corresponding to {CsName}</value> | ||||
|   </data> | ||||
|   <data name="NotFound_Property" xml:space="preserve"> | ||||
|     <value>Attribute not found: {memberName}</value> | ||||
|   </data> | ||||
|   <data name="NotFound_PropertyName" xml:space="preserve"> | ||||
|     <value>Property name {proto} not found</value> | ||||
|   </data> | ||||
|   <data name="NotFound_Reflection" xml:space="preserve"> | ||||
|     <value>Custom could not find the corresponding {{reflection information}}:{fiValueCustomArray}</value> | ||||
|   </data> | ||||
|   <data name="NotFound_Static_MethodName" xml:space="preserve"> | ||||
|     <value>Custom could not find the corresponding {{static method name}}:{fiValueCustomArray}</value> | ||||
|   </data> | ||||
|   <data name="NotFound_Table_Property_AsTable" xml:space="preserve"> | ||||
|     <value>The property name {atmGroupsValue} set by [Table(AsTable = xx)] does not exist</value> | ||||
|   </data> | ||||
|   <data name="NotSpecified_UseConnectionString_UseConnectionFactory" xml:space="preserve"> | ||||
|     <value>No UseConnectionString or UseConnectionFactory specified</value> | ||||
|   </data> | ||||
|   <data name="ObjectPool_Get_Timeout" xml:space="preserve"> | ||||
|     <value>[{policyName}] ObjectPool. {GetName}() timeout {totalSeconds} seconds, see: https://github.com/dotnetcore/FreeSql/discussions/1081</value> | ||||
|   </data> | ||||
|   <data name="ObjectPool_GetAsync_Queue_Long" xml:space="preserve"> | ||||
|     <value>[{policyName}] ObjectPool. GetAsync() The queue is too long. Policy. AsyncGetCapacity = {asyncGetCapacity}</value> | ||||
|   </data> | ||||
|   <data name="OneToMany_NotFound_CorrespondingField" xml:space="preserve"> | ||||
|     <value>[OneToMany] Navigation property {trytbTypeName}.{pnvName} did not find a corresponding field in {tbrefCsName}, such as: {findtrytb}{findtrytbPkCsName}, {findtrytb}_{findtrytbPkCsName}</value> | ||||
|   </data> | ||||
|   <data name="OneToMany_ParsingError_InconsistentType" xml:space="preserve"> | ||||
|     <value>[OneToMany] Navigation property {trytbTypeName}.{pnvName} parsing error, {trytbCsName}.{trytbPrimarysCsName} and {tbrefCsName}.{trycolCsName} is of inconsistent type</value> | ||||
|   </data> | ||||
|   <data name="OneToMany_UseNavigate" xml:space="preserve"> | ||||
|     <value>, {refpropName}{findtrytbPkCsName}, {refpropName}_{findtrytbPkCsName}. Or use the [Navigate] attribute to specify the relationship mapping.</value> | ||||
|   </data> | ||||
|   <data name="Parameter_Field_NotSpecified" xml:space="preserve"> | ||||
|     <value>Parameter field not specified</value> | ||||
|   </data> | ||||
|   <data name="ParameterError_NotValid_Collection" xml:space="preserve"> | ||||
|     <value>The {property} parameter is incorrect, it is not a collection property and must be IList<T>or ICollection<T></value> | ||||
|   </data> | ||||
|   <data name="ParameterError_NotValid_Navigation" xml:space="preserve"> | ||||
|     <value>The {property} parameter is incorrect, it is not a valid navigation property</value> | ||||
|   </data> | ||||
|   <data name="ParameterError_NotValid_PropertyName" xml:space="preserve"> | ||||
|     <value>{where} parameter error, {keyval} is not a valid property name and cannot be found in entity class {reftbTypeDisplayCsharp}</value> | ||||
|   </data> | ||||
|   <data name="ParameterError_NotValid_UseCommas" xml:space="preserve"> | ||||
|     <value>{property} parameter error, format "TopicId=Id, multiple groups using comma connection"</value> | ||||
|   </data> | ||||
|   <data name="Parsing_Failed" xml:space="preserve"> | ||||
|     <value>Parsing failed {callExpMethodName} {message}</value> | ||||
|   </data> | ||||
|   <data name="Policy_ObjectPool_Dispose" xml:space="preserve"> | ||||
|     <value>[{policyName}] The ObjectPool has been disposed, see: https://github.com/dotnetcore/FreeSql/discussions/1079</value> | ||||
|   </data> | ||||
|   <data name="Policy_Status_NotAvailable" xml:space="preserve"> | ||||
|     <value>The {policyName} status is unavailable and cannot be used until the background checker is restored. {UnavailableExceptionMessage}</value> | ||||
|   </data> | ||||
|   <data name="Properties_AsRowLock_Must_Numeric_Byte" xml:space="preserve"> | ||||
|     <value>The property {trytbVersionColumnCsName} is labeled as a row lock (optimistic lock) (IsVersion), but it must be a numeric type or byte[], and it cannot be Nullable</value> | ||||
|   </data> | ||||
|   <data name="Properties_Cannot_Null" xml:space="preserve"> | ||||
|     <value>Properrties parameter cannot be empty</value> | ||||
|   </data> | ||||
|   <data name="Property_Cannot_Find" xml:space="preserve"> | ||||
|     <value>{property} property name not found</value> | ||||
|   </data> | ||||
|   <data name="Range_Comma_Separateda_By2Char" xml:space="preserve"> | ||||
|     <value>Range requires that Value be comma-separated and 2-length</value> | ||||
|   </data> | ||||
|   <data name="RollBack" xml:space="preserve"> | ||||
|     <value>RollBack</value> | ||||
|   </data> | ||||
|   <data name="RunTimeError_Reflection_IncludeMany" xml:space="preserve"> | ||||
|     <value>Runtime error, reflection failed to get IncludeMany method</value> | ||||
|   </data> | ||||
|   <data name="Set_Column_IsNullable_False" xml:space="preserve"> | ||||
|     <value>{qoteSql} is NULL unless the attribute [Column (IsNullable = false)]</value> | ||||
|   </data> | ||||
|   <data name="SubTableFieldValue_CannotLessThen" xml:space="preserve"> | ||||
|     <value>Subtable field value'{dt}'cannot be less than'{beginTime}'</value> | ||||
|   </data> | ||||
|   <data name="SubTableFieldValue_IsNotNull" xml:space="preserve"> | ||||
|     <value>Subtable field value cannot be null</value> | ||||
|   </data> | ||||
|   <data name="SubTableFieldValue_NotConvertDateTime" xml:space="preserve"> | ||||
|     <value>The tabular field value'{columnValue}'cannot be converted to DateTime</value> | ||||
|   </data> | ||||
|   <data name="SubTableFieldValue_NotMatchTable" xml:space="preserve"> | ||||
|     <value>Table field value'{dt}'does not match table name</value> | ||||
|   </data> | ||||
|   <data name="T2_Type_Error" xml:space="preserve"> | ||||
|     <value>Type T2 Error</value> | ||||
|   </data> | ||||
|   <data name="TableName_Format_Error" xml:space="preserve"> | ||||
|     <value>TableName format error, example: "log_{yyyyMMdd}"</value> | ||||
|   </data> | ||||
|   <data name="Type_AsType_Parameter_Error" xml:space="preserve"> | ||||
|     <value>{Type}. AsType parameter error, please pass in the correct entity type</value> | ||||
|   </data> | ||||
|   <data name="Type_Cannot_Access_Constructor" xml:space="preserve"> | ||||
|     <value>The {thatFullName} type cannot access the constructor</value> | ||||
|   </data> | ||||
|   <data name="Type_Error_Name" xml:space="preserve"> | ||||
|     <value>{name} type error</value> | ||||
|   </data> | ||||
|   <data name="TypeAsType_NotSupport_Object" xml:space="preserve"> | ||||
|     <value>{Type}. AsType parameter does not support specifying as object</value> | ||||
|   </data> | ||||
|   <data name="TypeError_CannotUse_IncludeMany" xml:space="preserve"> | ||||
|     <value>Type {typeofFullName} error, IncludeMany cannot be used</value> | ||||
|   </data> | ||||
|   <data name="Unable_Parse_Expression" xml:space="preserve"> | ||||
|     <value>Unable to parse expression: {exp}</value> | ||||
|   </data> | ||||
|   <data name="Unable_Parse_ExpressionMethod" xml:space="preserve"> | ||||
|     <value>Unable to parse expression method {exp3tmpCallMethodName}</value> | ||||
|   </data> | ||||
|   <data name="Use_InsertDict_Method" xml:space="preserve"> | ||||
|     <value>Please use fsql. InsertDict (dict) method inserts dictionary data</value> | ||||
|   </data> | ||||
| </root> | ||||
							
								
								
									
										498
									
								
								FreeSql/Properties/CoreStrings.resx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										498
									
								
								FreeSql/Properties/CoreStrings.resx
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,498 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <root> | ||||
|   <!--  | ||||
|     Microsoft ResX Schema  | ||||
|      | ||||
|     Version 2.0 | ||||
|      | ||||
|     The primary goals of this format is to allow a simple XML format  | ||||
|     that is mostly human readable. The generation and parsing of the  | ||||
|     various data types are done through the TypeConverter classes  | ||||
|     associated with the data types. | ||||
|      | ||||
|     Example: | ||||
|      | ||||
|     ... ado.net/XML headers & schema ... | ||||
|     <resheader name="resmimetype">text/microsoft-resx</resheader> | ||||
|     <resheader name="version">2.0</resheader> | ||||
|     <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> | ||||
|     <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> | ||||
|     <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> | ||||
|     <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> | ||||
|     <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> | ||||
|         <value>[base64 mime encoded serialized .NET Framework object]</value> | ||||
|     </data> | ||||
|     <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | ||||
|         <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> | ||||
|         <comment>This is a comment</comment> | ||||
|     </data> | ||||
|                  | ||||
|     There are any number of "resheader" rows that contain simple  | ||||
|     name/value pairs. | ||||
|      | ||||
|     Each data row contains a name, and value. The row also contains a  | ||||
|     type or mimetype. Type corresponds to a .NET class that support  | ||||
|     text/value conversion through the TypeConverter architecture.  | ||||
|     Classes that don't support this are serialized and stored with the  | ||||
|     mimetype set. | ||||
|      | ||||
|     The mimetype is used for serialized objects, and tells the  | ||||
|     ResXResourceReader how to depersist the object. This is currently not  | ||||
|     extensible. For a given mimetype the value must be set accordingly: | ||||
|      | ||||
|     Note - application/x-microsoft.net.object.binary.base64 is the format  | ||||
|     that the ResXResourceWriter will generate, however the reader can  | ||||
|     read any of the formats listed below. | ||||
|      | ||||
|     mimetype: application/x-microsoft.net.object.binary.base64 | ||||
|     value   : The object must be serialized with  | ||||
|             : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter | ||||
|             : and then encoded with base64 encoding. | ||||
|      | ||||
|     mimetype: application/x-microsoft.net.object.soap.base64 | ||||
|     value   : The object must be serialized with  | ||||
|             : System.Runtime.Serialization.Formatters.Soap.SoapFormatter | ||||
|             : and then encoded with base64 encoding. | ||||
|  | ||||
|     mimetype: application/x-microsoft.net.object.bytearray.base64 | ||||
|     value   : The object must be serialized into a byte array  | ||||
|             : using a System.ComponentModel.TypeConverter | ||||
|             : and then encoded with base64 encoding. | ||||
|     --> | ||||
|   <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> | ||||
|     <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> | ||||
|     <xsd:element name="root" msdata:IsDataSet="true"> | ||||
|       <xsd:complexType> | ||||
|         <xsd:choice maxOccurs="unbounded"> | ||||
|           <xsd:element name="metadata"> | ||||
|             <xsd:complexType> | ||||
|               <xsd:sequence> | ||||
|                 <xsd:element name="value" type="xsd:string" minOccurs="0" /> | ||||
|               </xsd:sequence> | ||||
|               <xsd:attribute name="name" use="required" type="xsd:string" /> | ||||
|               <xsd:attribute name="type" type="xsd:string" /> | ||||
|               <xsd:attribute name="mimetype" type="xsd:string" /> | ||||
|               <xsd:attribute ref="xml:space" /> | ||||
|             </xsd:complexType> | ||||
|           </xsd:element> | ||||
|           <xsd:element name="assembly"> | ||||
|             <xsd:complexType> | ||||
|               <xsd:attribute name="alias" type="xsd:string" /> | ||||
|               <xsd:attribute name="name" type="xsd:string" /> | ||||
|             </xsd:complexType> | ||||
|           </xsd:element> | ||||
|           <xsd:element name="data"> | ||||
|             <xsd:complexType> | ||||
|               <xsd:sequence> | ||||
|                 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | ||||
|                 <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> | ||||
|               </xsd:sequence> | ||||
|               <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> | ||||
|               <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> | ||||
|               <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> | ||||
|               <xsd:attribute ref="xml:space" /> | ||||
|             </xsd:complexType> | ||||
|           </xsd:element> | ||||
|           <xsd:element name="resheader"> | ||||
|             <xsd:complexType> | ||||
|               <xsd:sequence> | ||||
|                 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | ||||
|               </xsd:sequence> | ||||
|               <xsd:attribute name="name" type="xsd:string" use="required" /> | ||||
|             </xsd:complexType> | ||||
|           </xsd:element> | ||||
|         </xsd:choice> | ||||
|       </xsd:complexType> | ||||
|     </xsd:element> | ||||
|   </xsd:schema> | ||||
|   <resheader name="resmimetype"> | ||||
|     <value>text/microsoft-resx</value> | ||||
|   </resheader> | ||||
|   <resheader name="version"> | ||||
|     <value>2.0</value> | ||||
|   </resheader> | ||||
|   <resheader name="reader"> | ||||
|     <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||||
|   </resheader> | ||||
|   <resheader name="writer"> | ||||
|     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||||
|   </resheader> | ||||
|   <data name="AsTable_PropertyName_FormatError" xml:space="preserve"> | ||||
|     <value>[Table(AsTable = "{asTable}")] 特性值格式错误</value> | ||||
|   </data> | ||||
|   <data name="AsTable_PropertyName_NotDateTime" xml:space="preserve"> | ||||
|     <value>[Table(AsTable = xx)] 设置的属性名 {atmGroupsValue} 不是 DateTime 类型</value> | ||||
|   </data> | ||||
|   <data name="Available_Failed_Get_Resource" xml:space="preserve"> | ||||
|     <value>{name}: Failed to get resource {statistics}</value> | ||||
|   </data> | ||||
|   <data name="Available_Thrown_Exception" xml:space="preserve"> | ||||
|     <value>{name}: An exception needs to be thrown</value> | ||||
|   </data> | ||||
|   <data name="Bad_Expression_Format" xml:space="preserve"> | ||||
|     <value>错误的表达式格式 {column}</value> | ||||
|   </data> | ||||
|   <data name="Before_Chunk_Cannot_Use_Select" xml:space="preserve"> | ||||
|     <value>Chunk 功能之前不可使用 Select</value> | ||||
|   </data> | ||||
|   <data name="Begin_Transaction_Then_ForUpdate" xml:space="preserve"> | ||||
|     <value>安全起见,请务必在事务开启之后,再使用 ForUpdate</value> | ||||
|   </data> | ||||
|   <data name="Cannot_Be_NULL" xml:space="preserve"> | ||||
|     <value>不能为 null</value> | ||||
|   </data> | ||||
|   <data name="Cannot_Be_NULL_Name" xml:space="preserve"> | ||||
|     <value>{name} 不能为 null</value> | ||||
|   </data> | ||||
|   <data name="Cannot_Match_Property" xml:space="preserve"> | ||||
|     <value>无法匹配 {property}</value> | ||||
|   </data> | ||||
|   <data name="Cannot_Resolve_ExpressionTree" xml:space="preserve"> | ||||
|     <value>{property} 无法解析为表达式树</value> | ||||
|   </data> | ||||
|   <data name="Check_UseConnectionString" xml:space="preserve"> | ||||
|     <value>参数 masterConnectionString 不可为空,请检查 UseConnectionString</value> | ||||
|   </data> | ||||
|   <data name="Commit" xml:space="preserve"> | ||||
|     <value>提交</value> | ||||
|   </data> | ||||
|   <data name="Connection_Failed_Switch_Servers" xml:space="preserve"> | ||||
|     <value>连接失败,准备切换其他可用服务器</value> | ||||
|   </data> | ||||
|   <data name="Custom_Expression_ParsingError" xml:space="preserve"> | ||||
|     <value>自定义表达式解析错误:类型 {exp3MethodDeclaringType} 需要定义 static ThreadLocal<ExpressionCallContext> 字段、字段、字段(重要三次提醒)</value> | ||||
|   </data> | ||||
|   <data name="Custom_Reflection_IsNotNull" xml:space="preserve"> | ||||
|     <value>Custom { 反射信息 }不能为空,格式:{ 静态方法名 }{ 空格 }{ 反射信息 }</value> | ||||
|   </data> | ||||
|   <data name="Custom_StaticMethodName_IsNotNull" xml:space="preserve"> | ||||
|     <value>Custom { 静态方法名 }不能为空,格式:{ 静态方法名 }{ 空格 }{ 反射信息 }</value> | ||||
|   </data> | ||||
|   <data name="Custom_StaticMethodName_NotSet_DynamicFilterCustom" xml:space="preserve"> | ||||
|     <value>Custom 对应的{{ 静态方法名 }}:{fiValueCustomArray} 未设置 [DynamicFilterCustomAttribute] 特性</value> | ||||
|   </data> | ||||
|   <data name="CustomFieldSeparatedBySpaces" xml:space="preserve"> | ||||
|     <value>Custom 要求 Field 应该空格分割,并且长度为 2,格式:{ 静态方法名 }{ 空格 }{ 反射信息 }</value> | ||||
|   </data> | ||||
|   <data name="DataType_AsType_Inconsistent" xml:space="preserve"> | ||||
|     <value>操作的数据类型({dataDisplayCsharp}) 与 AsType({tableTypeDisplayCsharp}) 不一致,请检查。</value> | ||||
|   </data> | ||||
|   <data name="DateRange_Comma_Separateda_By2Char" xml:space="preserve"> | ||||
|     <value>DateRange 要求 Value 应该逗号分割,并且长度为 2</value> | ||||
|   </data> | ||||
|   <data name="DateRange_DateFormat_yyyy" xml:space="preserve"> | ||||
|     <value>DateRange 要求 Value[1] 格式必须为:yyyy、yyyy-MM、yyyy-MM-dd、yyyy-MM-dd HH、yyyy、yyyy-MM-dd HH:mm</value> | ||||
|   </data> | ||||
|   <data name="DbUpdateVersionException_RowLevelOptimisticLock" xml:space="preserve"> | ||||
|     <value>记录可能不存在,或者【行级乐观锁】版本过旧,更新数量{sourceCount},影响的行数{affrows}。</value> | ||||
|   </data> | ||||
|   <data name="Different_Number_SlaveConnectionString_SlaveWeights" xml:space="preserve"> | ||||
|     <value>SlaveConnectionString 数量与 SlaveWeights 不相同</value> | ||||
|   </data> | ||||
|   <data name="Duplicate_ColumnAttribute" xml:space="preserve"> | ||||
|     <value>ColumnAttribute.Name {colattrName} 重复存在,请检查(注意:不区分大小写)</value> | ||||
|   </data> | ||||
|   <data name="Duplicate_PropertyName" xml:space="preserve"> | ||||
|     <value>属性名 {pName} 重复存在,请检查(注意:不区分大小写)</value> | ||||
|   </data> | ||||
|   <data name="Entity_Must_Primary_Key" xml:space="preserve"> | ||||
|     <value>{function} 功能要求实体类 {tableCsName} 必须有主键</value> | ||||
|   </data> | ||||
|   <data name="Entity_MySQL_VersionsBelow8_NotSupport_Multiple_PrimaryKeys" xml:space="preserve"> | ||||
|     <value>{tbTypeFullName} 是父子关系,但是 MySql 8.0 以下版本中不支持组合多主键</value> | ||||
|   </data> | ||||
|   <data name="Entity_NotParentChild_Relationship" xml:space="preserve"> | ||||
|     <value>{tbTypeFullName} 不是父子关系,无法使用该功能</value> | ||||
|   </data> | ||||
|   <data name="EspeciallySubquery_Cannot_Parsing" xml:space="preserve"> | ||||
|     <value>这个特别的子查询不能解析</value> | ||||
|   </data> | ||||
|   <data name="Expression_Error_Use_ParameterExpression" xml:space="preserve"> | ||||
|     <value>表达式错误,它的顶级对象不是 ParameterExpression:{exp}</value> | ||||
|   </data> | ||||
|   <data name="Expression_Error_Use_Successive_MemberAccess_Type" xml:space="preserve"> | ||||
|     <value>表达式错误,它不是连续的 MemberAccess 类型:{exp}</value> | ||||
|   </data> | ||||
|   <data name="ExpressionTree_Convert_Type_Error" xml:space="preserve"> | ||||
|     <value>ExpressionTree 转换类型错误,值({value}),类型({valueTypeFullName}),目标类型({typeFullName}),{exMessage}</value> | ||||
|   </data> | ||||
|   <data name="Failed_SubTable_FieldValue" xml:space="preserve"> | ||||
|     <value>未能解析分表字段值 {sqlWhere}</value> | ||||
|   </data> | ||||
|   <data name="Functions_AsTable_NotImplemented" xml:space="preserve"> | ||||
|     <value>AsTable 未实现的功能 {asTable}</value> | ||||
|   </data> | ||||
|   <data name="GBase_NotSupport_OtherThanCommas" xml:space="preserve"> | ||||
|     <value>GBase 暂时不支持逗号以外的分割符</value> | ||||
|   </data> | ||||
|   <data name="Generated_Same_SubTable" xml:space="preserve"> | ||||
|     <value>tableName:{tableName} 生成了相同的分表名</value> | ||||
|   </data> | ||||
|   <data name="GetPrimarys_ParameterError_IsNotDictKey " xml:space="preserve"> | ||||
|     <value>GetPrimarys 传递的参数 "{primary}" 不正确,它不属于字典数据的键名</value> | ||||
|   </data> | ||||
|   <data name="Has_Specified_Cannot_Specified_Second" xml:space="preserve"> | ||||
|     <value>已经指定了 {first},不能再指定 {second}</value> | ||||
|   </data> | ||||
|   <data name="Ignored_Check_Confirm_PublicGetSet" xml:space="preserve"> | ||||
|     <value>{tb2DbName}.{mp2MemberName} 被忽略,请检查 IsIgnore 设置,确认 get/set 为 public</value> | ||||
|   </data> | ||||
|   <data name="Include_ParameterType_Error" xml:space="preserve"> | ||||
|     <value>Include 参数类型错误</value> | ||||
|   </data> | ||||
|   <data name="Include_ParameterType_Error_Use_IncludeMany" xml:space="preserve"> | ||||
|     <value>Include 参数类型错误,集合属性请使用 IncludeMany</value> | ||||
|   </data> | ||||
|   <data name="Include_ParameterType_Error_Use_MemberAccess" xml:space="preserve"> | ||||
|     <value>Include 参数类型错误,表达式类型应该为 MemberAccess</value> | ||||
|   </data> | ||||
|   <data name="IncludeMany_NotValid_Navigation" xml:space="preserve"> | ||||
|     <value>IncludeMany 类型 {tbTypeDisplayCsharp} 的属性 {collMemMemberName} 不是有效的导航属性,提示:IsIgnore = true 不会成为导航属性</value> | ||||
|   </data> | ||||
|   <data name="IncludeMany_ParameterError_OnlyUseOneParameter" xml:space="preserve"> | ||||
|     <value>IncludeMany {navigateSelector} 参数错误,Select 只可以使用一个参数的方法,正确格式:.Select(t =>new TNavigate {{}})</value> | ||||
|   </data> | ||||
|   <data name="IncludeMany_ParameterError_Select_ReturnConsistentType" xml:space="preserve"> | ||||
|     <value>IncludeMany {navigateSelector} 参数错误,Select lambda参数返回值必须和 {collMemElementType} 类型一致</value> | ||||
|   </data> | ||||
|   <data name="IncludeMany_ParameterType_Error_Use_MemberAccess" xml:space="preserve"> | ||||
|     <value>IncludeMany 参数1 类型错误,表达式类型应该为 MemberAccess</value> | ||||
|   </data> | ||||
|   <data name="IncludeMany_ParameterTypeError" xml:space="preserve"> | ||||
|     <value>IncludeMany {navigateSelector} 参数类型错误,正确格式: a.collections.Take(1).Where(c =>c.aid == a.id).Select(a=> new TNavigate{{}})</value> | ||||
|   </data> | ||||
|   <data name="InsertInto_No_Property_Selected" xml:space="preserve"> | ||||
|     <value>ISelect.InsertInto() 未选择属性: {displayCsharp}</value> | ||||
|   </data> | ||||
|   <data name="InsertInto_TypeError" xml:space="preserve"> | ||||
|     <value>ISelect.InsertInto() 类型错误: {displayCsharp}</value> | ||||
|   </data> | ||||
|   <data name="InsertOrUpdate_Must_Primary_Key" xml:space="preserve"> | ||||
|     <value>InsertOrUpdate 功能执行 merge into 要求实体类 {CsName} 必须有主键</value> | ||||
|   </data> | ||||
|   <data name="InsertOrUpdate_NotSuport_Generic_UseEntity" xml:space="preserve"> | ||||
|     <value>InsertOrUpdate<>的泛型参数 不支持 {typeofT1},请传递您的实体类</value> | ||||
|   </data> | ||||
|   <data name="Install_FreeSql_Extensions_LazyLoading" xml:space="preserve"> | ||||
|     <value>【延时加载】功能需要安装 FreeSql.Extensions.LazyLoading.dll,可前往 nuget 下载</value> | ||||
|   </data> | ||||
|   <data name="LazyLoading_CompilationError" xml:space="preserve"> | ||||
|     <value>【延时加载】{trytbTypeName} 编译错误:{exMessage}\r\n\r\n{cscode}</value> | ||||
|   </data> | ||||
|   <data name="LazyLoading_EntityMustDeclarePublic" xml:space="preserve"> | ||||
|     <value>【延时加载】实体类型 {trytbTypeName} 必须声明为 public</value> | ||||
|   </data> | ||||
|   <data name="ManyToMany_AsSelect_NotSupport_Sum_Avg_etc" xml:space="preserve"> | ||||
|     <value>ManyToMany 导航属性 .AsSelect() 暂时不可用于 Sum/Avg/Max/Min/First/ToOne/ToList 方法</value> | ||||
|   </data> | ||||
|   <data name="ManyToMany_NotFound_CorrespondingField" xml:space="preserve"> | ||||
|     <value>【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 在 {tbmidCsName} 中没有找到对应的字段,如:{midTypePropsTrytbName}{findtrytbPkCsName}、{midTypePropsTrytbName}_{findtrytbPkCsName}</value> | ||||
|   </data> | ||||
|   <data name="ManyToMany_ParsingError_EntityMissing_PrimaryKey" xml:space="preserve"> | ||||
|     <value>【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,实体类型 {tbrefTypeName} 缺少主键标识,[Column(IsPrimary = true)]</value> | ||||
|   </data> | ||||
|   <data name="ManyToMany_ParsingError_EntityMustHas_NavigateCollection" xml:space="preserve"> | ||||
|     <value>【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,实体类型 {tbrefTypeName} 必须存在对应的 [Navigate(ManyToMany = x)] 集合属性</value> | ||||
|   </data> | ||||
|   <data name="ManyToMany_ParsingError_InconsistentType" xml:space="preserve"> | ||||
|     <value>【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,{tbmidCsName}.{trycolCsName} 和 {trytbCsName}.{trytbPrimarysCsName} 类型不一致</value> | ||||
|   </data> | ||||
|   <data name="ManyToMany_ParsingError_IntermediateClass_ErrorMessage" xml:space="preserve"> | ||||
|     <value>【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,中间类 {tbmidCsName}.{midTypePropsTrytbName} 错误:{exMessage}</value> | ||||
|   </data> | ||||
|   <data name="ManyToMany_ParsingError_IntermediateClass_NotManyToOne_OneToOne" xml:space="preserve"> | ||||
|     <value>【ManyToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,中间类 {tbmidCsName}.{midTypePropsTrytbName} 导航属性不是【ManyToOne】或【OneToOne】</value> | ||||
|   </data> | ||||
|   <data name="Mapping_Exception_HasNo_SamePropertyName" xml:space="preserve"> | ||||
|     <value>映射异常:{name} 没有一个属性名相同</value> | ||||
|   </data> | ||||
|   <data name="MasterPool_IsNull_UseTransaction" xml:space="preserve"> | ||||
|     <value>Ado.MasterPool 值为 null,该操作无法自启用事务,请显式传递【事务对象】解决</value> | ||||
|   </data> | ||||
|   <data name="Missing_FreeSqlProvider_Package" xml:space="preserve"> | ||||
|     <value>缺少 FreeSql 数据库实现包:FreeSql.Provider.{Provider}.dll,可前往 nuget 下载</value> | ||||
|   </data> | ||||
|   <data name="Missing_FreeSqlProvider_Package_Reason" xml:space="preserve"> | ||||
|     <value>缺少 FreeSql 数据库实现包:{dll},可前往 nuget 下载;如果存在 {dll} 依然报错(原因是环境问题导致反射不到类型),请在 UseConnectionString/UseConnectionFactory 第三个参数手工传入 typeof({providerType})</value> | ||||
|   </data> | ||||
|   <data name="Navigation_Bind_Number_Different" xml:space="preserve"> | ||||
|     <value>导航属性 {trytbTypeName}.{pnvName} 特性 [Navigate] Bind 数目({bindColumnsCount}) 与 外部主键数目({tbrefPrimarysLength}) 不相同</value> | ||||
|   </data> | ||||
|   <data name="Navigation_Missing_AsSelect" xml:space="preserve"> | ||||
|     <value>{tb2DbName}.{mp2MemberName} 导航属性集合忘了 .AsSelect() 吗?如果在 ToList(a => a.{mp2MemberName}) 中使用,请移步参考 IncludeMany 文档。</value> | ||||
|   </data> | ||||
|   <data name="Navigation_Missing_SetProperty" xml:space="preserve"> | ||||
|     <value>【导航属性】{trytbTypeDisplayCsharp}.{pName} 缺少 set 属性</value> | ||||
|   </data> | ||||
|   <data name="Navigation_NotFound_CorrespondingField" xml:space="preserve"> | ||||
|     <value>导航属性 {trytbTypeName}.{pnvName} 没有找到对应的字段,如:{pnvName}{findtbrefPkCsName}、{pnvName}_{findtbrefPkCsName}。或者使用 [Navigate] 特性指定关系映射。</value> | ||||
|   </data> | ||||
|   <data name="Navigation_ParsingError_EntityMissingPrimaryKey" xml:space="preserve"> | ||||
|     <value>导航属性 {trytbTypeName}.{pnvName} 解析错误,实体类型 {trytcTypeName} 缺少主键标识,[Column(IsPrimary = true)]</value> | ||||
|   </data> | ||||
|   <data name="Navigation_ParsingError_InconsistentType" xml:space="preserve"> | ||||
|     <value>导航属性 {trytbTypeName}.{pnvName} 解析错误,{trytbCsName}.{trycolCsName} 和 {tbrefCsName}.{tbrefPrimarysCsName} 类型不一致</value> | ||||
|   </data> | ||||
|   <data name="Navigation_ParsingError_NotFound_Property" xml:space="preserve"> | ||||
|     <value>导航属性 {trytbTypeName}.{pnvName} 特性 [Navigate] 解析错误,在 {tbrefTypeName} 未找到属性:{bi}</value> | ||||
|   </data> | ||||
|   <data name="NoPrimaryKey_UseSetDto" xml:space="preserve"> | ||||
|     <value>{tableTypeDisplayCsharp} 没有定义主键,无法使用 SetSource,请尝试 SetDto</value> | ||||
|   </data> | ||||
|   <data name="NoProperty_Defined" xml:space="preserve"> | ||||
|     <value> 没有定义属性 </value> | ||||
|   </data> | ||||
|   <data name="Not_Implemented" xml:space="preserve"> | ||||
|     <value>未实现</value> | ||||
|   </data> | ||||
|   <data name="Not_Implemented_Expression" xml:space="preserve"> | ||||
|     <value>未实现函数表达式 {exp} 解析</value> | ||||
|   </data> | ||||
|   <data name="Not_Implemented_Expression_ParameterUseConstant" xml:space="preserve"> | ||||
|     <value>未实现函数表达式 {exp} 解析,参数 {expArguments} 必须为常量</value> | ||||
|   </data> | ||||
|   <data name="Not_Implemented_Expression_UseAsSelect" xml:space="preserve"> | ||||
|     <value>未实现函数表达式 {exp} 解析,如果正在操作导航属性集合,请使用 .AsSelect().{exp3MethodName}({exp3ArgumentsCount})</value> | ||||
|   </data> | ||||
|   <data name="Not_Implemented_MemberAcess_Constant" xml:space="preserve"> | ||||
|     <value>未实现 MemberAccess 下的 Constant</value> | ||||
|   </data> | ||||
|   <data name="Not_Implemented_Name" xml:space="preserve"> | ||||
|     <value>未实现 {name}</value> | ||||
|   </data> | ||||
|   <data name="Not_Support" xml:space="preserve"> | ||||
|     <value>不支持</value> | ||||
|   </data> | ||||
|   <data name="Not_Support_OrderByRandom" xml:space="preserve"> | ||||
|     <value>{dataType} 不支持 OrderByRandom 随机排序</value> | ||||
|   </data> | ||||
|   <data name="Not_Valid_Navigation_Property" xml:space="preserve"> | ||||
|     <value>{property} 不是有效的导航属性</value> | ||||
|   </data> | ||||
|   <data name="NotFound_Column" xml:space="preserve"> | ||||
|     <value>{dbName} 找不到列 {memberName}</value> | ||||
|   </data> | ||||
|   <data name="NotFound_CsName_Column" xml:space="preserve"> | ||||
|     <value>找不到 {CsName} 对应的列</value> | ||||
|   </data> | ||||
|   <data name="NotFound_Property" xml:space="preserve"> | ||||
|     <value>找不到属性:{memberName}</value> | ||||
|   </data> | ||||
|   <data name="NotFound_PropertyName" xml:space="preserve"> | ||||
|     <value>找不到属性名 {proto}</value> | ||||
|   </data> | ||||
|   <data name="NotFound_Reflection" xml:space="preserve"> | ||||
|     <value>Custom 找不到对应的{{ 反射信息 }}:{fiValueCustomArray}</value> | ||||
|   </data> | ||||
|   <data name="NotFound_Static_MethodName" xml:space="preserve"> | ||||
|     <value>Custom 找不到对应的{{ 静态方法名 }}:{fiValueCustomArray}</value> | ||||
|   </data> | ||||
|   <data name="NotFound_Table_Property_AsTable" xml:space="preserve"> | ||||
|     <value>[Table(AsTable = xx)] 设置的属性名 {atmGroupsValue} 不存在</value> | ||||
|   </data> | ||||
|   <data name="NotSpecified_UseConnectionString_UseConnectionFactory" xml:space="preserve"> | ||||
|     <value>未指定 UseConnectionString 或者 UseConnectionFactory</value> | ||||
|   </data> | ||||
|   <data name="ObjectPool_Get_Timeout" xml:space="preserve"> | ||||
|     <value>【{policyName}】ObjectPool.{GetName}() timeout {totalSeconds} seconds, see: https://github.com/dotnetcore/FreeSql/discussions/1081</value> | ||||
|   </data> | ||||
|   <data name="ObjectPool_GetAsync_Queue_Long" xml:space="preserve"> | ||||
|     <value>【{policyName}】ObjectPool.GetAsync() The queue is too long. Policy.AsyncGetCapacity = {asyncGetCapacity}</value> | ||||
|   </data> | ||||
|   <data name="OneToMany_NotFound_CorrespondingField" xml:space="preserve"> | ||||
|     <value>【OneToMany】导航属性 {trytbTypeName}.{pnvName} 在 {tbrefCsName} 中没有找到对应的字段,如:{findtrytb}{findtrytbPkCsName}、{findtrytb}_{findtrytbPkCsName}</value> | ||||
|   </data> | ||||
|   <data name="OneToMany_ParsingError_InconsistentType" xml:space="preserve"> | ||||
|     <value>【OneToMany】导航属性 {trytbTypeName}.{pnvName} 解析错误,{trytbCsName}.{trytbPrimarysCsName} 和 {tbrefCsName}.{trycolCsName} 类型不一致</value> | ||||
|   </data> | ||||
|   <data name="OneToMany_UseNavigate" xml:space="preserve"> | ||||
|     <value>、{refpropName}{findtrytbPkCsName}、{refpropName}_{findtrytbPkCsName}。或者使用 [Navigate] 特性指定关系映射。</value> | ||||
|   </data> | ||||
|   <data name="Parameter_Field_NotSpecified" xml:space="preserve"> | ||||
|     <value>参数 field 未指定</value> | ||||
|   </data> | ||||
|   <data name="ParameterError_NotValid_Collection" xml:space="preserve"> | ||||
|     <value>{property} 参数错误,它不是集合属性,必须为 IList<T> 或者 ICollection<T></value> | ||||
|   </data> | ||||
|   <data name="ParameterError_NotValid_Navigation" xml:space="preserve"> | ||||
|     <value>{property} 参数错误,它不是有效的导航属性</value> | ||||
|   </data> | ||||
|   <data name="ParameterError_NotValid_PropertyName" xml:space="preserve"> | ||||
|     <value>{where} 参数错误,{keyval} 不是有效的属性名,在实体类 {reftbTypeDisplayCsharp} 无法找到</value> | ||||
|   </data> | ||||
|   <data name="ParameterError_NotValid_UseCommas" xml:space="preserve"> | ||||
|     <value>{property} 参数错误,格式 "TopicId=Id,多组使用逗号连接" </value> | ||||
|   </data> | ||||
|   <data name="Parsing_Failed" xml:space="preserve"> | ||||
|     <value>解析失败 {callExpMethodName} {message}</value> | ||||
|   </data> | ||||
|   <data name="Policy_ObjectPool_Dispose" xml:space="preserve"> | ||||
|     <value>【{policyName}】The ObjectPool has been disposed, see: https://github.com/dotnetcore/FreeSql/discussions/1079</value> | ||||
|   </data> | ||||
|   <data name="Policy_Status_NotAvailable" xml:space="preserve"> | ||||
|     <value>【{policyName}】状态不可用,等待后台检查程序恢复方可使用。{UnavailableExceptionMessage}</value> | ||||
|   </data> | ||||
|   <data name="Properties_AsRowLock_Must_Numeric_Byte" xml:space="preserve"> | ||||
|     <value>属性{trytbVersionColumnCsName} 被标注为行锁(乐观锁)(IsVersion),但其必须为数字类型 或者 byte[],并且不可为 Nullable</value> | ||||
|   </data> | ||||
|   <data name="Properties_Cannot_Null" xml:space="preserve"> | ||||
|     <value>properties 参数不能为空</value> | ||||
|   </data> | ||||
|   <data name="Property_Cannot_Find" xml:space="preserve"> | ||||
|     <value>{property} 属性名无法找到</value> | ||||
|   </data> | ||||
|   <data name="Range_Comma_Separateda_By2Char" xml:space="preserve"> | ||||
|     <value>Range 要求 Value 应该逗号分割,并且长度为 2</value> | ||||
|   </data> | ||||
|   <data name="RollBack" xml:space="preserve"> | ||||
|     <value>回滚</value> | ||||
|   </data> | ||||
|   <data name="RunTimeError_Reflection_IncludeMany" xml:space="preserve"> | ||||
|     <value>运行时错误,反射获取 IncludeMany 方法失败</value> | ||||
|   </data> | ||||
|   <data name="Set_Column_IsNullable_False" xml:space="preserve"> | ||||
|     <value>{qoteSql} is NULL,除非设置特性 [Column(IsNullable = false)]</value> | ||||
|   </data> | ||||
|   <data name="SubTableFieldValue_CannotLessThen" xml:space="preserve"> | ||||
|     <value>分表字段值 "{dt}" 不能小于 "{beginTime} "</value> | ||||
|   </data> | ||||
|   <data name="SubTableFieldValue_IsNotNull" xml:space="preserve"> | ||||
|     <value>分表字段值不能为 null</value> | ||||
|   </data> | ||||
|   <data name="SubTableFieldValue_NotConvertDateTime" xml:space="preserve"> | ||||
|     <value>分表字段值 "{columnValue}" 不能转化成 DateTime</value> | ||||
|   </data> | ||||
|   <data name="SubTableFieldValue_NotMatchTable" xml:space="preserve"> | ||||
|     <value>分表字段值 "{dt}" 未匹配到分表名</value> | ||||
|   </data> | ||||
|   <data name="T2_Type_Error" xml:space="preserve"> | ||||
|     <value>T2 类型错误</value> | ||||
|   </data> | ||||
|   <data name="TableName_Format_Error" xml:space="preserve"> | ||||
|     <value>tableName 格式错误,示例:“log_{yyyyMMdd}”</value> | ||||
|   </data> | ||||
|   <data name="Type_AsType_Parameter_Error" xml:space="preserve"> | ||||
|     <value>{Type}.AsType 参数错误,请传入正确的实体类型</value> | ||||
|   </data> | ||||
|   <data name="Type_Cannot_Access_Constructor" xml:space="preserve"> | ||||
|     <value>{thatFullName} 类型无法访问构造函数</value> | ||||
|   </data> | ||||
|   <data name="Type_Error_Name" xml:space="preserve"> | ||||
|     <value>{name} 类型错误</value> | ||||
|   </data> | ||||
|   <data name="TypeAsType_NotSupport_Object" xml:space="preserve"> | ||||
|     <value>{Type}.AsType 参数不支持指定为 object</value> | ||||
|   </data> | ||||
|   <data name="TypeError_CannotUse_IncludeMany" xml:space="preserve"> | ||||
|     <value>类型 {typeofFullName} 错误,不能使用 IncludeMany</value> | ||||
|   </data> | ||||
|   <data name="Unable_Parse_Expression" xml:space="preserve"> | ||||
|     <value>无法解析表达式:{exp}</value> | ||||
|   </data> | ||||
|   <data name="Unable_Parse_ExpressionMethod" xml:space="preserve"> | ||||
|     <value>无法解析表达式方法 {exp3tmpCallMethodName}</value> | ||||
|   </data> | ||||
|   <data name="Use_InsertDict_Method" xml:space="preserve"> | ||||
|     <value>请使用 fsql.InsertDict(dict) 方法插入字典数据</value> | ||||
|   </data> | ||||
| </root> | ||||
							
								
								
									
										261
									
								
								FreeSql/Properties/Resources.tt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										261
									
								
								FreeSql/Properties/Resources.tt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,261 @@ | ||||
| <#@ template hostspecific="true" #> | ||||
| <#@ assembly name="System.Core" #> | ||||
| <#@ assembly name="EnvDTE" #> | ||||
| <#@ assembly name="System.Windows.Forms" #> | ||||
| <#@ import namespace="System.Collections" #> | ||||
| <#@ import namespace="System.Collections.Generic" #> | ||||
| <#@ import namespace="System.ComponentModel.Design" #> | ||||
| <#@ import namespace="System.IO" #> | ||||
| <#@ import namespace="System.Linq" #> | ||||
| <#@ import namespace="System.Resources" #> | ||||
| <#@ import namespace="System.Text.RegularExpressions" #> | ||||
| <#@ import namespace="EnvDTE" #> | ||||
| <#@ import namespace="System.IO" #> | ||||
| <#@ import namespace="Microsoft.VisualStudio.TextTemplating" #> | ||||
|  | ||||
| <# | ||||
|     var model = LoadResources(); | ||||
| #> | ||||
| // <auto-generated /> | ||||
|  | ||||
| using System; | ||||
| using System.Reflection; | ||||
| using System.Resources; | ||||
| <# | ||||
|     if (!model.NoDiagnostics) | ||||
|     { | ||||
| #> | ||||
| using System.Threading; | ||||
| <# | ||||
|     } | ||||
| #> | ||||
|  | ||||
| namespace <#= model.Namespace #> | ||||
| { | ||||
| <# | ||||
|     if (model.Namespace.EndsWith("Internal") | ||||
|         || model.AccessModifier == "internal") | ||||
|     { | ||||
| #> | ||||
|     /// <summary> | ||||
|     ///     This is an internal API that supports the FreeSql infrastructure and not subject to | ||||
|     ///     the same compatibility standards as public APIs. It may be changed or removed without notice in | ||||
|     ///     any release. You should only use it directly in your code with extreme caution and knowing that | ||||
|     ///     doing so can result in application failures when updating to a new FreeSql release. | ||||
|     /// </summary> | ||||
| <# | ||||
|     } | ||||
|     else | ||||
|     { | ||||
| #> | ||||
|     /// <summary> | ||||
|     ///     <para> | ||||
|     ///		    String resources used in FreeSql exceptions, etc. | ||||
|     ///     </para> | ||||
|     ///     <para> | ||||
|     ///		    These strings are exposed publicly for use by database providers and extensions. | ||||
|     ///         It is unusual for application code to need these strings. | ||||
|     ///     </para> | ||||
|     /// </summary> | ||||
| <# | ||||
|     } | ||||
| #> | ||||
|     <#= model.AccessModifier #> static class <#= model.Class #> | ||||
|     { | ||||
|         private static readonly ResourceManager _resourceManager | ||||
|             = new ResourceManager("<#= model.ResourceName #>", typeof(<#= model.Class #>).Assembly); | ||||
| <# | ||||
|     foreach (var resource in model.Resources) | ||||
|     { | ||||
| #> | ||||
|  | ||||
|         /// <summary> | ||||
| <# | ||||
|         foreach (var line in Lines(resource.Value)) | ||||
|         { | ||||
| #> | ||||
|         /// <#= Xml(line) #> | ||||
| <# | ||||
|         } | ||||
| #> | ||||
|         /// </summary> | ||||
| <# | ||||
|             if (resource.Obsolete) | ||||
|             { | ||||
| #> | ||||
|         [Obsolete] | ||||
| <# | ||||
|             } | ||||
|  | ||||
|             if (resource.Parameters.Any()) | ||||
|             { | ||||
| #> | ||||
|         public static string <#= resource.Name #>(<#= List("object ", resource.Parameters.Select(e => e.ParamString)) #>) | ||||
|             => string.Format( | ||||
|                 GetString("<#= resource.Name #>", <#= List(resource.Parameters.Select(e => e.NameOfString)) #>), | ||||
|                 <#= List(resource.Parameters.Select(e => e.ParamString)) #>); | ||||
| <# | ||||
|             } | ||||
|             else | ||||
|             { | ||||
| #> | ||||
|         public static string <#= resource.Name #> | ||||
|             => GetString("<#= resource.Name #>"); | ||||
| <# | ||||
|             } | ||||
|         } | ||||
| #> | ||||
|  | ||||
|         private static string GetString(string name, params string[] formatterNames) | ||||
|         { | ||||
|             var value = _resourceManager.GetString(name); | ||||
|             for (var i = 0; i < formatterNames.Length; i++) | ||||
|             { | ||||
|                 value = value.Replace("{" + formatterNames[i] + "}", "{" + i + "}"); | ||||
|             } | ||||
|  | ||||
|             return value; | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| <#+ | ||||
|     ResourceFile LoadResources() | ||||
|     { | ||||
|         var result = new ResourceFile(); | ||||
|  | ||||
|         if (Session.ContainsKey("AccessModifier")) | ||||
|         { | ||||
|             result.AccessModifier = (string)Session["AccessModifier"]; | ||||
|         }; | ||||
|  | ||||
|         var services = (IServiceProvider)Host; | ||||
|         var dte = (DTE)services.GetCOMService(typeof(DTE)); | ||||
|         if (!Session.TryGetValue("NoDiagnostics", out var noDiagnostics)) | ||||
|         { | ||||
|             noDiagnostics = false; | ||||
|         } | ||||
|  | ||||
|         result.NoDiagnostics = (bool)noDiagnostics; | ||||
|  | ||||
|         var resourceFile = (string)Session["ResourceFile"]; | ||||
|         if (!Path.IsPathRooted(resourceFile)) | ||||
|         { | ||||
|             resourceFile = Host.ResolvePath(resourceFile); | ||||
|         } | ||||
|  | ||||
|         var resourceProjectItem = dte.Solution.FindProjectItem(resourceFile); | ||||
|         var templateProjectItem = dte.Solution.FindProjectItem(Host.TemplateFile); | ||||
|         var project = templateProjectItem.ContainingProject; | ||||
|         var rootNamespace = (string)project.Properties.Item("RootNamespace").Value; | ||||
|         var resourceDir = Path.GetDirectoryName(resourceFile); | ||||
|         var projectDir = (string)project.Properties.Item("FullPath").Value; | ||||
|         var resourceNamespace = rootNamespace + "." + resourceDir.Substring(projectDir.Length) | ||||
|             .Replace(Path.DirectorySeparatorChar, '.'); | ||||
|  | ||||
|         result.Namespace = (string)resourceProjectItem.Properties.Item("CustomToolNamespace")?.Value; | ||||
|         if (string.IsNullOrEmpty(result.Namespace)) | ||||
|         { | ||||
|             result.Namespace = resourceNamespace; | ||||
|         } | ||||
|  | ||||
|         result.Class = Path.GetFileNameWithoutExtension(resourceFile); | ||||
|  | ||||
|  | ||||
|         result.ResourceName = resourceNamespace + "." + result.Class; | ||||
|  | ||||
|         List<ResXDataNode> sortedResources; | ||||
|         using (var reader = new ResXResourceReader(resourceFile)) | ||||
|         { | ||||
|             reader.UseResXDataNodes = true; | ||||
|             sortedResources = Enumerable.ToList( | ||||
|                 from DictionaryEntry r in reader | ||||
|                 orderby r.Key | ||||
|                 select (ResXDataNode)r.Value); | ||||
|  | ||||
|             result.Resources = sortedResources | ||||
|                 .Select(r => new Resource(r)) | ||||
|                 .ToList(); | ||||
|         } | ||||
|  | ||||
|         using (var writer = new ResXResourceWriter(resourceFile)) | ||||
|         { | ||||
|             foreach (var node in sortedResources) | ||||
|                 writer.AddResource(node); | ||||
|  | ||||
|             writer.Generate(); | ||||
|         } | ||||
|  | ||||
|         return result; | ||||
|     } | ||||
|  | ||||
|     IEnumerable<string> Lines(string value) | ||||
|         => value.Split(new[] { Environment.NewLine }, StringSplitOptions.None); | ||||
|  | ||||
|     string Xml(string value) | ||||
|         => value.Replace("<", "<").Replace(">", ">"); | ||||
|  | ||||
|     string List(IEnumerable<string> items) | ||||
|         => List(null, items); | ||||
|  | ||||
|     string List(string prefix, IEnumerable<string> items, string suffix = null) | ||||
|         => string.Join(", ", items.Select(i => prefix + i + suffix)); | ||||
|  | ||||
|     class ResourceFile | ||||
|     { | ||||
|         public string Namespace { get; set; } | ||||
|         public string AccessModifier { get; set; } = "public"; | ||||
|         public string Class { get; set; } | ||||
|         public string ResourceName { get; set; } | ||||
|         public IEnumerable<Resource> Resources { get; set; } | ||||
|         public bool NoDiagnostics { get; set; } | ||||
|     } | ||||
|  | ||||
|     class Resource | ||||
|     { | ||||
|         public Resource(ResXDataNode node) | ||||
|         { | ||||
|             Name = node.Name; | ||||
|             Value = (string)node.GetValue((ITypeResolutionService)null); | ||||
|             var parameters = Regex.Matches(Value, @"\{(\w+)\}") | ||||
|                 .Cast<Match>() | ||||
|                 .Select(m => m.Groups[1].Value) | ||||
|                 .Distinct() | ||||
|                 .Select(n => ("nameof(" + n + ")", n)) | ||||
|                 .ToList(); | ||||
|  | ||||
|             foreach (var parameter in parameters.ToList()) | ||||
|             { | ||||
|                 var rawString = parameter.Item2; | ||||
|                 var underscoreIndex = rawString.IndexOf('_'); | ||||
|                 if (underscoreIndex > 0) | ||||
|                 { | ||||
|                     var newIndex = int.Parse(rawString.Substring(0, underscoreIndex)); | ||||
|                     parameters[newIndex] = ("\"" + rawString + "\"", rawString.Substring(underscoreIndex + 1)); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             Parameters = parameters; | ||||
|  | ||||
|             var eventInfo = node.Comment.Split(' '); | ||||
|             var argumentsRead = 0; | ||||
|             if (eventInfo.FirstOrDefault() == "Obsolete") | ||||
|             { | ||||
|                 Obsolete = true; | ||||
|                 argumentsRead++; | ||||
|             } | ||||
|  | ||||
|             Level = eventInfo.Skip(argumentsRead++).FirstOrDefault() ?? "BadLevel"; | ||||
|             EventId = eventInfo.Skip(argumentsRead++).FirstOrDefault() ?? "BadEventId"; | ||||
|             Types = eventInfo.Skip(argumentsRead++).ToList(); | ||||
|         } | ||||
|  | ||||
|         public string Name { get; } | ||||
|         public string Value { get; } | ||||
|         public string EventId { get; } | ||||
|         public string Level { get; } | ||||
|         public bool Obsolete { get; } | ||||
|         public IEnumerable<(string NameOfString, string ParamString)> Parameters { get; } | ||||
|         public IEnumerable<string> Types { get; } | ||||
|     } | ||||
| #> | ||||
| @@ -281,7 +281,7 @@ namespace FreeSql.ClickHouse | ||||
|                     case "Concat": | ||||
|                         return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null); | ||||
|                     case "Format": | ||||
|                         if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量"); | ||||
|                         if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); | ||||
|                         if (exp.Arguments.Count == 1) return ExpressionLambdaToSql(exp.Arguments[0], tsc); | ||||
|                         var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ? | ||||
|                             (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0); | ||||
|   | ||||
| @@ -31,7 +31,7 @@ namespace FreeSql.Dameng.Curd | ||||
|  | ||||
|             string getMergeSql(List<T1> data) | ||||
|             { | ||||
|                 if (_table.Primarys.Any() == false) throw new Exception($"InsertOrUpdate 功能执行 merge into 要求实体类 {_table.CsName} 必须有主键"); | ||||
|                 if (_table.Primarys.Any() == false) throw new Exception(CoreStrings.InsertOrUpdate_Must_Primary_Key(_table.CsName)); | ||||
|  | ||||
|                 var sb = new StringBuilder().Append("MERGE INTO ").Append(_commonUtils.QuoteSqlName(TableRuleInvoke())).Append(" t1 \r\nUSING ("); | ||||
|                 WriteSourceSelectUnionAll(data, sb, dbParams); | ||||
|   | ||||
| @@ -266,7 +266,7 @@ namespace FreeSql.Dameng | ||||
|                     case "Concat": | ||||
|                         return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null); | ||||
|                     case "Format": | ||||
|                         if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量"); | ||||
|                         if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); | ||||
|                         var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ? | ||||
|                             (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0); | ||||
|                         //3个 {} 时,Arguments 解析出来是分开的 | ||||
|   | ||||
| @@ -31,7 +31,7 @@ namespace FreeSql.Firebird.Curd | ||||
|  | ||||
|             string getMergeSql(List<T1> data) | ||||
|             { | ||||
|                 if (_table.Primarys.Any() == false) throw new Exception($"InsertOrUpdate 功能执行 merge into 要求实体类 {_table.CsName} 必须有主键"); | ||||
|                 if (_table.Primarys.Any() == false) throw new Exception(CoreStrings.InsertOrUpdate_Must_Primary_Key(_table.CsName)); | ||||
|  | ||||
|                 var sb = new StringBuilder().Append("MERGE INTO ").Append(_commonUtils.QuoteSqlName(TableRuleInvoke())).Append(" t1 \r\nUSING ("); | ||||
|                 WriteSourceSelectUnionAll(data, sb, dbParams); | ||||
|   | ||||
| @@ -253,7 +253,7 @@ namespace FreeSql.Firebird | ||||
|                     case "Concat": | ||||
|                         return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null); | ||||
|                     case "Format": | ||||
|                         if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量"); | ||||
|                         if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); | ||||
|                         var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ? | ||||
|                             (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0); | ||||
|                         //3个 {} 时,Arguments 解析出来是分开的 | ||||
|   | ||||
| @@ -31,7 +31,7 @@ namespace FreeSql.GBase.Curd | ||||
|  | ||||
|             string getMergeSql(List<T1> data) | ||||
|             { | ||||
|                 if (_table.Primarys.Any() == false) throw new Exception($"InsertOrUpdate 功能执行 merge into 要求实体类 {_table.CsName} 必须有主键"); | ||||
|                 if (_table.Primarys.Any() == false) throw new Exception(CoreStrings.InsertOrUpdate_Must_Primary_Key(_table.CsName)); | ||||
|  | ||||
|                 var sb = new StringBuilder().Append("MERGE INTO ").Append(_commonUtils.QuoteSqlName(TableRuleInvoke())).Append(" t1 \r\nUSING ("); | ||||
|                 WriteSourceSelectUnionAll(data, sb, dbParams); | ||||
|   | ||||
| @@ -253,7 +253,7 @@ namespace FreeSql.GBase | ||||
|                     case "Concat": | ||||
|                         return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null); | ||||
|                     case "Format": | ||||
|                         if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量"); | ||||
|                         if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); | ||||
|                         var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ? | ||||
|                             (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0); | ||||
|                         //3个 {} 时,Arguments 解析出来是分开的 | ||||
|   | ||||
| @@ -328,7 +328,7 @@ namespace FreeSql.KingbaseES | ||||
|                     case "Concat": | ||||
|                         return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null); | ||||
|                     case "Format": | ||||
|                         if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量"); | ||||
|                         if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); | ||||
|                         var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ? | ||||
|                             (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0); | ||||
|                         //3个 {} 时,Arguments 解析出来是分开的 | ||||
|   | ||||
| @@ -236,7 +236,7 @@ namespace FreeSql.MsAccess | ||||
|                     case "Concat": | ||||
|                         return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), exp.Arguments.Select(a => a.Type).ToArray()); | ||||
|                     case "Format": | ||||
|                         if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量"); | ||||
|                         if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); | ||||
|                         var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ? | ||||
|                             (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0); | ||||
|                         //3个 {} 时,Arguments 解析出来是分开的 | ||||
|   | ||||
| @@ -264,7 +264,7 @@ namespace FreeSql.MySql | ||||
|                     case "Concat": | ||||
|                         return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null); | ||||
|                     case "Format": | ||||
|                         if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量"); | ||||
|                         if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); | ||||
|                         if (exp.Arguments.Count == 1) return ExpressionLambdaToSql(exp.Arguments[0], tsc); | ||||
|                         var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ? | ||||
|                             (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0); | ||||
|   | ||||
| @@ -31,7 +31,7 @@ namespace FreeSql.Odbc.Dameng | ||||
|  | ||||
|             string getMergeSql(List<T1> data) | ||||
|             { | ||||
|                 if (_table.Primarys.Any() == false) throw new Exception($"InsertOrUpdate 功能执行 merge into 要求实体类 {_table.CsName} 必须有主键"); | ||||
|                 if (_table.Primarys.Any() == false) throw new Exception(CoreStrings.InsertOrUpdate_Must_Primary_Key(_table.CsName)); | ||||
|  | ||||
|                 var sb = new StringBuilder().Append("MERGE INTO ").Append(_commonUtils.QuoteSqlName(TableRuleInvoke())).Append(" t1 \r\nUSING ("); | ||||
|                 WriteSourceSelectUnionAll(data, sb, dbParams); | ||||
|   | ||||
| @@ -266,7 +266,7 @@ namespace FreeSql.Odbc.Dameng | ||||
|                     case "Concat": | ||||
|                         return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null); | ||||
|                     case "Format": | ||||
|                         if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量"); | ||||
|                         if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); | ||||
|                         var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ? | ||||
|                             (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0); | ||||
|                         //3个 {} 时,Arguments 解析出来是分开的 | ||||
|   | ||||
| @@ -328,7 +328,7 @@ namespace FreeSql.Odbc.KingbaseES | ||||
|                     case "Concat": | ||||
|                         return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null); | ||||
|                     case "Format": | ||||
|                         if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量"); | ||||
|                         if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); | ||||
|                         var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ? | ||||
|                             (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0); | ||||
|                         //3个 {} 时,Arguments 解析出来是分开的 | ||||
|   | ||||
| @@ -262,7 +262,7 @@ namespace FreeSql.Odbc.MySql | ||||
|                     case "Concat": | ||||
|                         return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null); | ||||
|                     case "Format": | ||||
|                         if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量"); | ||||
|                         if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); | ||||
|                         if (exp.Arguments.Count == 1) return ExpressionLambdaToSql(exp.Arguments[0], tsc); | ||||
|                         var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ? | ||||
|                             (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0); | ||||
|   | ||||
| @@ -31,7 +31,7 @@ namespace FreeSql.Odbc.Oracle | ||||
|  | ||||
|             string getMergeSql(List<T1> data) | ||||
|             { | ||||
|                 if (_table.Primarys.Any() == false) throw new Exception($"InsertOrUpdate 功能执行 merge into 要求实体类 {_table.CsName} 必须有主键"); | ||||
|                 if (_table.Primarys.Any() == false) throw new Exception(CoreStrings.InsertOrUpdate_Must_Primary_Key(_table.CsName)); | ||||
|  | ||||
|                 var sb = new StringBuilder().Append("MERGE INTO ").Append(_commonUtils.QuoteSqlName(TableRuleInvoke())).Append(" t1 \r\nUSING ("); | ||||
|                 WriteSourceSelectUnionAll(data, sb, dbParams); | ||||
|   | ||||
| @@ -266,7 +266,7 @@ namespace FreeSql.Odbc.Oracle | ||||
|                     case "Concat": | ||||
|                         return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null); | ||||
|                     case "Format": | ||||
|                         if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量"); | ||||
|                         if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); | ||||
|                         var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ? | ||||
|                             (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0); | ||||
|                         //3个 {} 时,Arguments 解析出来是分开的 | ||||
|   | ||||
| @@ -350,7 +350,7 @@ namespace FreeSql.Odbc.PostgreSQL | ||||
|                     case "Concat": | ||||
|                         return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null); | ||||
|                     case "Format": | ||||
|                         if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量"); | ||||
|                         if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); | ||||
|                         var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ? | ||||
|                             (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0); | ||||
|                         //3个 {} 时,Arguments 解析出来是分开的 | ||||
|   | ||||
| @@ -31,7 +31,7 @@ namespace FreeSql.Odbc.SqlServer | ||||
|  | ||||
|             string getMergeSql(List<T1> data) | ||||
|             { | ||||
|                 if (_table.Primarys.Any() == false) throw new Exception($"InsertOrUpdate 功能执行 merge into 要求实体类 {_table.CsName} 必须有主键"); | ||||
|                 if (_table.Primarys.Any() == false) throw new Exception(CoreStrings.InsertOrUpdate_Must_Primary_Key(_table.CsName)); | ||||
|  | ||||
|                 var sb = new StringBuilder(); | ||||
|                 if (IdentityColumn != null) sb.Append("SET IDENTITY_INSERT ").Append(_commonUtils.QuoteSqlName(TableRuleInvoke())).Append(" ON;\r\n"); | ||||
|   | ||||
| @@ -272,7 +272,7 @@ namespace FreeSql.Odbc.SqlServer | ||||
|                     case "Concat": | ||||
|                         return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), exp.Arguments.Select(a => a.Type).ToArray()); | ||||
|                     case "Format": | ||||
|                         if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量"); | ||||
|                         if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); | ||||
|                         var expArgs0 = ExpressionLambdaToSql(exp.Arguments[0], tsc); | ||||
|                         if (exp.Arguments.Count == 1) return expArgs0; | ||||
|                         var nchar = expArgs0.StartsWith("N'") ? "N" : ""; | ||||
|   | ||||
| @@ -31,7 +31,7 @@ namespace FreeSql.Oracle.Curd | ||||
|  | ||||
|             string getMergeSql(List<T1> data) | ||||
|             { | ||||
|                 if (_table.Primarys.Any() == false) throw new Exception($"InsertOrUpdate 功能执行 merge into 要求实体类 {_table.CsName} 必须有主键"); | ||||
|                 if (_table.Primarys.Any() == false) throw new Exception(CoreStrings.InsertOrUpdate_Must_Primary_Key(_table.CsName)); | ||||
|  | ||||
|                 var sb = new StringBuilder().Append("MERGE INTO ").Append(_commonUtils.QuoteSqlName(TableRuleInvoke())).Append(" t1 \r\nUSING ("); | ||||
|                 WriteSourceSelectUnionAll(data, sb, dbParams); | ||||
|   | ||||
| @@ -266,7 +266,7 @@ namespace FreeSql.Oracle | ||||
|                     case "Concat": | ||||
|                         return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null); | ||||
|                     case "Format": | ||||
|                         if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量"); | ||||
|                         if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); | ||||
|                         var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ? | ||||
|                             (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0); | ||||
|                         //3个 {} 时,Arguments 解析出来是分开的 | ||||
|   | ||||
| @@ -381,7 +381,7 @@ namespace FreeSql.PostgreSQL | ||||
|                     case "Concat": | ||||
|                         return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null); | ||||
|                     case "Format": | ||||
|                         if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量"); | ||||
|                         if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); | ||||
|                         var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ? | ||||
|                             (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0); | ||||
|                         //3个 {} 时,Arguments 解析出来是分开的 | ||||
|   | ||||
| @@ -31,7 +31,7 @@ namespace FreeSql.ShenTong.Curd | ||||
|  | ||||
|             string getMergeSql(List<T1> data) | ||||
|             { | ||||
|                 if (_table.Primarys.Any() == false) throw new Exception($"InsertOrUpdate 功能执行 merge into 要求实体类 {_table.CsName} 必须有主键"); | ||||
|                 if (_table.Primarys.Any() == false) throw new Exception(CoreStrings.InsertOrUpdate_Must_Primary_Key(_table.CsName)); | ||||
|  | ||||
|                 var sb = new StringBuilder().Append("MERGE INTO ").Append(_commonUtils.QuoteSqlName(TableRuleInvoke())).Append(" t1 \r\nUSING ("); | ||||
|                 WriteSourceSelectUnionAll(data, sb, dbParams); | ||||
|   | ||||
| @@ -310,7 +310,7 @@ namespace FreeSql.ShenTong | ||||
|                     case "Concat": | ||||
|                         return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null); | ||||
|                     case "Format": | ||||
|                         if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量"); | ||||
|                         if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); | ||||
|                         var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ? | ||||
|                              (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0); | ||||
|                         //3个 {} 时,Arguments 解析出来是分开的 | ||||
|   | ||||
| @@ -31,7 +31,7 @@ namespace FreeSql.SqlServer.Curd | ||||
|  | ||||
|             string getMergeSql(List<T1> data) | ||||
|             { | ||||
|                 if (_table.Primarys.Any() == false) throw new Exception($"InsertOrUpdate 功能执行 merge into 要求实体类 {_table.CsName} 必须有主键"); | ||||
|                 if (_table.Primarys.Any() == false) throw new Exception(CoreStrings.InsertOrUpdate_Must_Primary_Key(_table.CsName)); | ||||
|  | ||||
|                 var sb = new StringBuilder(); | ||||
|                 if (IdentityColumn != null) sb.Append("SET IDENTITY_INSERT ").Append(_commonUtils.QuoteSqlName(TableRuleInvoke())).Append(" ON;\r\n"); | ||||
|   | ||||
| @@ -271,7 +271,7 @@ namespace FreeSql.SqlServer | ||||
|                     case "Concat": | ||||
|                         return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), exp.Arguments.Select(a => a.Type).ToArray()); | ||||
|                     case "Format": | ||||
|                         if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量"); | ||||
|                         if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); | ||||
|                         var expArgs0 = ExpressionLambdaToSql(exp.Arguments[0], tsc); | ||||
|                         if (exp.Arguments.Count == 1) return expArgs0; | ||||
|                         var nchar = expArgs0.StartsWith("N'") ? "N" : ""; | ||||
|   | ||||
| @@ -262,7 +262,7 @@ namespace FreeSql.Sqlite | ||||
|                     case "Concat": | ||||
|                         return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null); | ||||
|                     case "Format": | ||||
|                         if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception($"未实现函数表达式 {exp} 解析,参数 {exp.Arguments[0]} 必须为常量"); | ||||
|                         if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0])); | ||||
|                         var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ? | ||||
|                             (exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0); | ||||
|                         //3个 {} 时,Arguments 解析出来是分开的 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 igeekfan
					igeekfan