Class ValidatorFactory
- Namespace
- Core.CliniCore.Domain.Validation
- Assembly
- Core.CliniCore.dll
Factory for creating validators
public static class ValidatorFactory
- Inheritance
-
ValidatorFactory
- Inherited Members
Fields
BIRTHDATE_NULL_ERROR_STR
public const string BIRTHDATE_NULL_ERROR_STR = "Birth date is required"
Field Value
BIRTHDATE_SIZE_ERROR_STR
public static readonly string BIRTHDATE_SIZE_ERROR_STR
Field Value
EMAIL_ERROR_STR
public const string EMAIL_ERROR_STR = "Must be a valid email address"
Field Value
GRADDATE_SIZE_ERROR_STR
public static readonly string GRADDATE_SIZE_ERROR_STR
Field Value
LICENSE_ERROR_STR
public const string LICENSE_ERROR_STR = "License number must be 6-20 alphanumeric characters"
Field Value
MAX_GRAD_YEARS_ELAPSED
public const int MAX_GRAD_YEARS_ELAPSED = 75
Field Value
MAX_LICENSE_CHARS
public const int MAX_LICENSE_CHARS = 20
Field Value
MAX_NAME_CHARS
public const int MAX_NAME_CHARS = 100
Field Value
MAX_PATIENT_AGE
public const int MAX_PATIENT_AGE = 150
Field Value
MIN_LICENSE_CHARS
public const int MIN_LICENSE_CHARS = 6
Field Value
MIN_NAME_CHARS
public const int MIN_NAME_CHARS = 2
Field Value
PATIENT_NAME_NULL_ERROR_STR
public const string PATIENT_NAME_NULL_ERROR_STR = "Patient name is required"
Field Value
PATIENT_NAME_SIZE_ERROR_STR
public static readonly string PATIENT_NAME_SIZE_ERROR_STR
Field Value
PHYSICIAN_NAME_NULL_ERROR_STR
public const string PHYSICIAN_NAME_NULL_ERROR_STR = "Physician name is required"
Field Value
PHYSICIAN_NAME_SIZE_ERROR_STR
public static readonly string PHYSICIAN_NAME_SIZE_ERROR_STR
Field Value
Methods
BirthDate()
public static IValidator<DateTime> BirthDate()
Returns
Composite<T>(params IValidator<T>[])
public static IValidator<T> Composite<T>(params IValidator<T>[] validators)
Parameters
validatorsIValidator<T>[]
Returns
- IValidator<T>
Type Parameters
T
DateRange(DateTime?, DateTime?, string?)
public static IValidator<DateTime> DateRange(DateTime? minDate = null, DateTime? maxDate = null, string? errorMessage = null)
Parameters
Returns
Email()
public static IValidator<string> Email()
Returns
GraduationDate()
public static IValidator<DateTime> GraduationDate()
Returns
LicenseNumber()
public static IValidator<string> LicenseNumber()
Returns
List<T>(int?, int?, IValidator<T>?, string?)
public static IValidator<List<T>> List<T>(int? minCount = null, int? maxCount = null, IValidator<T>? itemValidator = null, string? errorMessage = null)
Parameters
minCountint?maxCountint?itemValidatorIValidator<T>errorMessagestring
Returns
- IValidator<List<T>>
Type Parameters
T
OneOf<T>(IEnumerable<T>, string?, bool)
Creates validator for a specific set of allowed values
public static IValidator<T> OneOf<T>(IEnumerable<T> validValues, string? errorMessage = null, bool allowNull = true)
Parameters
validValuesIEnumerable<T>errorMessagestringallowNullbool
Returns
- IValidator<T>
Type Parameters
T
OneOf<T>(string?, bool, params T[])
Creates validator for a specific set of allowed values (params overload)
public static IValidator<T> OneOf<T>(string? errorMessage = null, bool allowNull = true, params T[] validValues)
Parameters
Returns
- IValidator<T>
Type Parameters
T
PatientBirthDate()
public static IValidator<DateTime> PatientBirthDate()
Returns
PatientName()
public static IValidator<string> PatientName()
Returns
PhysicianName()
public static IValidator<string> PhysicianName()
Returns
Regex(string, string, RegexOptions)
public static IValidator<string> Regex(string pattern, string errorMessage, RegexOptions options = RegexOptions.None)
Parameters
patternstringerrorMessagestringoptionsRegexOptions
Returns
Required<T>(string?)
public static IValidator<T> Required<T>(string? errorMessage = null)
Parameters
errorMessagestring
Returns
- IValidator<T>
Type Parameters
T
StringLength(int?, int?, string?)
public static IValidator<string> StringLength(int? minLength = null, int? maxLength = null, string? errorMessage = null)
Parameters
Returns
UsernameUniqueness(ProfileService, string?)
public static IValidator<string> UsernameUniqueness(ProfileService profileRegistry, string? errorMessage = null)
Parameters
profileRegistryProfileServiceerrorMessagestring
Returns
ValidEnum<T>(string?)
Creates validator for nullable C# enum types
public static IValidator<T?> ValidEnum<T>(string? errorMessage = null) where T : struct, Enum
Parameters
errorMessagestring
Returns
- IValidator<T?>
Type Parameters
T
ValidEnum<T>(string?, bool)
Creates validator for actual C# enum types
public static IValidator<T> ValidEnum<T>(string? errorMessage = null, bool allowNull = true) where T : struct, Enum
Parameters
Returns
- IValidator<T>
Type Parameters
T