Class PlaceholderExpression

Assembly: redb.Route.dll

A text with {{key}} / {{key:default}} placeholders, resolved through the route context's configuration
(IConfiguration, then the context's properties) the way an endpoint URI is. The value a route sets from
configuration: <setHeader name="x" value="{{ldap.user}}"/> in markup, new PlaceholderExpression("{{ldap.user}}")
in C#. Resolved once per route context and then reused; a key with no value and no default fails the exchange with
the same message an endpoint URI gives.

public sealed class PlaceholderExpression : Expression, IExpression

Inheritance

Object→Expression→PlaceholderExpression

Implements

Inherited Members

Properties

Text

The text as written, placeholders included.

public string Text { get; }

Methods

Evaluate<T>(IExchange)

Evaluates the expression and returns the result cast to T.

public override T Evaluate<T>(IExchange exchange)

Resolve(IRouteContext?)

The text with its placeholders resolved through context; without one, defaults only.

public string Resolve(IRouteContext? context)

SetValue(IExchange, object)

Sets a value in the exchange according to this expression's semantics.

public override void SetValue(IExchange exchange, object value)

ToTemplateString()

Serializes this expression to a ${...} template string suitable for URI parameters.

public override string ToTemplateString()

Constructors

PlaceholderExpression(string)

Creates the expression over text.