public static TBuilder AddConstraint <TBuilder>(
     this TBuilder builder,
     IActionConstraintMetadata constraint)
     where TBuilder : IRouteBuilder <TBuilder>
 {
     return(builder.AddConstraint(sp => constraint));
 }
Ejemplo n.º 2
0
 private static void AddConstraint(IActionConstraintMetadata constraint, IList <SelectorModel> selectors)
 {
     for (var i = 0; i < selectors.Count; i++)
     {
         var selector = selectors[i];
         selector.ActionConstraints.Add(constraint);
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates a new <see cref="ActionConstraintItem"/>.
        /// </summary>
        /// <param name="metadata">The <see cref="IActionConstraintMetadata"/> instance.</param>
        public ActionConstraintItem(IActionConstraintMetadata metadata)
        {
            if (metadata == null)
            {
                throw new ArgumentNullException(nameof(metadata));
            }

            Metadata = metadata;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates a new <see cref="ActionConstraintItem"/>.
        /// </summary>
        /// <param name="metadata">The <see cref="IActionConstraintMetadata"/> instance.</param>
        public ActionConstraintItem(IActionConstraintMetadata metadata)
        {
            if (metadata == null)
            {
                throw new ArgumentNullException(nameof(metadata));
            }

            Metadata = metadata;
        }
Ejemplo n.º 5
0
 public ActionConstraintValues(IActionConstraintMetadata inner)
 {
     var constraint = inner as IActionConstraint;
     if (constraint != null)
     {
         IsConstraint = true;
         Order = constraint.Order;
     }
     if (inner is IActionConstraintFactory)
     {
         IsFactory = true;
     }
     ActionConstraintMetadataType = inner.GetType();
 }
Ejemplo n.º 6
0
        public ActionConstraintValues(IActionConstraintMetadata inner)
        {
            var constraint = inner as IActionConstraint;

            if (constraint != null)
            {
                IsConstraint = true;
                Order        = constraint.Order;
            }
            if (inner is IActionConstraintFactory)
            {
                IsFactory = true;
            }
            ActionConstraintMetadataType = inner.GetType();
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Creates a new <see cref="ActionConstraintItem"/>.
 /// </summary>
 /// <param name="metadata">The <see cref="IActionConstraintMetadata"/> instance.</param>
 public ActionConstraintItem([NotNull] IActionConstraintMetadata metadata)
 {
     Metadata = metadata;
 }
 public ITypedRouteDetails WithActionConstraint(IActionConstraintMetadata constraint)
 {
     return(this.WithActionConstraints(constraint));
 }