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: - inlineConstraintResolver (Microsoft.AspNetCore.Routing.IInlineConstraintResolver) – The
Microsoft.AspNetCore.Routing.IInlineConstraintResolver
. - displayName (System.String) – The display name (for use in error messages).
public RouteConstraintBuilder(IInlineConstraintResolver inlineConstraintResolver, string displayName)
- inlineConstraintResolver (Microsoft.AspNetCore.Routing.IInlineConstraintResolver) – The
-
Methods¶
-
AddConstraint
(System.String, System.Object)¶ Adds a constraint instance for the given key.
Arguments: - key (System.String) – The key.
- value (System.Object) – The constraint instance. Must either be a string or an instance of
Microsoft.AspNetCore.Routing.IRouteConstraint
.
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: - key (System.String) – The key.
- constraintText (System.String) – The text to be resolved by
Microsoft.AspNetCore.Routing.IInlineConstraintResolver
.
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)
-