mirror of
				https://gitee.com/ThingsGateway/ThingsGateway.git
				synced 2025-10-31 23:53:58 +08:00 
			
		
		
		
	Compare commits
	
		
			6 Commits
		
	
	
		
			10.11.90.0
			...
			10.11.97.0
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 628b51a353 | ||
|   | f03445bc83 | ||
|   | 55a2ff5487 | ||
|   | 0fef7dcf3b | ||
|   | 19d9702606 | ||
|   | a8a9774932 | 
| @@ -5,7 +5,7 @@ | ||||
|  | ||||
| 	<ItemGroup> | ||||
| 		<ProjectReference Include="..\ThingsGateway.Admin.Application\ThingsGateway.Admin.Application.csproj" /> | ||||
| 		<PackageReference Include="BootstrapBlazor.Chart" Version="9.0.1" /> | ||||
| 		<PackageReference Include="BootstrapBlazor.Chart" Version="9.0.3" /> | ||||
| 		<PackageReference Include="BootstrapBlazor.UniverSheet" Version="9.0.5" /> | ||||
| 		<PackageReference Include="BootstrapBlazor.WinBox" Version="9.0.7" /> | ||||
| 		<PackageReference Include="BootstrapBlazor.CodeEditor" Version="9.0.3" /> | ||||
|   | ||||
| @@ -463,7 +463,7 @@ public static class ProcessHelper | ||||
|                 StandardOutputEncoding = outputEncoding, | ||||
|                 StandardErrorEncoding = outputEncoding, | ||||
|             }; | ||||
|             var process = Process.Start(psi); | ||||
|             using var process = Process.Start(psi); | ||||
|             if (process == null) return null; | ||||
|  | ||||
|             if (msWait > 0 && !process.WaitForExit(msWait)) | ||||
|   | ||||
| @@ -13,7 +13,7 @@ namespace ThingsGateway.SqlSugar | ||||
|         /// <summary> | ||||
|         /// 用于同步操作的锁对象 | ||||
|         /// </summary> | ||||
|         internal static object LockObject = new object(); | ||||
|         internal static readonly object LockObject = new object(); | ||||
|         /// <summary> | ||||
|         /// SqlSugar提供者实例 | ||||
|         /// </summary> | ||||
|   | ||||
| @@ -31,61 +31,6 @@ namespace ThingsGateway.SqlSugar | ||||
|         /// 数据记录器 | ||||
|         /// </summary> | ||||
|         private IDataRecord DataRecord; | ||||
|         /// <summary> | ||||
|         /// IsDBNull方法 | ||||
|         /// </summary> | ||||
|         private static readonly MethodInfo isDBNullMethod = typeof(IDataRecord).GetMethod(nameof(IDataRecord.IsDBNull), new Type[] { typeof(int) }); | ||||
|         /// <summary> | ||||
|         /// GetBoolean方法 | ||||
|         /// </summary> | ||||
|         private static readonly MethodInfo getBoolean = typeof(IDataRecord).GetMethod(nameof(IDataRecord.GetBoolean), new Type[] { typeof(int) }); | ||||
|         /// <summary> | ||||
|         /// GetByte方法 | ||||
|         /// </summary> | ||||
|         private static readonly MethodInfo getByte = typeof(IDataRecord).GetMethod(nameof(IDataRecord.GetByte), new Type[] { typeof(int) }); | ||||
|         /// <summary> | ||||
|         /// GetDateTime方法 | ||||
|         /// </summary> | ||||
|         private static readonly MethodInfo getDateTime = typeof(IDataRecord).GetMethod(nameof(IDataRecord.GetDateTime), new Type[] { typeof(int) }); | ||||
|         private static readonly MethodInfo getDecimal = typeof(IDataRecord).GetMethod(nameof(IDataRecord.GetDecimal), new[] { typeof(int) }); | ||||
|         private static readonly MethodInfo getDouble = typeof(IDataRecord).GetMethod(nameof(IDataRecord.GetDouble), new[] { typeof(int) }); | ||||
|         private static readonly MethodInfo getFloat = typeof(IDataRecord).GetMethod(nameof(IDataRecord.GetFloat), new[] { typeof(int) }); | ||||
|         private static readonly MethodInfo getGuid = typeof(IDataRecord).GetMethod(nameof(IDataRecord.GetGuid), new[] { typeof(int) }); | ||||
|         private static readonly MethodInfo getInt16 = typeof(IDataRecord).GetMethod(nameof(IDataRecord.GetInt16), new[] { typeof(int) }); | ||||
|         private static readonly MethodInfo getInt32 = typeof(IDataRecord).GetMethod(nameof(IDataRecord.GetInt32), new[] { typeof(int) }); | ||||
|         private static readonly MethodInfo getInt64 = typeof(IDataRecord).GetMethod(nameof(IDataRecord.GetInt64), new[] { typeof(int) }); | ||||
|         private static readonly MethodInfo getString = typeof(IDataRecord).GetMethod(nameof(IDataRecord.GetString), new[] { typeof(int) }); | ||||
|         private static readonly MethodInfo getdatetimeoffset = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetDateTimeOffset)); | ||||
|         private static readonly MethodInfo getdatetimeoffsetDate = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetDateTimeOffsetDate)); | ||||
|         private static readonly MethodInfo getStringGuid = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetStringGuid)); | ||||
|         private static readonly MethodInfo getXelement = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetXelement)); | ||||
|         private static readonly MethodInfo getConvertStringGuid = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetConvertStringGuid)); | ||||
|         private static readonly MethodInfo getEnum = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetEnum)); | ||||
|         private static readonly MethodInfo getConvertString = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetConvertString)); | ||||
|         private static readonly MethodInfo getConvertFloat = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetConvertFloat)); | ||||
|         private static readonly MethodInfo getConvertBoolean = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetConvertBoolean)); | ||||
|         private static readonly MethodInfo getConvertByte = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetConvertByte)); | ||||
|         private static readonly MethodInfo getConvertChar = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetConvertChar)); | ||||
|         private static readonly MethodInfo getConvertDateTime = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetConvertDateTime)); | ||||
|         private static readonly MethodInfo getConvertTime = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetConvertTime)); | ||||
|         private static readonly MethodInfo getTime = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetTime)); | ||||
|         private static readonly MethodInfo getConvertDecimal = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetConvertDecimal)); | ||||
|         private static readonly MethodInfo getConvertDouble = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetConvertDouble)); | ||||
|         private static readonly MethodInfo getConvertDoubleToFloat = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetConvertDoubleToFloat)); | ||||
|         private static readonly MethodInfo getConvertGuid = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetConvertGuid)); | ||||
|         private static readonly MethodInfo getConvertInt16 = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetConvertInt16)); | ||||
|         private static readonly MethodInfo getConvertInt32 = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetConvertInt32)); | ||||
|         private static readonly MethodInfo getConvertInt64 = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetConvertInt64)); | ||||
|         private static readonly MethodInfo getConvertEnum_Null = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetConvertEnum_Null)); | ||||
|         private static readonly MethodInfo getConvertdatetimeoffset = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetConvertdatetimeoffset)); | ||||
|         private static readonly MethodInfo getConvertdatetimeoffsetDate = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetConvertdatetimeoffsetDate)); | ||||
|         private static readonly MethodInfo getOtherNull = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetOtherNull)); | ||||
|         private static readonly MethodInfo getOther = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetOther)); | ||||
|         private static readonly MethodInfo getJson = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetJson)); | ||||
|         private static readonly MethodInfo getArray = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetArray)); | ||||
|         private static readonly MethodInfo getEntity = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetEntity), new[] { typeof(SqlSugarProvider) }); | ||||
|         private static readonly MethodInfo getMyIntNull = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetMyIntNull)); | ||||
|         private static readonly MethodInfo getMyInt = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetMyInt)); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 加载委托 | ||||
| @@ -219,7 +164,7 @@ namespace ThingsGateway.SqlSugar | ||||
|             Label endIfLabel = generator.DefineLabel(); | ||||
|             generator.Emit(OpCodes.Ldarg_0); | ||||
|             generator.Emit(OpCodes.Ldc_I4, i); | ||||
|             generator.Emit(OpCodes.Callvirt, isDBNullMethod); | ||||
|             generator.Emit(OpCodes.Callvirt, IDataReaderEntityBuilderHelpers.isDBNullMethod); | ||||
|             generator.Emit(OpCodes.Brtrue, endIfLabel); | ||||
|             generator.Emit(OpCodes.Ldloc, result); | ||||
|             var method = (columnInfo.SqlParameterDbType as Type).GetMethod(nameof(ISugarDataConverter.QueryConverter)); | ||||
| @@ -253,12 +198,12 @@ namespace ThingsGateway.SqlSugar | ||||
|  | ||||
|             if (columnInfo.IsJson) | ||||
|             { | ||||
|                 MethodInfo jsonMethod = getJson.MakeGenericMethod(columnInfo.PropertyInfo.PropertyType); | ||||
|                 MethodInfo jsonMethod = IDataReaderEntityBuilderHelpers.getJson.MakeGenericMethod(columnInfo.PropertyInfo.PropertyType); | ||||
|                 int i = DataRecord.GetOrdinal(fieldName); | ||||
|                 Label endIfLabel = generator.DefineLabel(); | ||||
|                 generator.Emit(OpCodes.Ldarg_0); | ||||
|                 generator.Emit(OpCodes.Ldc_I4, i); | ||||
|                 generator.Emit(OpCodes.Callvirt, isDBNullMethod); | ||||
|                 generator.Emit(OpCodes.Callvirt, IDataReaderEntityBuilderHelpers.isDBNullMethod); | ||||
|                 generator.Emit(OpCodes.Brtrue, endIfLabel); | ||||
|                 generator.Emit(OpCodes.Ldloc, result); | ||||
|                 generator.Emit(OpCodes.Ldarg_0); | ||||
| @@ -278,12 +223,12 @@ namespace ThingsGateway.SqlSugar | ||||
|             } | ||||
|             if (columnInfo.IsArray) | ||||
|             { | ||||
|                 MethodInfo arrayMehtod = getArray.MakeGenericMethod(columnInfo.PropertyInfo.PropertyType); | ||||
|                 MethodInfo arrayMehtod = IDataReaderEntityBuilderHelpers.getArray.MakeGenericMethod(columnInfo.PropertyInfo.PropertyType); | ||||
|                 int i = DataRecord.GetOrdinal(fieldName); | ||||
|                 Label endIfLabel = generator.DefineLabel(); | ||||
|                 generator.Emit(OpCodes.Ldarg_0); | ||||
|                 generator.Emit(OpCodes.Ldc_I4, i); | ||||
|                 generator.Emit(OpCodes.Callvirt, isDBNullMethod); | ||||
|                 generator.Emit(OpCodes.Callvirt, IDataReaderEntityBuilderHelpers.isDBNullMethod); | ||||
|                 generator.Emit(OpCodes.Brtrue, endIfLabel); | ||||
|                 generator.Emit(OpCodes.Ldloc, result); | ||||
|                 generator.Emit(OpCodes.Ldarg_0); | ||||
| @@ -298,7 +243,7 @@ namespace ThingsGateway.SqlSugar | ||||
|                 Label endIfLabel = generator.DefineLabel(); | ||||
|                 generator.Emit(OpCodes.Ldarg_0); | ||||
|                 generator.Emit(OpCodes.Ldc_I4, i); | ||||
|                 generator.Emit(OpCodes.Callvirt, isDBNullMethod); | ||||
|                 generator.Emit(OpCodes.Callvirt, IDataReaderEntityBuilderHelpers.isDBNullMethod); | ||||
|                 generator.Emit(OpCodes.Brtrue, endIfLabel); | ||||
|                 generator.Emit(OpCodes.Ldloc, result); | ||||
|                 generator.Emit(OpCodes.Ldarg_0); | ||||
| @@ -332,7 +277,7 @@ namespace ThingsGateway.SqlSugar | ||||
|  | ||||
|             generator.Emit(OpCodes.Ldarg_0); | ||||
|             generator.Emit(OpCodes.Ldc_I4, i); | ||||
|             generator.Emit(OpCodes.Callvirt, isDBNullMethod); | ||||
|             generator.Emit(OpCodes.Callvirt, IDataReaderEntityBuilderHelpers.isDBNullMethod); | ||||
|             generator.Emit(OpCodes.Brtrue, endIfLabel); | ||||
|             generator.Emit(OpCodes.Ldloc, result); | ||||
|             generator.Emit(OpCodes.Ldarg_0); | ||||
| @@ -378,7 +323,7 @@ namespace ThingsGateway.SqlSugar | ||||
|             { | ||||
|                 if (provider.IsNoSql) | ||||
|                 { | ||||
|                     method = isNullableType ? getOtherNull.MakeGenericMethod(bindPropertyType) : getOther.MakeGenericMethod(bindPropertyType); | ||||
|                     method = isNullableType ? IDataReaderEntityBuilderHelpers.getOtherNull.MakeGenericMethod(bindPropertyType) : IDataReaderEntityBuilderHelpers.getOther.MakeGenericMethod(bindPropertyType); | ||||
|                     if (method.IsVirtual) | ||||
|                         generator.Emit(OpCodes.Callvirt, method); | ||||
|                     else | ||||
| @@ -393,39 +338,39 @@ namespace ThingsGateway.SqlSugar | ||||
|             { | ||||
|                 if (bindPropertyType.IsEnum()) | ||||
|                 { | ||||
|                     method = isNullableType ? getConvertEnum_Null.MakeGenericMethod(bindPropertyType) : getEnum.MakeGenericMethod(bindPropertyType); | ||||
|                     method = isNullableType ? IDataReaderEntityBuilderHelpers.getConvertEnum_Null.MakeGenericMethod(bindPropertyType) : IDataReaderEntityBuilderHelpers.getEnum.MakeGenericMethod(bindPropertyType); | ||||
|                 } | ||||
|                 else if (bindPropertyType == UtilConstants.IntType) | ||||
|                 { | ||||
|                     method = isNullableType ? getConvertInt32 : getInt32; | ||||
|                     method = isNullableType ? IDataReaderEntityBuilderHelpers.getConvertInt32 : IDataReaderEntityBuilderHelpers.getInt32; | ||||
|                 } | ||||
|                 else if (bindPropertyType == UtilConstants.DateTimeOffsetType && SugarCompatible.IsFramework) | ||||
|                 { | ||||
|                     method = isNullableType ? getConvertdatetimeoffset : getdatetimeoffset; | ||||
|                     method = isNullableType ? IDataReaderEntityBuilderHelpers.getConvertdatetimeoffset : IDataReaderEntityBuilderHelpers.getdatetimeoffset; | ||||
|                 } | ||||
|                 else if (bindPropertyType == UtilConstants.ByteType) | ||||
|                 { | ||||
|                     method = isNullableType ? getConvertByte : getByte; | ||||
|                     method = isNullableType ? IDataReaderEntityBuilderHelpers.getConvertByte : IDataReaderEntityBuilderHelpers.getByte; | ||||
|                 } | ||||
|                 else if (bindPropertyType == UtilConstants.StringType && dbTypeName.EqualCase("timestamp")) | ||||
|                 { | ||||
|                     method = isNullableType ? getOtherNull.MakeGenericMethod(bindPropertyType) : getOther.MakeGenericMethod(bindPropertyType); | ||||
|                     method = isNullableType ? IDataReaderEntityBuilderHelpers.getOtherNull.MakeGenericMethod(bindPropertyType) : IDataReaderEntityBuilderHelpers.getOther.MakeGenericMethod(bindPropertyType); | ||||
|                 } | ||||
|                 else if (dbTypeName.EqualCase("STRING")) | ||||
|                 { | ||||
|                     method = isNullableType ? getOtherNull.MakeGenericMethod(bindPropertyType) : getOther.MakeGenericMethod(bindPropertyType); | ||||
|                     method = isNullableType ? IDataReaderEntityBuilderHelpers.getOtherNull.MakeGenericMethod(bindPropertyType) : IDataReaderEntityBuilderHelpers.getOther.MakeGenericMethod(bindPropertyType); | ||||
|                 } | ||||
|                 else if (bindPropertyType == UtilConstants.StringType && validPropertyName == "int") | ||||
|                 { | ||||
|                     method = isNullableType ? getOtherNull.MakeGenericMethod(bindPropertyType) : getOther.MakeGenericMethod(bindPropertyType); | ||||
|                     method = isNullableType ? IDataReaderEntityBuilderHelpers.getOtherNull.MakeGenericMethod(bindPropertyType) : IDataReaderEntityBuilderHelpers.getOther.MakeGenericMethod(bindPropertyType); | ||||
|                 } | ||||
|                 else if (bindPropertyType == UtilConstants.StringType) | ||||
|                 { | ||||
|                     method = getString; | ||||
|                     method = IDataReaderEntityBuilderHelpers.getString; | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     method = isNullableType ? getOtherNull.MakeGenericMethod(bindPropertyType) : getOther.MakeGenericMethod(bindPropertyType); | ||||
|                     method = isNullableType ? IDataReaderEntityBuilderHelpers.getOtherNull.MakeGenericMethod(bindPropertyType) : IDataReaderEntityBuilderHelpers.getOther.MakeGenericMethod(bindPropertyType); | ||||
|                 } | ||||
|                 if (method.IsVirtual) | ||||
|                     generator.Emit(OpCodes.Callvirt, method); | ||||
| @@ -445,13 +390,13 @@ namespace ThingsGateway.SqlSugar | ||||
|                 case CSharpDataType.@int: | ||||
|                     CheckType(bind.IntThrow, bindPropertyTypeName, validPropertyName, propertyName); | ||||
|                     if (bindPropertyTypeName.IsContainsIn("int", "int32")) | ||||
|                         method = isNullableType ? getConvertInt32 : getInt32; | ||||
|                         method = isNullableType ? IDataReaderEntityBuilderHelpers.getConvertInt32 : IDataReaderEntityBuilderHelpers.getInt32; | ||||
|                     if (bindPropertyTypeName.IsContainsIn("int64")) | ||||
|                         method = null; | ||||
|                     if (bindPropertyTypeName.IsContainsIn("byte")) | ||||
|                         method = isNullableType ? getConvertByte : getByte; | ||||
|                         method = isNullableType ? IDataReaderEntityBuilderHelpers.getConvertByte : IDataReaderEntityBuilderHelpers.getByte; | ||||
|                     if (bindPropertyTypeName.IsContainsIn("int16")) | ||||
|                         method = isNullableType ? getConvertInt16 : getInt16; | ||||
|                         method = isNullableType ? IDataReaderEntityBuilderHelpers.getConvertInt16 : IDataReaderEntityBuilderHelpers.getInt16; | ||||
|                     if (bindPropertyTypeName == "uint32" && this.Context.CurrentConnectionConfig.DbType.IsIn(DbType.MySql, DbType.MySqlConnector)) | ||||
|                         method = null; | ||||
|                     if (bindPropertyTypeName == "int16") | ||||
| @@ -459,21 +404,21 @@ namespace ThingsGateway.SqlSugar | ||||
|                     break; | ||||
|                 case CSharpDataType.@bool: | ||||
|                     if (bindPropertyTypeName == "bool" || bindPropertyTypeName == "boolean") | ||||
|                         method = isNullableType ? getConvertBoolean : getBoolean; | ||||
|                         method = isNullableType ? IDataReaderEntityBuilderHelpers.getConvertBoolean : IDataReaderEntityBuilderHelpers.getBoolean; | ||||
|                     break; | ||||
|                 case CSharpDataType.@string: | ||||
|                     if (this.Context.CurrentConnectionConfig.DbType != DbType.Oracle) | ||||
|                     { | ||||
|                         CheckType(bind.StringThrow, bindPropertyTypeName, validPropertyName, propertyName); | ||||
|                     } | ||||
|                     method = getString; | ||||
|                     method = IDataReaderEntityBuilderHelpers.getString; | ||||
|                     if (bindPropertyTypeName == "guid") | ||||
|                     { | ||||
|                         method = isNullableType ? getConvertStringGuid : getStringGuid; | ||||
|                         method = isNullableType ? IDataReaderEntityBuilderHelpers.getConvertStringGuid : IDataReaderEntityBuilderHelpers.getStringGuid; | ||||
|                     } | ||||
|                     else if (bindPropertyTypeName == "xelement") | ||||
|                     { | ||||
|                         method = getXelement; | ||||
|                         method = IDataReaderEntityBuilderHelpers.getXelement; | ||||
|                     } | ||||
|                     else if (dbTypeName == "CHAR" && DataRecord.GetDataTypeName(ordinal) == "CHAR(36)") | ||||
|                     { | ||||
| @@ -487,35 +432,35 @@ namespace ThingsGateway.SqlSugar | ||||
|                 case CSharpDataType.DateTime: | ||||
|                     CheckType(bind.DateThrow, bindPropertyTypeName, validPropertyName, propertyName); | ||||
|                     if (bindPropertyTypeName == "datetime") | ||||
|                         method = isNullableType ? getConvertDateTime : getDateTime; | ||||
|                         method = isNullableType ? IDataReaderEntityBuilderHelpers.getConvertDateTime : IDataReaderEntityBuilderHelpers.getDateTime; | ||||
|                     if (bindPropertyTypeName == "datetime" && dbTypeName.Equals("time", StringComparison.CurrentCultureIgnoreCase)) | ||||
|                         method = isNullableType ? getConvertTime : getTime; | ||||
|                         method = isNullableType ? IDataReaderEntityBuilderHelpers.getConvertTime : IDataReaderEntityBuilderHelpers.getTime; | ||||
|                     if (bindPropertyTypeName == "datetimeoffset") | ||||
|                         method = isNullableType ? getConvertdatetimeoffset : getdatetimeoffset; | ||||
|                         method = isNullableType ? IDataReaderEntityBuilderHelpers.getConvertdatetimeoffset : IDataReaderEntityBuilderHelpers.getdatetimeoffset; | ||||
|                     break; | ||||
|                 case CSharpDataType.@decimal: | ||||
|                     CheckType(bind.DecimalThrow, bindPropertyTypeName, validPropertyName, propertyName); | ||||
|                     if (bindPropertyTypeName == "decimal") | ||||
|                         method = isNullableType ? getConvertDecimal : getDecimal; | ||||
|                         method = isNullableType ? IDataReaderEntityBuilderHelpers.getConvertDecimal : IDataReaderEntityBuilderHelpers.getDecimal; | ||||
|                     break; | ||||
|                 case CSharpDataType.@float: | ||||
|                 case CSharpDataType.@double: | ||||
|                     CheckType(bind.DoubleThrow, bindPropertyTypeName, validPropertyName, propertyName); | ||||
|                     if (bindPropertyTypeName.IsIn("double", "single") && dbTypeName != "real") | ||||
|                         method = isNullableType ? getConvertDouble : getDouble; | ||||
|                         method = isNullableType ? IDataReaderEntityBuilderHelpers.getConvertDouble : IDataReaderEntityBuilderHelpers.getDouble; | ||||
|                     else | ||||
|                         method = isNullableType ? getConvertFloat : getFloat; | ||||
|                         method = isNullableType ? IDataReaderEntityBuilderHelpers.getConvertFloat : IDataReaderEntityBuilderHelpers.getFloat; | ||||
|                     if (dbTypeName.Equals("float", StringComparison.CurrentCultureIgnoreCase) && isNullableType && bindPropertyTypeName.Equals("single", StringComparison.CurrentCultureIgnoreCase)) | ||||
|                     { | ||||
|                         method = getConvertDoubleToFloat; | ||||
|                         method = IDataReaderEntityBuilderHelpers.getConvertDoubleToFloat; | ||||
|                     } | ||||
|                     if (bindPropertyType == UtilConstants.DecType) | ||||
|                     { | ||||
|                         method = isNullableType ? getOtherNull.MakeGenericMethod(bindPropertyType) : getOther.MakeGenericMethod(bindPropertyType); | ||||
|                         method = isNullableType ? IDataReaderEntityBuilderHelpers.getOtherNull.MakeGenericMethod(bindPropertyType) : IDataReaderEntityBuilderHelpers.getOther.MakeGenericMethod(bindPropertyType); | ||||
|                     } | ||||
|                     if (bindPropertyType == UtilConstants.IntType) | ||||
|                     { | ||||
|                         method = isNullableType ? getOtherNull.MakeGenericMethod(bindPropertyType) : getOther.MakeGenericMethod(bindPropertyType); | ||||
|                         method = isNullableType ? IDataReaderEntityBuilderHelpers.getOtherNull.MakeGenericMethod(bindPropertyType) : IDataReaderEntityBuilderHelpers.getOther.MakeGenericMethod(bindPropertyType); | ||||
|                     } | ||||
|                     if (bindPropertyTypeName == "string") | ||||
|                     { | ||||
| @@ -525,45 +470,45 @@ namespace ThingsGateway.SqlSugar | ||||
|                 case CSharpDataType.Guid: | ||||
|                     CheckType(bind.GuidThrow, bindPropertyTypeName, validPropertyName, propertyName); | ||||
|                     if (bindPropertyTypeName == "guid") | ||||
|                         method = isNullableType ? getConvertGuid : getGuid; | ||||
|                         method = isNullableType ? IDataReaderEntityBuilderHelpers.getConvertGuid : IDataReaderEntityBuilderHelpers.getGuid; | ||||
|                     break; | ||||
|                 case CSharpDataType.@byte: | ||||
|                     if (bindPropertyTypeName == "byte") | ||||
|                         method = isNullableType ? getConvertByte : getByte; | ||||
|                         method = isNullableType ? IDataReaderEntityBuilderHelpers.getConvertByte : IDataReaderEntityBuilderHelpers.getByte; | ||||
|                     break; | ||||
|                 case CSharpDataType.@enum: | ||||
|                     method = isNullableType ? getConvertEnum_Null.MakeGenericMethod(bindPropertyType) : getEnum.MakeGenericMethod(bindPropertyType); | ||||
|                     method = isNullableType ? IDataReaderEntityBuilderHelpers.getConvertEnum_Null.MakeGenericMethod(bindPropertyType) : IDataReaderEntityBuilderHelpers.getEnum.MakeGenericMethod(bindPropertyType); | ||||
|                     break; | ||||
|                 case CSharpDataType.@short: | ||||
|                     CheckType(bind.ShortThrow, bindPropertyTypeName, validPropertyName, propertyName); | ||||
|                     if (bindPropertyTypeName == "int16" || bindPropertyTypeName == "short") | ||||
|                         method = isNullableType ? getConvertInt16 : getInt16; | ||||
|                         method = isNullableType ? IDataReaderEntityBuilderHelpers.getConvertInt16 : IDataReaderEntityBuilderHelpers.getInt16; | ||||
|                     break; | ||||
|                 case CSharpDataType.@long: | ||||
|                     if (bindPropertyTypeName == "int64" || bindPropertyTypeName == "long") | ||||
|                         method = isNullableType ? getConvertInt64 : getInt64; | ||||
|                         method = isNullableType ? IDataReaderEntityBuilderHelpers.getConvertInt64 : IDataReaderEntityBuilderHelpers.getInt64; | ||||
|                     break; | ||||
|                 case CSharpDataType.DateTimeOffset: | ||||
|                     method = isNullableType ? getConvertdatetimeoffset : getdatetimeoffset; | ||||
|                     method = isNullableType ? IDataReaderEntityBuilderHelpers.getConvertdatetimeoffset : IDataReaderEntityBuilderHelpers.getdatetimeoffset; | ||||
|                     if (bindPropertyTypeName == "datetime") | ||||
|                         method = isNullableType ? getConvertdatetimeoffsetDate : getdatetimeoffsetDate; | ||||
|                         method = isNullableType ? IDataReaderEntityBuilderHelpers.getConvertdatetimeoffsetDate : IDataReaderEntityBuilderHelpers.getdatetimeoffsetDate; | ||||
|                     break; | ||||
|                 case CSharpDataType.Single: | ||||
|                     break; | ||||
|                 default: | ||||
|                     method = isNullableType ? getOtherNull.MakeGenericMethod(bindPropertyType) : getOther.MakeGenericMethod(bindPropertyType); | ||||
|                     method = isNullableType ? IDataReaderEntityBuilderHelpers.getOtherNull.MakeGenericMethod(bindPropertyType) : IDataReaderEntityBuilderHelpers.getOther.MakeGenericMethod(bindPropertyType); | ||||
|                     break; | ||||
|             } | ||||
|             if (method == null && bindPropertyType == UtilConstants.StringType) | ||||
|             { | ||||
|                 method = getConvertString; | ||||
|                 method = IDataReaderEntityBuilderHelpers.getConvertString; | ||||
|             } | ||||
|             if (bindPropertyType == UtilConstants.ObjType) | ||||
|             { | ||||
|                 method = isNullableType ? getOtherNull.MakeGenericMethod(bindPropertyType) : getOther.MakeGenericMethod(bindPropertyType); | ||||
|                 method = isNullableType ? IDataReaderEntityBuilderHelpers.getOtherNull.MakeGenericMethod(bindPropertyType) : IDataReaderEntityBuilderHelpers.getOther.MakeGenericMethod(bindPropertyType); | ||||
|             } | ||||
|             if (method == null) | ||||
|                 method = isNullableType ? getOtherNull.MakeGenericMethod(bindPropertyType) : getOther.MakeGenericMethod(bindPropertyType); | ||||
|                 method = isNullableType ? IDataReaderEntityBuilderHelpers.getOtherNull.MakeGenericMethod(bindPropertyType) : IDataReaderEntityBuilderHelpers.getOther.MakeGenericMethod(bindPropertyType); | ||||
|  | ||||
|             if (method.IsVirtual) | ||||
|                 generator.Emit(OpCodes.Callvirt, method); | ||||
|   | ||||
| @@ -0,0 +1,65 @@ | ||||
| using System.Data; | ||||
| using System.Reflection; | ||||
|  | ||||
| namespace ThingsGateway.SqlSugar | ||||
| { | ||||
|     internal static class IDataReaderEntityBuilderHelpers | ||||
|     { | ||||
|  | ||||
|         /// <summary> | ||||
|         /// IsDBNull方法 | ||||
|         /// </summary> | ||||
|         internal static readonly MethodInfo isDBNullMethod = typeof(IDataRecord).GetMethod(nameof(IDataRecord.IsDBNull), new Type[] { typeof(int) }); | ||||
|         /// <summary> | ||||
|         /// GetBoolean方法 | ||||
|         /// </summary> | ||||
|         internal static readonly MethodInfo getBoolean = typeof(IDataRecord).GetMethod(nameof(IDataRecord.GetBoolean), new Type[] { typeof(int) }); | ||||
|         /// <summary> | ||||
|         /// GetByte方法 | ||||
|         /// </summary> | ||||
|         internal static readonly MethodInfo getByte = typeof(IDataRecord).GetMethod(nameof(IDataRecord.GetByte), new Type[] { typeof(int) }); | ||||
|         /// <summary> | ||||
|         /// GetDateTime方法 | ||||
|         /// </summary> | ||||
|         internal static readonly MethodInfo getDateTime = typeof(IDataRecord).GetMethod(nameof(IDataRecord.GetDateTime), new Type[] { typeof(int) }); | ||||
|         internal static readonly MethodInfo getDecimal = typeof(IDataRecord).GetMethod(nameof(IDataRecord.GetDecimal), new[] { typeof(int) }); | ||||
|         internal static readonly MethodInfo getDouble = typeof(IDataRecord).GetMethod(nameof(IDataRecord.GetDouble), new[] { typeof(int) }); | ||||
|         internal static readonly MethodInfo getFloat = typeof(IDataRecord).GetMethod(nameof(IDataRecord.GetFloat), new[] { typeof(int) }); | ||||
|         internal static readonly MethodInfo getGuid = typeof(IDataRecord).GetMethod(nameof(IDataRecord.GetGuid), new[] { typeof(int) }); | ||||
|         internal static readonly MethodInfo getInt16 = typeof(IDataRecord).GetMethod(nameof(IDataRecord.GetInt16), new[] { typeof(int) }); | ||||
|         internal static readonly MethodInfo getInt32 = typeof(IDataRecord).GetMethod(nameof(IDataRecord.GetInt32), new[] { typeof(int) }); | ||||
|         internal static readonly MethodInfo getInt64 = typeof(IDataRecord).GetMethod(nameof(IDataRecord.GetInt64), new[] { typeof(int) }); | ||||
|         internal static readonly MethodInfo getString = typeof(IDataRecord).GetMethod(nameof(IDataRecord.GetString), new[] { typeof(int) }); | ||||
|         internal static readonly MethodInfo getdatetimeoffset = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetDateTimeOffset)); | ||||
|         internal static readonly MethodInfo getdatetimeoffsetDate = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetDateTimeOffsetDate)); | ||||
|         internal static readonly MethodInfo getStringGuid = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetStringGuid)); | ||||
|         internal static readonly MethodInfo getXelement = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetXelement)); | ||||
|         internal static readonly MethodInfo getConvertStringGuid = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetConvertStringGuid)); | ||||
|         internal static readonly MethodInfo getEnum = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetEnum)); | ||||
|         internal static readonly MethodInfo getConvertString = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetConvertString)); | ||||
|         internal static readonly MethodInfo getConvertFloat = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetConvertFloat)); | ||||
|         internal static readonly MethodInfo getConvertBoolean = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetConvertBoolean)); | ||||
|         internal static readonly MethodInfo getConvertByte = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetConvertByte)); | ||||
|         internal static readonly MethodInfo getConvertChar = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetConvertChar)); | ||||
|         internal static readonly MethodInfo getConvertDateTime = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetConvertDateTime)); | ||||
|         internal static readonly MethodInfo getConvertTime = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetConvertTime)); | ||||
|         internal static readonly MethodInfo getTime = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetTime)); | ||||
|         internal static readonly MethodInfo getConvertDecimal = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetConvertDecimal)); | ||||
|         internal static readonly MethodInfo getConvertDouble = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetConvertDouble)); | ||||
|         internal static readonly MethodInfo getConvertDoubleToFloat = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetConvertDoubleToFloat)); | ||||
|         internal static readonly MethodInfo getConvertGuid = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetConvertGuid)); | ||||
|         internal static readonly MethodInfo getConvertInt16 = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetConvertInt16)); | ||||
|         internal static readonly MethodInfo getConvertInt32 = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetConvertInt32)); | ||||
|         internal static readonly MethodInfo getConvertInt64 = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetConvertInt64)); | ||||
|         internal static readonly MethodInfo getConvertEnum_Null = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetConvertEnum_Null)); | ||||
|         internal static readonly MethodInfo getConvertdatetimeoffset = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetConvertdatetimeoffset)); | ||||
|         internal static readonly MethodInfo getConvertdatetimeoffsetDate = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetConvertdatetimeoffsetDate)); | ||||
|         internal static readonly MethodInfo getOtherNull = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetOtherNull)); | ||||
|         internal static readonly MethodInfo getOther = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetOther)); | ||||
|         internal static readonly MethodInfo getJson = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetJson)); | ||||
|         internal static readonly MethodInfo getArray = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetArray)); | ||||
|         internal static readonly MethodInfo getEntity = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetEntity), new[] { typeof(SqlSugarProvider) }); | ||||
|         internal static readonly MethodInfo getMyIntNull = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetMyIntNull)); | ||||
|         internal static readonly MethodInfo getMyInt = typeof(IDataRecordExtensions).GetMethod(nameof(IDataRecordExtensions.GetMyInt)); | ||||
|     } | ||||
| } | ||||
| @@ -11,7 +11,7 @@ namespace ThingsGateway.SqlSugar | ||||
|         /// <summary> | ||||
|         /// 类模板 | ||||
|         /// </summary> | ||||
|         public static string ClassTemplate = "{using}\r\n" + | ||||
|         public const string ClassTemplate = "{using}\r\n" + | ||||
|                                                "namespace {Namespace}\r\n" + | ||||
|                                                "{\r\n" + | ||||
|                                                "{ClassDescription}{SugarTable}\r\n" + | ||||
| @@ -26,7 +26,7 @@ namespace ThingsGateway.SqlSugar | ||||
|         /// <summary> | ||||
|         /// 类描述模板 | ||||
|         /// </summary> | ||||
|         public static string ClassDescriptionTemplate = | ||||
|         public const string ClassDescriptionTemplate = | ||||
|                                                 ClassSpace + "///<summary>\r\n" + | ||||
|                                                 ClassSpace + "///{ClassDescription}" + | ||||
|                                                 ClassSpace + "///</summary>"; | ||||
| @@ -34,13 +34,13 @@ namespace ThingsGateway.SqlSugar | ||||
|         /// <summary> | ||||
|         /// 属性模板 | ||||
|         /// </summary> | ||||
|         public static string PropertyTemplate = PropertySpace + "{SugarColumn}\r\n" + | ||||
|         public const string PropertyTemplate = PropertySpace + "{SugarColumn}\r\n" + | ||||
|                                                 PropertySpace + "public {PropertyType} {PropertyName} {get;set;}\r\n"; | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 属性描述模板 | ||||
|         /// </summary> | ||||
|         public static string PropertyDescriptionTemplate = | ||||
|         public const string PropertyDescriptionTemplate = | ||||
|                                                 PropertySpace + "/// <summary>\r\n" + | ||||
|                                                 PropertySpace + "/// Desc:{PropertyDescription}\r\n" + | ||||
|                                                 PropertySpace + "/// Default:{DefaultValue}\r\n" + | ||||
| @@ -50,12 +50,12 @@ namespace ThingsGateway.SqlSugar | ||||
|         /// <summary> | ||||
|         /// 构造函数模板 | ||||
|         /// </summary> | ||||
|         public static string ConstructorTemplate = PropertySpace + " this.{PropertyName} ={DefaultValue};\r\n"; | ||||
|         public const string ConstructorTemplate = PropertySpace + " this.{PropertyName} ={DefaultValue};\r\n"; | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 命名空间模板 | ||||
|         /// </summary> | ||||
|         public static string UsingTemplate = "using System;\r\n" + | ||||
|         public const string UsingTemplate = "using System;\r\n" + | ||||
|                                                "using System.Linq;\r\n" + | ||||
|                                                "using System.Text;" + "\r\n"; | ||||
|         #endregion | ||||
|   | ||||
| @@ -19,7 +19,7 @@ namespace ThingsGateway.SqlSugar | ||||
|         /// <summary> | ||||
|         /// 默认Razor类模板 | ||||
|         /// </summary> | ||||
|         public static string DefaultRazorClassTemplate = | ||||
|         public const string DefaultRazorClassTemplate = | ||||
| @"using System; | ||||
| using System.Linq; | ||||
| using System.Text; | ||||
|   | ||||
| @@ -8,7 +8,7 @@ namespace ThingsGateway.SqlSugar | ||||
|         SqlSugarProvider Context { get; set; } | ||||
|         internal ISqlBuilder Builder; | ||||
|         List<SugarParameter> Parameters; | ||||
|         IEnumerable<StorageableInfo<T>> allDatas; | ||||
|         StorageableInfo<T>[] allDatas; | ||||
|         List<T> dbDataList = new List<T>(); | ||||
|         List<KeyValuePair<StorageType, Func<StorageableInfo<T>, bool>, string>> whereFuncs = new List<KeyValuePair<StorageType, Func<StorageableInfo<T>, bool>, string>>(); | ||||
|         Expression<Func<T, object>> whereExpression; | ||||
| @@ -24,7 +24,7 @@ namespace ThingsGateway.SqlSugar | ||||
|             this.allDatas = datas.Select(it => new StorageableInfo<T>() | ||||
|             { | ||||
|                 Item = it | ||||
|             }); | ||||
|             }).ToArray(); | ||||
|         } | ||||
|  | ||||
|         Expression<Func<T, bool>> queryableWhereExp; | ||||
| @@ -209,7 +209,7 @@ namespace ThingsGateway.SqlSugar | ||||
|             { | ||||
|                 return this.Saveable().ToStorage(); | ||||
|             } | ||||
|             if (!this.allDatas.Any()) | ||||
|             if (this.allDatas.Length == 0) | ||||
|                 return new StorageableResult<T>() | ||||
|                 { | ||||
|                     AsDeleteable = this.Context.Deleteable<T>().AS(asname).Where(it => false), | ||||
| @@ -298,7 +298,7 @@ namespace ThingsGateway.SqlSugar | ||||
|             { | ||||
|                 return this.Saveable().GetStorageableResult(); | ||||
|             } | ||||
|             if (!this.allDatas.Any()) | ||||
|             if (this.allDatas.Length == 0) | ||||
|                 return new StorageableResult<T>() | ||||
|                 { | ||||
|                     //AsDeleteable = this.Context.Deleteable<T>().AS(asname).Where(it => false), | ||||
| @@ -380,7 +380,7 @@ namespace ThingsGateway.SqlSugar | ||||
|             { | ||||
|                 return await Saveable().ToStorageAsync().ConfigureAwait(false); | ||||
|             } | ||||
|             if (!this.allDatas.Any()) | ||||
|             if (this.allDatas.Length == 0) | ||||
|                 return new StorageableResult<T>() | ||||
|                 { | ||||
|                     AsDeleteable = this.Context.Deleteable<T>().AS(asname).Where(it => false), | ||||
|   | ||||
| @@ -6,7 +6,7 @@ namespace ThingsGateway.SqlSugar | ||||
|     { | ||||
|         internal SqlSugarProvider Context { get; set; } | ||||
|         internal MethodInfo MethodInfo { get; set; } | ||||
|         internal object objectValue { get; set; } | ||||
|         internal object ObjValue { get; set; } | ||||
|         public int ExecuteCommand() | ||||
|         { | ||||
|             if (Context == null) return 0; | ||||
| @@ -20,16 +20,14 @@ namespace ThingsGateway.SqlSugar | ||||
|         { | ||||
|             get | ||||
|             { | ||||
|                 var type = "AsInsertable"; | ||||
|                 return GetAs(type); | ||||
|                 return GetAs(nameof(AsInsertable)); | ||||
|             } | ||||
|         } | ||||
|         public StorageableAsMethodInfo AsUpdateable | ||||
|         { | ||||
|             get | ||||
|             { | ||||
|                 var type = "AsUpdateable"; | ||||
|                 return GetAs(type); | ||||
|                 return GetAs(nameof(AsUpdateable)); | ||||
|             } | ||||
|         } | ||||
|  | ||||
| @@ -48,9 +46,9 @@ namespace ThingsGateway.SqlSugar | ||||
|  | ||||
|         private MethodInfo GetSaveMethod(ref object callValue) | ||||
|         { | ||||
|             if (objectValue == null) | ||||
|             if (ObjValue == null) | ||||
|                 return null; | ||||
|             callValue = MethodInfo.Invoke(Context, new object[] { objectValue }); | ||||
|             callValue = MethodInfo.Invoke(Context, new object[] { ObjValue }); | ||||
|             return callValue.GetType().GetMyMethod(nameof(ExecuteCommand), 0); | ||||
|         } | ||||
|  | ||||
|   | ||||
| @@ -1113,7 +1113,7 @@ namespace ThingsGateway.SqlSugar | ||||
|                 { | ||||
|                     Context = this.Context, | ||||
|                     MethodInfo = method, | ||||
|                     objectValue = newList | ||||
|                     ObjValue = newList | ||||
|                 }; | ||||
|                 return result; | ||||
|             } | ||||
| @@ -1126,7 +1126,7 @@ namespace ThingsGateway.SqlSugar | ||||
|                 { | ||||
|                     Context = this.Context, | ||||
|                     MethodInfo = method, | ||||
|                     objectValue = singleEntityObjectOrList | ||||
|                     ObjValue = singleEntityObjectOrList | ||||
|                 }; | ||||
|                 return result; | ||||
|             } | ||||
|   | ||||
| @@ -2,7 +2,7 @@ | ||||
| { | ||||
|     public sealed class SnowFlakeSingle | ||||
|     { | ||||
|         private static object LockObject = new object(); | ||||
|         private static readonly object LockObject = new object(); | ||||
|         private static DistributedSystem.Snowflake.IdWorker worker; | ||||
|         public static int WorkId = 1; | ||||
|         public static int DatacenterId = 1; | ||||
|   | ||||
| @@ -99,10 +99,7 @@ namespace ThingsGateway.SqlSugar | ||||
|  | ||||
|         public void RemoveAllCache() | ||||
|         { | ||||
|             foreach (var key in GetAllKey()) | ||||
|             { | ||||
|                 this.Remove(key); | ||||
|             } | ||||
|             this.InstanceCache.Clear(); | ||||
|         } | ||||
|  | ||||
|         public IEnumerable<string> GetAllKey() | ||||
|   | ||||
| @@ -8,6 +8,8 @@ using System.Text.Json; | ||||
| using System.Text.Json.Serialization; | ||||
| using System.Text.Json.Serialization.Metadata; | ||||
|  | ||||
| using ThingsGateway.NewLife.Json.Extension; | ||||
|  | ||||
| using JsonProperty = Newtonsoft.Json.Serialization.JsonProperty; | ||||
|  | ||||
| namespace ThingsGateway.SqlSugar | ||||
| @@ -23,8 +25,10 @@ namespace ThingsGateway.SqlSugar | ||||
|  | ||||
|         private static readonly JsonSerializerOptions _systemTextJsonSettings = new() | ||||
|         { | ||||
|             Encoder = System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping, | ||||
|             PropertyNamingPolicy = JsonNamingPolicy.CamelCase, | ||||
|             DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, | ||||
|             NumberHandling = JsonNumberHandling.AllowNamedFloatingPointLiterals, | ||||
|         }; | ||||
|  | ||||
|         private static readonly ConcurrentDictionary<Type, SugarColumn> _typeInfoCache = new(); | ||||
| @@ -52,6 +56,11 @@ namespace ThingsGateway.SqlSugar | ||||
|  | ||||
|                         } | ||||
|                     }); | ||||
|  | ||||
|             _systemTextJsonSettings.Converters.Add(new JTokenSystemTextJsonConverter()); | ||||
|             _systemTextJsonSettings.Converters.Add(new JValueSystemTextJsonConverter()); | ||||
|             _systemTextJsonSettings.Converters.Add(new JObjectSystemTextJsonConverter()); | ||||
|             _systemTextJsonSettings.Converters.Add(new JArraySystemTextJsonConverter()); | ||||
|             _systemTextJsonSettings.TypeInfoResolver = resolver; | ||||
|         } | ||||
|         public static bool UseNewtonsoftJson = false; | ||||
|   | ||||
| @@ -28,6 +28,11 @@ namespace ThingsGateway.SqlSugar | ||||
|                 this.Context.Close(); | ||||
|             } | ||||
|         } | ||||
|         public Task<string> CreateTempAsync<T>(Dictionary<string, (Type, List<DataInfos>)> list) where T : class, new() | ||||
|         { | ||||
|             IsUpdate = true; | ||||
|             return Task.FromResult(string.Empty); | ||||
|         } | ||||
|  | ||||
|         public Task CreateTempAsync<T>(DataTable dt) where T : class, new() | ||||
|         { | ||||
| @@ -171,7 +176,7 @@ namespace ThingsGateway.SqlSugar | ||||
|                 else | ||||
|                 { | ||||
|                     var count = list.FirstOrDefault().Value.Item2?.Count; | ||||
|                     if(count==1) | ||||
|                     if (count == 1) | ||||
|                     { | ||||
|                         var row = list.GetRows(0).ToDictionary(a => a.ColumnName, a => a.Value); | ||||
|                         cmd.CommandText = this.Context.InsertableT(row).AS(tableName).ToSqlString().Replace(";SELECT LAST_INSERT_ROWID();", ""); | ||||
|   | ||||
| @@ -32,7 +32,7 @@ | ||||
| 		<PackageReference Include="CsvHelper" Version="33.1.0" /> | ||||
| 		<PackageReference Include="TDengine.Connector" Version="3.1.9" /> | ||||
| 		<PackageReference Include="Oracle.ManagedDataAccess.Core" Version="23.9.1" /> | ||||
| 		<PackageReference Include="Oscar.Data.SqlClient" Version="4.2.27" /> | ||||
| 		<PackageReference Include="Oscar.Data.SqlClient" Version="4.2.28" /> | ||||
| 		<PackageReference Include="System.Data.Common" Version="4.3.0" /> | ||||
| 		<PackageReference Include="Microsoft.Data.SqlClient" Version="6.1.2" /> | ||||
| 		<PackageReference Include="System.Reflection.Emit.Lightweight" Version="4.7.0" /> | ||||
|   | ||||
| @@ -1,9 +1,9 @@ | ||||
| <Project> | ||||
|  | ||||
| 	<PropertyGroup> | ||||
| 		<PluginVersion>10.11.90</PluginVersion> | ||||
| 		<ProPluginVersion>10.11.90</ProPluginVersion> | ||||
| 		<DefaultVersion>10.11.90</DefaultVersion> | ||||
| 		<PluginVersion>10.11.97</PluginVersion> | ||||
| 		<ProPluginVersion>10.11.97</ProPluginVersion> | ||||
| 		<DefaultVersion>10.11.97</DefaultVersion> | ||||
| 		<AuthenticationVersion>10.11.6</AuthenticationVersion> | ||||
| 		<SourceGeneratorVersion>10.11.6</SourceGeneratorVersion> | ||||
| 		<NET8Version>8.0.20</NET8Version> | ||||
| @@ -12,7 +12,7 @@ | ||||
| 		<IsTrimmable>false</IsTrimmable> | ||||
| 		<ManagementProPluginVersion>10.11.87</ManagementProPluginVersion> | ||||
| 		<ManagementPluginVersion>10.11.87</ManagementPluginVersion> | ||||
| 		<TSVersion>4.0.0-beta.96</TSVersion> | ||||
| 		<TSVersion>4.0.0-beta.115</TSVersion> | ||||
| 		 | ||||
| 		 | ||||
| 	</PropertyGroup> | ||||
|   | ||||
| @@ -113,7 +113,7 @@ public partial class ManagementTask : AsyncDisposableObject | ||||
|                .ConfigurePlugins(a => | ||||
|                { | ||||
|                    a.UseTcpSessionCheckClear(); | ||||
|                    a.UseDmtpRpc().ConfigureDefaultSerializationSelector(b => | ||||
|                    a.UseDmtpRpc(a => a.ConfigureDefaultSerializationSelector(b => | ||||
|                    { | ||||
|                        b.UseSystemTextJson(json => | ||||
|                        { | ||||
| @@ -123,7 +123,7 @@ public partial class ManagementTask : AsyncDisposableObject | ||||
|                            json.Converters.Add(new JObjectSystemTextJsonConverter()); | ||||
|                            json.Converters.Add(new JArraySystemTextJsonConverter()); | ||||
|                        }); | ||||
|                    }); | ||||
|                    })); | ||||
|  | ||||
|                    a.UseDmtpFileTransfer();//必须添加文件传输插件 | ||||
|  | ||||
| @@ -176,7 +176,7 @@ public partial class ManagementTask : AsyncDisposableObject | ||||
|                .ConfigurePlugins(a => | ||||
|                { | ||||
|                    a.UseTcpSessionCheckClear(); | ||||
|                    a.UseDmtpRpc().ConfigureDefaultSerializationSelector(b => | ||||
|                    a.UseDmtpRpc(a => a.ConfigureDefaultSerializationSelector(b => | ||||
|                    { | ||||
|                        b.UseSystemTextJson(json => | ||||
|                        { | ||||
| @@ -186,7 +186,7 @@ public partial class ManagementTask : AsyncDisposableObject | ||||
|                            json.Converters.Add(new JObjectSystemTextJsonConverter()); | ||||
|                            json.Converters.Add(new JArraySystemTextJsonConverter()); | ||||
|                        }); | ||||
|                    }); | ||||
|                    })); | ||||
|  | ||||
|                    a.UseDmtpFileTransfer();//必须添加文件传输插件 | ||||
|  | ||||
|   | ||||
| @@ -346,7 +346,7 @@ internal sealed class RedundancyTask : IRpcDriver, IAsyncDisposable | ||||
|                { | ||||
|                    a.UseTcpSessionCheckClear(); | ||||
|  | ||||
|                    a.UseDmtpRpc().ConfigureDefaultSerializationSelector(b => | ||||
|                    a.UseDmtpRpc(a => a.ConfigureDefaultSerializationSelector(b => | ||||
|                    { | ||||
|                        b.UseSystemTextJson(json => | ||||
|                        { | ||||
| @@ -356,7 +356,7 @@ internal sealed class RedundancyTask : IRpcDriver, IAsyncDisposable | ||||
|                            json.Converters.Add(new JObjectSystemTextJsonConverter()); | ||||
|                            json.Converters.Add(new JArraySystemTextJsonConverter()); | ||||
|                        }); | ||||
|                    }); | ||||
|                    })); | ||||
|                    a.UseDmtpHeartbeat()//使用Dmtp心跳 | ||||
|                    .SetTick(TimeSpan.FromMilliseconds(redundancy.HeartbeatInterval)) | ||||
|                    .SetMaxFailCount(redundancy.MaxErrorCount); | ||||
| @@ -390,7 +390,7 @@ internal sealed class RedundancyTask : IRpcDriver, IAsyncDisposable | ||||
|                .ConfigurePlugins(a => | ||||
|                { | ||||
|                    a.UseTcpSessionCheckClear(); | ||||
|                    a.UseDmtpRpc().ConfigureDefaultSerializationSelector(b => | ||||
|                    a.UseDmtpRpc(a => a.ConfigureDefaultSerializationSelector(b => | ||||
|                    { | ||||
|                        b.UseSystemTextJson(json => | ||||
|                        { | ||||
| @@ -400,7 +400,7 @@ internal sealed class RedundancyTask : IRpcDriver, IAsyncDisposable | ||||
|                            json.Converters.Add(new JObjectSystemTextJsonConverter()); | ||||
|                            json.Converters.Add(new JArraySystemTextJsonConverter()); | ||||
|                        }); | ||||
|                    }); | ||||
|                    })); | ||||
|                    a.UseDmtpHeartbeat()//使用Dmtp心跳 | ||||
|                    .SetTick(TimeSpan.FromMilliseconds(redundancy.HeartbeatInterval)) | ||||
|                    .SetMaxFailCount(redundancy.MaxErrorCount); | ||||
|   | ||||
| @@ -711,7 +711,7 @@ internal sealed class PluginService : IPluginService | ||||
|         { | ||||
|             using var fs = new FileStream(item, FileMode.Open); | ||||
|             //var cachePath = Path.GetDirectoryName(item).CombinePathWithOs($"Cache{cacheId}").CombinePath(Path.GetFileName(item)); | ||||
|             if (item == path) | ||||
|             if (Path.GetFullPath(item) == Path.GetFullPath(path)) | ||||
|             { | ||||
|                 assembly = assemblyLoadContext.LoadFromStream(fs); //加载主程序集,并获取 | ||||
|  | ||||
|   | ||||
| @@ -104,7 +104,14 @@ public static class RuleHelpers | ||||
|         { | ||||
|             if (propertyInfos.TryGetValue(item.Key, out var propertyInfo)) | ||||
|             { | ||||
|                 propertyInfo.SetValue(nodeModel, item.Value?.ToObject(propertyInfo.PropertyType)); | ||||
|                 try | ||||
|                 { | ||||
|                     propertyInfo.SetValue(nodeModel, item.Value?.ToObject(propertyInfo.PropertyType)); | ||||
|                 } | ||||
|                 catch (Exception) | ||||
|                 { | ||||
|                     propertyInfo.SetValue(nodeModel, null); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|   | ||||
| @@ -17,13 +17,13 @@ | ||||
| 		<AssemblyName>ThingsGateway.Plugin.Kafka</AssemblyName> | ||||
| 		<PackageId>$(MSBuildProjectName)</PackageId> | ||||
| 	</PropertyGroup> | ||||
| 	 | ||||
|  | ||||
| 	<ItemGroup> | ||||
| 		<ProjectReference Include="..\..\PluginPro\ThingsGateway.Management.Razor\ThingsGateway.Management.Razor.csproj" > | ||||
| 		<ProjectReference Include="..\..\PluginPro\ThingsGateway.Management.Razor\ThingsGateway.Management.Razor.csproj"> | ||||
| 			<PrivateAssets>contentFiles;compile;build;buildMultitargeting;buildTransitive;analyzers;</PrivateAssets> | ||||
| 		</ProjectReference> | ||||
| 		 | ||||
| 		<PackageReference Include="Confluent.Kafka" Version="2.11.1" GeneratePathProperty="true"> | ||||
|  | ||||
| 		<PackageReference Include="Confluent.Kafka" Version="2.12.0" GeneratePathProperty="true"> | ||||
| 			<PrivateAssets>contentFiles;compile;build;buildMultitargeting;buildTransitive;analyzers;</PrivateAssets> | ||||
| 		</PackageReference> | ||||
| 	</ItemGroup> | ||||
| @@ -34,6 +34,6 @@ | ||||
| 			<CopyToOutputDirectory>Never</CopyToOutputDirectory> | ||||
| 		</EmbeddedResource> | ||||
| 	</ItemGroup> | ||||
| 	 | ||||
|  | ||||
| </Project> | ||||
|  | ||||
|   | ||||
| @@ -11,26 +11,7 @@ public class TestKafkaDynamicModel1 : DynamicModelBase | ||||
|  | ||||
|     public TestKafkaDynamicModel1() | ||||
|     { | ||||
|         var name = "测试MqttServer"; | ||||
|         if (GlobalData.ReadOnlyDevices.TryGetValue(name, out var kafka1)) | ||||
|         { | ||||
|             id = kafka1.Id; | ||||
|  | ||||
|             foreach (var item in kafka1.Driver?.IdVariableRuntimes) | ||||
|             { | ||||
|                 //变量备注1作为Key(AE报警SourceId) | ||||
|                 var data1 = item.Value.GetPropertyValue(id, nameof(BusinessVariableProperty.Data1)); | ||||
|                 if (!data1.IsNullOrEmpty()) | ||||
|                 { | ||||
|                     variableRuntimes.Add(data1, item.Value); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             throw new Exception($"找不到设备 {name}"); | ||||
|         } | ||||
|  | ||||
|     } | ||||
|  | ||||
| @@ -38,6 +19,48 @@ public class TestKafkaDynamicModel1 : DynamicModelBase | ||||
|  | ||||
|     public override IEnumerable<dynamic> GetList(IEnumerable<object> datas) | ||||
|     { | ||||
|         if (id == 0) | ||||
|         { | ||||
|  | ||||
|             var name = "kafka_DA"; Logger?.LogInformation("进来了10000"); | ||||
|             if (GlobalData.ReadOnlyDevices.TryGetValue(name, out var kafka1)) | ||||
|             { | ||||
|                 id = kafka1.Id; | ||||
|  | ||||
|                 if (kafka1.Driver != null) | ||||
|                 { | ||||
|                     foreach (var item in kafka1.Driver?.IdVariableRuntimes) | ||||
|                     { | ||||
|                         //变量备注1作为Key(AE报警SourceId) | ||||
|                         var data1 = item.Value.GetPropertyValue(id, nameof(BusinessVariableProperty.Data1)); | ||||
|                         if (!data1.IsNullOrEmpty()) | ||||
|                         { | ||||
|                             variableRuntimes.Add(data1, item.Value); | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     foreach (var item in kafka1.ReadOnlyVariableRuntimes) | ||||
|                     { | ||||
|                         //变量备注1作为Key(AE报警SourceId) | ||||
|                         var data1 = item.Value.GetPropertyValue(id, nameof(BusinessVariableProperty.Data1)); | ||||
|                         if (!data1.IsNullOrEmpty()) | ||||
|                         { | ||||
|                             variableRuntimes.Add(data1, item.Value); | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 throw new Exception($"找不到设备 {name}"); | ||||
|             } | ||||
|  | ||||
|         } | ||||
|  | ||||
|  | ||||
|  | ||||
|         if (datas == null) return null; | ||||
|         var pluginEventDatas = datas.Cast<PluginEventData>(); | ||||
|         var opcDatas = pluginEventDatas.Select( | ||||
| @@ -67,13 +90,14 @@ public class TestKafkaDynamicModel1 : DynamicModelBase | ||||
|             //重连时触发的事件,可以跳过不处理 | ||||
|             //if(opcAeEventData.Refresh) | ||||
|             //    continue; | ||||
|             Logger?.LogInformation("进来了"); | ||||
|             var sourceName = opcAeEventData.SourceID; | ||||
|             if (variableRuntimes.TryGetValue(sourceName, out var variableRuntime)) | ||||
|             { | ||||
|  | ||||
|                 var ack = opcAeEventData.EventType != Opc.Ae.EventType.Condition ? false : ((Opc.Ae.ConditionState)opcAeEventData.NewState).HasFlag(Opc.Ae.ConditionState.Acknowledged); | ||||
|  | ||||
|                 bool isRecover = opcAeEventData.EventType != Opc.Ae.EventType.Condition ? false : !((Opc.Ae.ConditionState)opcAeEventData.NewState).HasFlag(Opc.Ae.ConditionState.Active); | ||||
|  | ||||
|                 if (opcAeEventData.EventType != Opc.Ae.EventType.Condition) | ||||
|                 { | ||||
|                     bool alarm = (opcAeEventData.Message).Contains("raised"); | ||||
| @@ -92,6 +116,71 @@ public class TestKafkaDynamicModel1 : DynamicModelBase | ||||
|                     isRecover = !alarm; | ||||
|                 } | ||||
|  | ||||
|  | ||||
|                 //判断报警类型 | ||||
|                 string _alarmInfo = ""; | ||||
|                 Logger.LogDebug($"opcAeEventData.ConditionName:{opcAeEventData.ConditionName}"); | ||||
|                 Logger.LogDebug($"opcAeEventData.NewState:{opcAeEventData.NewState}"); | ||||
|                 // 处理特定条件名称 | ||||
|                 if (opcAeEventData.ConditionName == "CiAdvancedAlarmState" || | ||||
|                     opcAeEventData.ConditionName == "CiDigitalAlarmState") | ||||
|                 { | ||||
|                     string _data8 = variableRuntime.GetPropertyValue(id, nameof(BusinessVariableProperty.Data8)); | ||||
|                     string[] data8Parts = _data8?.Split(',', StringSplitOptions.RemoveEmptyEntries) ?? Array.Empty<string>(); | ||||
|                     _alarmInfo = opcAeEventData.NewState switch | ||||
|                     { | ||||
|                         3 when data8Parts.Length > 0 => data8Parts[0], | ||||
|                         1 when data8Parts.Length > 1 => data8Parts[1], | ||||
|                         7 => "确认", | ||||
|                         _ => "" | ||||
|                     }; | ||||
|                     Logger.LogDebug($"_alarmInfo:{_alarmInfo}"); | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     // 处理确认状态 | ||||
|                     if (opcAeEventData.NewState == 7) | ||||
|                     { | ||||
|                         _alarmInfo = "确认"; | ||||
|                     } | ||||
|                     else | ||||
|                     { | ||||
|                         // 处理其他状态 | ||||
|                         _alarmInfo = string.IsNullOrEmpty(opcAeEventData.SubConditionName) | ||||
|                             ? "恢复" | ||||
|                             : opcAeEventData.SubConditionName switch | ||||
|                             { | ||||
|                                 "CiAnalogAlarmHighHigh" => "高高限报警", | ||||
|                                 "CiAnalogAlarmHigh" => "高限报警", | ||||
|                                 "CiAnalogAlarmLow" => "低限报警", | ||||
|                                 "CiAnalogAlarmLowLow" => "低低限报警", | ||||
|                                 "CiDigitalAlarmOn" => "合闸", | ||||
|                                 "CiAdvancedAlarmOn" => "通讯中断", | ||||
|                                 _ => "恢复" // 默认值 | ||||
|                             }; | ||||
|                     } | ||||
|                 } | ||||
|  | ||||
|  | ||||
|                 //处理报警等级 | ||||
|                 string _alarmLevel = opcAeEventData.Severity switch | ||||
|                 { | ||||
|                     997 => "1", | ||||
|                     993 => "2", | ||||
|                     989 => "3", | ||||
|                     985 => "4", | ||||
|                     _ => "0" | ||||
|                 }; | ||||
|  | ||||
|                 //处理报警内容 | ||||
|                 string content = ""; | ||||
|                 string _msg = opcAeEventData.Message; | ||||
|                 string[] parts = _msg.Split('-', StringSplitOptions.RemoveEmptyEntries); | ||||
|                 if (parts.Length >= 2) | ||||
|                 { | ||||
|                     content = parts[1]; | ||||
|                 } | ||||
|  | ||||
|                 //构建告警实体 | ||||
|                 KafkaAlarmEntity alarmEntity = new KafkaAlarmEntity | ||||
|                 { | ||||
| @@ -100,14 +189,15 @@ public class TestKafkaDynamicModel1 : DynamicModelBase | ||||
|                     resourceName = variableRuntime.GetPropertyValue(id, nameof(BusinessVariableProperty.Data4)), //资源名称   | ||||
|                     metricCode = variableRuntime.GetPropertyValue(id, nameof(BusinessVariableProperty.Data5)), //指标编码 | ||||
|                     metricName = variableRuntime.GetPropertyValue(id, nameof(BusinessVariableProperty.Data6)), //指标名称 | ||||
|                     content = $"{variableRuntime.GetPropertyValue(id, nameof(BusinessVariableProperty.Data4))}{variableRuntime.GetPropertyValue(id, nameof(BusinessVariableProperty.Data6))}{opcAeEventData.Message}", //告警内容,设备名称+告警内容(包含阈值信息),可能opcae里没有带阈值信息,那么就需要录入固定值,可选Data10 | ||||
|                     content = $"{variableRuntime.GetPropertyValue(id, nameof(BusinessVariableProperty.Data4))}{variableRuntime.GetPropertyValue(id, nameof(BusinessVariableProperty.Data6))}{content}_{_alarmInfo}", //告警内容,设备名称+告警内容(包含阈值信息),可能opcae里没有带阈值信息,那么就需要录入固定值,可选Data10 | ||||
|                     alarmType = variableRuntime.GetPropertyValue(id, nameof(BusinessVariableProperty.Data7)), // opcAeEventData.Severity 告警类型,子系统产生告警的类型,可能需要固定备注值 | ||||
|  | ||||
|                     confirmedTime = ack ? opcAeEventData.Time.DateTimeToUnixTimestamp() : null, //告警确认时间 | ||||
|                     fixTime = isRecover ? opcAeEventData.Time : null, //解除告警时间 | ||||
|                     lastTime = opcAeEventData.AlarmTime, //产生告警时间 | ||||
|                     status = isRecover ? "FIXED" : "UNFIXED", //告警状态 | ||||
|                     alarmLevel = variableRuntime.GetPropertyValue(id, nameof(BusinessVariableProperty.Data8)), //opcAeEventData.Severity.ToString(), //告警等级,可能需要固定备注值 | ||||
|                     alarmLevel = _alarmLevel, | ||||
|                     // alarmLevel = variableRuntime.GetPropertyValue(id, nameof(BusinessVariableProperty.Data8)), //opcAeEventData.Severity.ToString(), //告警等级,可能需要固定备注值 | ||||
|                     subSystemCode = variableRuntime.GetPropertyValue(id, nameof(BusinessVariableProperty.Data9)), //子系统编码 | ||||
|                     type = "SUB_SYSTEM_ALARM", //默认填写字段 | ||||
|                     confirmAccount = opcAeEventData.ActorID, //告警确认人 | ||||
|   | ||||
| @@ -28,8 +28,6 @@ public partial class GatewayIndexComponent : IDisposable | ||||
|  | ||||
|     [Parameter] | ||||
|     [EditorRequired] | ||||
|     [NotNull] | ||||
|     [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] | ||||
|     public IStringLocalizer Localizer { get; set; } | ||||
|  | ||||
|     private Chart AlarmPie { get; set; } | ||||
| @@ -44,7 +42,6 @@ public partial class GatewayIndexComponent : IDisposable | ||||
|     public void Dispose() | ||||
|     { | ||||
|         Disposed = true; | ||||
|         GC.SuppressFinalize(this); | ||||
|     } | ||||
|  | ||||
|     protected override void OnInitialized() | ||||
| @@ -68,12 +65,15 @@ public partial class GatewayIndexComponent : IDisposable | ||||
|                 if (AlarmPieInit) | ||||
|                     await AlarmPie.Update(ChartAction.Update); | ||||
|                 await InvokeAsync(StateHasChanged); | ||||
|                 await Task.Delay(5000); | ||||
|             } | ||||
|             catch (Exception ex) | ||||
|             { | ||||
|                 NewLife.Log.XTrace.WriteException(ex); | ||||
|             } | ||||
|             finally | ||||
|             { | ||||
|                 await Task.Delay(5000); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user