消除部分warning
This commit is contained in:
@@ -190,7 +190,7 @@ public static class CodeGenHelper
|
||||
field = entityInfo.Columns.Find(it => it.PropertyName.Equals(sort.ToUpperCase()))?.DbColumnName;
|
||||
break;
|
||||
}
|
||||
return string.IsNullOrEmpty(field) ? null : field;
|
||||
return string.IsNullOrEmpty(field) ? "" : field;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -63,7 +63,7 @@ public static class ComparisonHelper<T>
|
||||
/// <param name="x"></param>
|
||||
/// <param name="y"></param>
|
||||
/// <returns></returns>
|
||||
public int Compare(T x, T y)
|
||||
public int Compare(T? x, T? y)
|
||||
{
|
||||
return _comparer.Compare(_keySelector(x), _keySelector(y));
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using JNPF.DependencyInjection;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using JNPF.DependencyInjection;
|
||||
|
||||
namespace JNPF.Common.Security;
|
||||
|
||||
@@ -49,14 +50,14 @@ public static class EqualityHelper<T>
|
||||
: this(keySelector, EqualityComparer<TV>.Default)
|
||||
{ }
|
||||
|
||||
public bool Equals(T x, T y)
|
||||
public bool Equals(T? x, T? y)
|
||||
{
|
||||
return _comparer.Equals(_keySelector(x), _keySelector(y));
|
||||
}
|
||||
|
||||
public int GetHashCode(T obj)
|
||||
public int GetHashCode([DisallowNull] T obj)
|
||||
{
|
||||
return _comparer.GetHashCode(_keySelector(obj));
|
||||
return _comparer.GetHashCode(_keySelector(obj)!);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ using NPOI.XSSF.UserModel;
|
||||
|
||||
namespace JNPF.Common.Security;
|
||||
|
||||
#pragma warning disable CS8602, CS0618, CA2200
|
||||
/// <summary>
|
||||
/// Excel导出操作类
|
||||
/// 版 本:V3.2.0
|
||||
@@ -740,7 +741,7 @@ public class ExcelExportHelper<T>
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw;
|
||||
throw ex;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1039,7 +1040,7 @@ public class ExcelExportHelper<T>
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw;
|
||||
throw ex;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1168,4 +1169,5 @@ public class ExcelExportHelper<T>
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#pragma warning restore CS8602, CS0618, CA2200
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace JNPF.Common.Helper
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
dataRow[j] = cell.ToString().Trim();
|
||||
dataRow[j] = cell.ToString()?.Trim();
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -505,6 +505,7 @@ public class FileHelper
|
||||
|
||||
#endregion
|
||||
|
||||
#pragma warning disable CA1416 // 验证平台兼容性
|
||||
#region 生成高清晰缩略图
|
||||
|
||||
/// <summary>
|
||||
@@ -669,6 +670,7 @@ public class FileHelper
|
||||
}
|
||||
|
||||
#endregion
|
||||
#pragma warning restore CA1416 // 验证平台兼容性
|
||||
|
||||
#region 将文件路径转为内存流
|
||||
|
||||
@@ -712,7 +714,8 @@ public class FileHelper
|
||||
|
||||
if (selectFiles.Count > 0)
|
||||
{
|
||||
return selectFiles.FirstOrDefault().FullName;
|
||||
//modified by PhilPan
|
||||
return selectFiles.First().FullName;
|
||||
}
|
||||
|
||||
return Path.Combine(folderPath, $@"{prefix}_{DateTime.Now.ParseToUnixTime()}.log");
|
||||
@@ -737,7 +740,7 @@ public class FileHelper
|
||||
Microsoft.AspNetCore.Http.HttpContext? httpContext = App.HttpContext;
|
||||
httpContext.Response.ContentType = "application/octet-stream";
|
||||
httpContext.Response.Headers.Add("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(fileName, Encoding.UTF8));
|
||||
httpContext.Response.Headers.Add("Content-Length", buff.Length.ToString());
|
||||
httpContext.Response.Headers.Add("Content-Length", buff?.Length.ToString());
|
||||
httpContext.Response.Body.WriteAsync(buff);
|
||||
httpContext.Response.Body.Flush();
|
||||
httpContext.Response.Body.Close();
|
||||
|
||||
@@ -46,7 +46,7 @@ public static class JsonHelper
|
||||
/// <returns></returns>
|
||||
public static T ToObject<T>(this string json)
|
||||
{
|
||||
return _ = _jsonSerializer.Deserialize<T>(json) ?? default(T);
|
||||
return _jsonSerializer.Deserialize<T>(json);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -58,7 +58,7 @@ public static class JsonHelper
|
||||
/// <returns></returns>
|
||||
public static T ToObject<T>(this string json, object jsonSerializerOptions = default)
|
||||
{
|
||||
return _ = _jsonSerializer.Deserialize<T>(json, jsonSerializerOptions) ?? default(T);
|
||||
return _jsonSerializer.Deserialize<T>(json, jsonSerializerOptions);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -69,7 +69,7 @@ public static class JsonHelper
|
||||
/// <returns></returns>
|
||||
public static T ToObject<T>(this object json)
|
||||
{
|
||||
return _ = ToJsonString(json).ToObject<T>() ?? default(T);
|
||||
return ToJsonString(json).ToObject<T>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -81,7 +81,7 @@ public static class JsonHelper
|
||||
/// <returns></returns>
|
||||
public static T ToObject<T>(this object json, object jsonSerializerOptions = default)
|
||||
{
|
||||
return _ = ToJsonString(json, jsonSerializerOptions).ToObject<T>(jsonSerializerOptions) ?? default(T);
|
||||
return ToJsonString(json, jsonSerializerOptions).ToObject<T>(jsonSerializerOptions);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -92,7 +92,7 @@ public static class JsonHelper
|
||||
/// <returns></returns>
|
||||
public static List<T> ToList<T>(this string json)
|
||||
{
|
||||
return _ = _jsonSerializer.Deserialize<List<T>>(json) ?? null;
|
||||
return _jsonSerializer.Deserialize<List<T>>(json);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -104,7 +104,7 @@ public static class JsonHelper
|
||||
/// <returns></returns>
|
||||
public static List<T> ToList<T>(this string json, object jsonSerializerOptions = default)
|
||||
{
|
||||
return _ = _jsonSerializer.Deserialize<List<T>>(json, jsonSerializerOptions) ?? null;
|
||||
return _jsonSerializer.Deserialize<List<T>>(json, jsonSerializerOptions);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -217,6 +217,7 @@ public static class MachineHelper
|
||||
}
|
||||
#endregion
|
||||
|
||||
#pragma warning disable CA1416 // 验证平台兼容性
|
||||
#region Windows
|
||||
|
||||
/// <summary>
|
||||
@@ -364,4 +365,6 @@ public static class MachineHelper
|
||||
}
|
||||
|
||||
#endregion
|
||||
#pragma warning restore CA1416 // 验证平台兼容性
|
||||
|
||||
}
|
||||
@@ -60,7 +60,7 @@ public class SuperQueryHelper
|
||||
{
|
||||
case JnpfKeyConst.COMINPUT:
|
||||
case JnpfKeyConst.TEXTAREA:
|
||||
item.fieldValue = item.fieldValue?.ToString().Replace("\r\n", string.Empty);
|
||||
item.fieldValue = item.fieldValue?.ToString()?.Replace("\r\n", string.Empty);
|
||||
switch (item.symbol)
|
||||
{
|
||||
case "==": // 等于
|
||||
@@ -549,8 +549,9 @@ public class SuperQueryHelper
|
||||
queryOr.mainWhere = true;
|
||||
queryList.Add(queryOr);
|
||||
}
|
||||
//modified by PhilPan
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
switch (item.symbol)
|
||||
{
|
||||
case ">=": // 大于等于
|
||||
|
||||
Reference in New Issue
Block a user