public static IRuleBuilderOptions <T, string> OptionalUrl <T>(this IRuleBuilderInitial <T, string> propertyRule) { return(propertyRule .Length(0, UrlMaxLength) .Must(IsValidUrl) .When(x => !string.IsNullOrEmpty(x as string)) .WithMessage(InvalidUrlMessage)); }
public static IRuleBuilderOptions <T, string> OptionalSummary <T>(this IRuleBuilderInitial <T, string> propertyRule) { return(propertyRule .Length(0, SummaryMaxLength)); }
public static IRuleBuilderOptions <T, string> OptionalContent <T>(this IRuleBuilderInitial <T, string> propertyRule) { return(propertyRule .Length(0, ContentMaxLength)); }
public static IRuleBuilderOptions <T, string> OptionalDescription <T>(this IRuleBuilderInitial <T, string> propertyRule) { return(propertyRule .Length(0, DescriptionMaxLength)); }