/// <summary> /// Creates a new <see cref="RouteConstraintAttribute"/>. /// </summary> /// <param name="routeKey">The route value key.</param> /// <param name="keyHandling"> /// The <see cref="RouteKeyHandling"/> value. Must be <see cref="RouteKeyHandling.CatchAll "/> /// or <see cref="RouteKeyHandling.DenyKey"/>. /// </param> protected RouteConstraintAttribute( [NotNull] string routeKey, RouteKeyHandling keyHandling) { RouteKey = routeKey; RouteKeyHandling = keyHandling; if (keyHandling != RouteKeyHandling.CatchAll && keyHandling != RouteKeyHandling.DenyKey) { var message = Resources.FormatRouteConstraintAttribute_InvalidKeyHandlingValue( Enum.GetName(typeof(RouteKeyHandling), RouteKeyHandling.CatchAll), Enum.GetName(typeof(RouteKeyHandling), RouteKeyHandling.DenyKey)); throw new ArgumentException(message, "keyHandling"); } }
/// <summary> /// Creates a new <see cref="RouteConstraintAttribute"/>. /// </summary> /// <param name="routeKey">The route value key.</param> /// <param name="keyHandling"> /// The <see cref="RouteKeyHandling"/> value. Must be <see cref="RouteKeyHandling.CatchAll "/> /// or <see cref="RouteKeyHandling.DenyKey"/>. /// </param> protected RouteConstraintAttribute( [NotNull] string routeKey, RouteKeyHandling keyHandling) { RouteKey = routeKey; RouteKeyHandling = keyHandling; if (keyHandling != RouteKeyHandling.CatchAll && keyHandling != RouteKeyHandling.DenyKey) { var message = Resources.FormatRouteConstraintAttribute_InvalidKeyHandlingValue( Enum.GetName(typeof(RouteKeyHandling), RouteKeyHandling.CatchAll), Enum.GetName(typeof(RouteKeyHandling), RouteKeyHandling.DenyKey)); throw new ArgumentException(message, nameof(keyHandling)); } }
public RouteDataActionConstraint(string routeKey, RouteKeyHandling keyHandling) : this(routeKey) { switch (keyHandling) { case RouteKeyHandling.AcceptAlways: case RouteKeyHandling.CatchAll: case RouteKeyHandling.DenyKey: case RouteKeyHandling.RequireKey: KeyHandling = keyHandling; break; default: #if NET45 throw new InvalidEnumArgumentException("keyHandling", (int)keyHandling, typeof (RouteKeyHandling)); #else throw new ArgumentOutOfRangeException("keyHandling"); #endif } }
public RouteDataActionConstraint(string routeKey, RouteKeyHandling keyHandling) : this(routeKey) { switch (keyHandling) { case RouteKeyHandling.CatchAll: case RouteKeyHandling.DenyKey: case RouteKeyHandling.RequireKey: KeyHandling = keyHandling; break; default: #if ASPNET50 throw new InvalidEnumArgumentException("keyHandling", (int)keyHandling, typeof(RouteKeyHandling)); #else throw new ArgumentOutOfRangeException("keyHandling"); #endif } }
public RouteParameterConstraintAttribute(string routeParameterName, RouteKeyHandling keyHandling) : base(routeParameterName, keyHandling) { }