RouteConstraintBuilder Class

A builder for produding a mapping of keys to see Microsoft.AspNetCore.Routing.IRouteConstraint.

Namespace
Microsoft.AspNetCore.Routing
Assemblies
  • Microsoft.AspNetCore.Routing

Syntax

public class RouteConstraintBuilder
class Microsoft.AspNetCore.Routing.RouteConstraintBuilder

Constructors

RouteConstraintBuilder(Microsoft.AspNetCore.Routing.IInlineConstraintResolver, System.String)

Creates a new Microsoft.AspNetCore.Routing.RouteConstraintBuilder instance.

Arguments:
public RouteConstraintBuilder(IInlineConstraintResolver inlineConstraintResolver, string displayName)

Methods

AddConstraint(System.String, System.Object)

Adds a constraint instance for the given key.

Arguments:
public void AddConstraint(string key, object value)
AddResolvedConstraint(System.String, System.String)

Adds a constraint for the given key, resolved by the Microsoft.AspNetCore.Routing.IInlineConstraintResolver.

Arguments:
public void AddResolvedConstraint(string key, string constraintText)
Build()

Builds a mapping of constraints.

Return type:System.Collections.Generic.IDictionary<System.String>
Returns:An System.Collections.Generic.IDictionary`2 of the constraints.
public IDictionary<string, IRouteConstraint> Build()
SetOptional(System.String)

Sets the given key as optional.

Arguments:key (System.String) – The key.
public void SetOptional(string key)