Validation/ValidatorFluent.cs
(开头部分) 16KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;
using System.Text.RegularExpressions;
namespace ComLib.ValidationSupport
{
/// <summary>
/// This class implements a fluent-style validator.
/// </summary>
public class ValidatorFluent
{
private object _target;
private string _objectName;
private bool _appendObjectNameToError;
private string _propertyName;
private bool _checkCondition;
private IValidationResults _errors;
private int _initialErrorCount;
/// <summary>
/// Default constructor.
/// </summary>
/// <param name="typeToCheck">Type to check.</param>
public ValidatorFluent(Type typeToCheck) : this(typeToCheck, false, null)
{
}
/// <summary>
/// Creates a new instance of this class.
/// </summary>
/// <param name="typeToCheck">Type to check.</param>
/// <param name="errors">Validation results.</param>
public ValidatorFluent(Type typeToCheck, IValidationResults errors)
: this(typeToCheck, false, errors)
{
}
/// <summary>
/// Creates a new instance of this class.
/// </summary>
/// <param name="typeToCheck">Type to check.</param>
/// <param name="appendTypeToError">True to append the type to an error.</param>
/// <param name="errors">Validation results.</param>
public ValidatorFluent(Type typeToCheck, bool appendTypeToError, IValidationResults errors)
{
_objectName = typeToCheck.Name;
_appendObjectNameToError = appendTypeToError;
_errors = errors == null ? new ValidationResults() : errors;
_initialErrorCount = _errors.Count;
}
/// <summary>
后面还有 458 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
