Skip to content
DocsTry Aspire
DocsTry

ReferenceExpression Methods

ClassMethods4 members
Represents an expression that might be made up of multiple resource properties. For example, a connection string might be made up of a host, port, and password from different endpoints.
Creates a new instance of ReferenceExpression with the specified format and value providers.
public class ReferenceExpression
{
public static ReferenceExpression Create(
in ExpressionInterpolatedStringHandler handler)
{
// ...
}
}
handlerExpressionInterpolatedStringHandlerThe handler that contains the format and value providers.
ReferenceExpressionA new instance of ReferenceExpression with the specified format and value providers.
CreateConditional(IValueProvider, string, ReferenceExpression, ReferenceExpression)Section titled CreateConditional(IValueProvider, string, ReferenceExpression, ReferenceExpression)staticReferenceExpression
Creates a conditional ReferenceExpression that selects between two branch expressions based on the string value of a condition.
public class ReferenceExpression
{
public static ReferenceExpression CreateConditional(
IValueProvider condition,
string matchValue,
ReferenceExpression whenTrue,
ReferenceExpression whenFalse)
{
// ...
}
}
conditionIValueProviderA value provider whose result is compared to matchValue to determine which branch to evaluate.
matchValuestringThe string value that condition is compared against. When the condition's value equals this (case-insensitive), the whenTrue branch is selected.
whenTrueReferenceExpressionThe expression to evaluate when the condition matches matchValue.
whenFalseReferenceExpressionThe expression to evaluate when the condition does not match matchValue.
GetValueAsync(ValueProviderContext, CancellationToken)Section titled GetValueAsync(ValueProviderContext, CancellationToken)ValueTask<string?>
Gets the value of the expression. The final string value after evaluating the format string and its parameters.
public class ReferenceExpression
{
public ValueTask<string?> GetValueAsync(
ValueProviderContext context,
CancellationToken cancellationToken)
{
// ...
}
}
contextValueProviderContextA context for resolving the value.
cancellationTokenCancellationTokenA Threading.CancellationToken.
GetValueAsync(CancellationToken)Section titled GetValueAsync(CancellationToken)ValueTask<string?>
Gets the value of the expression. The final string value after evaluating the format string and its parameters.
public class ReferenceExpression
{
public ValueTask<string?> GetValueAsync(
CancellationToken cancellationToken)
{
// ...
}
}
cancellationTokenCancellationTokenA Threading.CancellationToken.