😎修复字典验证特性错误
This commit is contained in:
parent
ff40fcd4ab
commit
3b7570ac39
@ -46,7 +46,7 @@
|
||||
<PackageReference Include="SSH.NET" Version="2024.2.0" />
|
||||
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.5.1" />
|
||||
<PackageReference Include="System.Net.Http" Version="4.3.4" />
|
||||
<PackageReference Include="TencentCloudSDK.Sms" Version="3.0.1143" />
|
||||
<PackageReference Include="TencentCloudSDK.Sms" Version="3.0.1144" />
|
||||
<PackageReference Include="UAParser" Version="3.1.47" />
|
||||
<PackageReference Include="Yitter.IdGenerator" Version="1.0.14" />
|
||||
</ItemGroup>
|
||||
|
||||
@ -63,7 +63,7 @@ public class DictAttribute : ValidationAttribute, ITransient
|
||||
type = type != null ? Nullable.GetUnderlyingType(type) ?? type : null;
|
||||
|
||||
// 使用HashSet来提高查找效率
|
||||
var valueList = (type?.IsEnum ?? DictTypeCode.EndsWith("Enum")) ? dictDataList.Select(u => u.Name) : dictDataList.Select(u => u.Value);
|
||||
var valueList = (type?.IsEnum ?? DictTypeCode.EndsWith("Enum")) ? dictDataList.Select(u => u.Code) : dictDataList.Select(u => u.Value);
|
||||
var dictHash = new HashSet<string>(valueList);
|
||||
|
||||
if (!dictHash.Contains(valueAsString))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user