Skip to content

Instantly share code, notes, and snippets.

@chivandikwa
Created October 31, 2019 09:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chivandikwa/589b1dc340b0c9d4806cd3bc9416162d to your computer and use it in GitHub Desktop.
Save chivandikwa/589b1dc340b0c9d4806cd3bc9416162d to your computer and use it in GitHub Desktop.
FluentValidation abosolute uri validator rule builder
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