Hishop.Components.Validation/MetadataValidatedElement.cs
(开头部分) 5KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
namespace Hishop.Components.Validation
{
using Hishop.Components.Validation.Validators;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Threading;
internal class MetadataValidatedElement : IValidatedElement
{
private IgnoreNullsAttribute ignoreNullsAttribute;
private MemberInfo memberInfo;
private string ruleset;
private Type targetType;
private ValidatorCompositionAttribute validatorCompositionAttribute;
public MetadataValidatedElement(string ruleset)
{
this.ruleset = ruleset;
}
public MetadataValidatedElement(FieldInfo fieldInfo, string ruleset) : this(ruleset)
{
this.UpdateFlyweight(fieldInfo);
}
public MetadataValidatedElement(MethodInfo methodInfo, string ruleset) : this(ruleset)
{
this.UpdateFlyweight(methodInfo);
}
public MetadataValidatedElement(PropertyInfo propertyInfo, string ruleset) : this(ruleset)
{
this.UpdateFlyweight(propertyInfo);
}
public MetadataValidatedElement(Type type, string ruleset) : this(ruleset)
{
this.UpdateFlyweight(type);
}
IEnumerable<IValidatorDescriptor> IValidatedElement.GetValidatorDescriptors()
{
if (this.memberInfo != null)
{
foreach (ValidatorAttribute iteratorVariable0 in this.memberInfo.GetCustomAttributes(typeof(ValidatorAttribute), false))
{
if (this.ruleset.Equals(iteratorVariable0.Ruleset))
{
yield return iteratorVariable0;
}
}
}
}
public void UpdateFlyweight(FieldInfo fieldInfo)
{
后面还有 129 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
