Created
October 31, 2019 09:10
-
-
Save chivandikwa/589b1dc340b0c9d4806cd3bc9416162d to your computer and use it in GitHub Desktop.
FluentValidation abosolute uri validator rule builder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using FluentValidation; | |
using System; | |
public static class ValidatorExtension | |
{ | |
public static IRuleBuilderOptions<T, Uri> IsAbsoluteUri<T>(this IRuleBuilder<T, Uri> ruleBuilder) => | |
ruleBuilder.Must(setting => setting != null && setting.IsAbsoluteUri) | |
.WithMessage("Setting must be an absolute URI"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment