/// <summary> /// This method overload may be used if the QueryString of the URL that gets matched is not important /// </summary> public static IMatchRoutes ToRoute(this RouteBuilder source, Action ifMatched) { if (source == null) { throw new ArgumentNullException(nameof(source)); } if (ifMatched == null) { throw new ArgumentNullException("ifMatched"); } return(source.ToRoute(ifMatched: queryString => ifMatched())); }
public static RouteBuilder Fixed(this RouteBuilder source, string segment) { if (source == null) { throw new ArgumentNullException("source"); } if (string.IsNullOrWhiteSpace(segment)) { throw new ArgumentException("Null/blank/whitespace-only segment specified"); } return(source.Fixed(new NonBlankTrimmedString(segment))); }
public static RouteBuilder Fixed(this RouteBuilder source, params string[] segments) { if (source == null) { throw new ArgumentNullException("source"); } if (segments == null) { throw new ArgumentNullException("segments"); } var validatedSegments = NonNullList <NonBlankTrimmedString> .Empty; foreach (var segment in ((IEnumerable <string>)segments).Reverse()) { if (string.IsNullOrWhiteSpace(segment)) { throw new ArgumentException("Null/blank/whitespace-only value encountered within segments set"); } validatedSegments = validatedSegments.Insert(new NonBlankTrimmedString(segment)); } return(source.Fixed(validatedSegments)); }
public static RouteBuilder.IBuildRoutesWithVariablesToMatch <TValues> Int <TValues>(this RouteBuilder source, Func <int, TValues> valueExtender) { if (source == null) { throw new ArgumentNullException("source"); } if (valueExtender == null) { throw new ArgumentNullException("valueExtender"); } return(source.Variable(valueExtender, ParseInt)); }
public static RouteBuilder.IBuildRoutesWithVariablesToMatch <TValues> String <TValues>(this RouteBuilder source, Func <NonBlankTrimmedString, TValues> valueExtender) { if (source == null) { throw new ArgumentNullException("source"); } if (valueExtender == null) { throw new ArgumentNullException("valueExtender"); } return(source.Variable(valueExtender, parser: segment => Optional.For(segment))); }
public static RouteBuilder.IBuildRoutesWithVariablesToMatch <NonBlankTrimmedString> String(this RouteBuilder source) { if (source == null) { throw new ArgumentNullException("source"); } return(source.Variable(valueExtender: segment => segment, parser: segment => Optional.For(segment))); }