public static ValidationContext InitContext( ValidationContext context, object obj, PropertyDescriptor pd, ValidationContext.IsNullHandler isNull) { if (context == null) { context = new ValidationContext(); } context.Object = obj; context.IsNull = isNull ?? new ValidationContext.IsNullHandler(IsNullInternal); context.PropertyDescriptor = pd; return(context); }
public static void Validate(object obj, ValidationContext.IsNullHandler isNull) { Validate(InitContext(null, obj, null, isNull)); }
public static string[] GetErrorMessages(object obj, PropertyDescriptor pd, ValidationContext.IsNullHandler isNull) { return(GetErrorMessages(InitContext(null, obj, pd, isNull), pd.Name)); }
public static string[] GetErrorMessages( object obj, string fieldName, ValidationContext.IsNullHandler isNull) { return(GetErrorMessages(InitContext(null, obj, null, isNull), fieldName)); }
public static bool IsValid(object obj, PropertyDescriptor pd, ValidationContext.IsNullHandler isNull) { return(IsValid(InitContext(null, obj, pd, isNull), pd.Name)); }
public static bool IsValid(object obj, string fieldName, ValidationContext.IsNullHandler isNull) { return(IsValid(InitContext(null, obj, null, isNull), fieldName)); }