3 instantiations of ReferenceExpression
Aspire.Hosting (3)
1555 references to ReferenceExpression
Aspire.Hosting (176)
ApplicationModel\ReferenceExpression.cs (31)
18/// A <see cref="ReferenceExpression"/> operates in one of two modes:
37public static readonly ReferenceExpression Empty = Create(string.Empty, [], [], []);
43private readonly ReferenceExpression? _whenTrue;
44private readonly ReferenceExpression? _whenFalse;
60private ReferenceExpression(IValueProvider condition, string matchValue, ReferenceExpression whenTrue, ReferenceExpression whenFalse)
118public ReferenceExpression? WhenTrue => _whenTrue;
124public ReferenceExpression? WhenFalse => _whenFalse;
194var branch = string.Equals(conditionValue, _matchValue, StringComparison.OrdinalIgnoreCase) ? _whenTrue! : _whenFalse!;
230internal static ReferenceExpression Create(string format, IValueProvider[] valueProviders, string[] manifestExpressions, string?[] stringFormats)
236/// Creates a new instance of <see cref="ReferenceExpression"/> with the specified format and value providers.
239/// <returns>A new instance of <see cref="ReferenceExpression"/> with the specified format and value providers.</returns>
240public static ReferenceExpression Create(in ExpressionInterpolatedStringHandler handler)
246/// Creates a conditional <see cref="ReferenceExpression"/> that selects between two branch expressions
255/// <returns>A new conditional <see cref="ReferenceExpression"/>.</returns>
256public static ReferenceExpression CreateConditional(IValueProvider condition, string matchValue, ReferenceExpression whenTrue, ReferenceExpression whenFalse)
261private static string GenerateConditionalName(IValueProvider condition, string matchValue, ReferenceExpression whenTrue, ReferenceExpression whenFalse)
280private static string ComputeConditionalHash(IValueProvider condition, ReferenceExpression whenTrue, ReferenceExpression whenFalse, string matchValue)
387public void AppendFormatted(ReferenceExpression valueProvider, string format)
436internal readonly ReferenceExpression GetExpression() =>
482/// A builder for creating <see cref="ReferenceExpression"/> instances.
561public void AppendFormatted(ReferenceExpression valueProvider, string format)
616/// Builds the <see cref="ReferenceExpression"/>.
620public ReferenceExpression Build() =>
621ReferenceExpression.Create(_builder.ToString(), [.. _valueProviders], [.. _manifestExpressions], [.. _stringFormats]);
629/// <param name="builder">The builder that will be used to create the <see cref="ReferenceExpression"/>.</param>
670public void AppendFormatted(ReferenceExpression valueProvider, string format)
Dcp\ExecutableConfigurationResolver.cs (6)
71CertificateBundlePath = ReferenceExpression.Create($"{bundleOutputPath}"),
72CertificateDirectoriesPath = ReferenceExpression.Create($"{string.Join(Path.PathSeparator, directories)}"),
78CertificatePath = ReferenceExpression.Create($"{Path.Join(baseServerAuthOutputPath, $"{certificate.Thumbprint}.crt")}"),
79KeyPath = ReferenceExpression.Create($"{Path.Join(baseServerAuthOutputPath, $"{certificate.Thumbprint}.key")}"),
80CertificateWithKeyPath = ReferenceExpression.Create($"{Path.Join(baseServerAuthOutputPath, $"{certificate.Thumbprint}.pem")}"),
81PfxPath = ReferenceExpression.Create($"{Path.Join(baseServerAuthOutputPath, $"{certificate.Thumbprint}.pfx")}"),
ResourceBuilderExtensions.cs (18)
245typeof(ReferenceExpression),
261ReferenceExpression expression => builder.WithEnvironment(name, expression),
284public static IResourceBuilder<T> WithEnvironment<T>(this IResourceBuilder<T> builder, string name, in ReferenceExpression.ExpressionInterpolatedStringHandler value)
290var expression = value.GetExpression();
324public static IResourceBuilder<T> WithEnvironment<T>(this IResourceBuilder<T> builder, string name, ReferenceExpression value)
601public static IResourceBuilder<T> WithConnectionProperty<T>(this IResourceBuilder<T> builder, string name, ReferenceExpression value) where T : IResourceWithConnectionString
624return builder.WithAnnotation(new ConnectionPropertyAnnotation(name, ReferenceExpression.Create($"{value}")));
639[AspireUnion(typeof(string), typeof(ReferenceExpression))] object value) where T : IResourceWithConnectionString
648ReferenceExpression referenceExpression => builder.WithConnectionProperty(name, referenceExpression),
1169public static ReferenceExpression GetConnectionProperty(this IResourceWithConnectionString resource, string key)
1179return ReferenceExpression.Empty;
2073[AspireUnion(typeof(string), typeof(ReferenceExpression))] object url,
2083ReferenceExpression expression => builder.WithUrl(expression, displayText),
2102public static IResourceBuilder<T> WithUrl<T>(this IResourceBuilder<T> builder, in ReferenceExpression.ExpressionInterpolatedStringHandler url, string? displayText = null)
2107var expression = url.GetExpression();
2117/// <param name="url">A <see cref="ReferenceExpression"/> that will produce the URL.</param>
2125public static IResourceBuilder<T> WithUrl<T>(this IResourceBuilder<T> builder, ReferenceExpression url, string? displayText = null)
4500ReferenceExpression expression) where T : IResource
Aspire.Hosting.Azure (13)
Aspire.Hosting.Azure.AppConfiguration (3)
Aspire.Hosting.Azure.AppContainers (24)
Aspire.Hosting.Azure.ApplicationInsights (2)
Aspire.Hosting.Azure.AppService (24)
Aspire.Hosting.Azure.CognitiveServices (10)
Aspire.Hosting.Azure.ContainerRegistry (4)
Aspire.Hosting.Azure.CosmosDB (22)
Aspire.Hosting.Azure.EventHubs (18)
Aspire.Hosting.Azure.FrontDoor (5)
Aspire.Hosting.Azure.Functions (17)
Aspire.Hosting.Azure.KeyVault (11)
AzureKeyVaultResourceExtensions.cs (4)
267[AspireUnion(typeof(IResourceBuilder<ParameterResource>), typeof(ReferenceExpression))] object value,
278ReferenceExpression expression => builder.AddSecret(name, secretName, expression),
312public static IResourceBuilder<AzureKeyVaultSecretResource> AddSecret(this IResourceBuilder<AzureKeyVaultResource> builder, string name, ReferenceExpression value)
373public static IResourceBuilder<AzureKeyVaultSecretResource> AddSecret(this IResourceBuilder<AzureKeyVaultResource> builder, [ResourceName] string name, string secretName, ReferenceExpression value)
Aspire.Hosting.Azure.Kubernetes (6)
Aspire.Hosting.Azure.Kubernetes.Tests (9)
Aspire.Hosting.Azure.Kusto (11)
Aspire.Hosting.Azure.Kusto.Tests (2)
Aspire.Hosting.Azure.Network (15)
Aspire.Hosting.Azure.PostgreSQL (39)
Aspire.Hosting.Azure.Redis (26)
Aspire.Hosting.Azure.Sandboxes (14)
AzureSandboxContainerDeployment.cs (7)
1193when TryResolveEndpointReferenceValue(endpointReference, currentComputeEnvironment, out var endpointExpression):
1200when TryResolveEndpointReferenceValue(endpointReferenceExpression, currentComputeEnvironment, out var endpointExpression):
1206case ReferenceExpression referenceExpression:
1253ReferenceExpression expression)
1258var branch = string.Equals(condition, expression.MatchValue, StringComparison.OrdinalIgnoreCase)
1292internal static bool TryResolveEndpointReferenceValue(EndpointReference endpointReference, IComputeEnvironmentResource? currentComputeEnvironment, [NotNullWhen(true)] out ReferenceExpression? expression)
1297internal static bool TryResolveEndpointReferenceValue(EndpointReferenceExpression endpointReferenceExpression, IComputeEnvironmentResource? currentComputeEnvironment, [NotNullWhen(true)] out ReferenceExpression? expression)
Aspire.Hosting.Azure.Search (5)
Aspire.Hosting.Azure.ServiceBus (22)
Aspire.Hosting.Azure.SignalR (7)
Aspire.Hosting.Azure.Sql (26)
Aspire.Hosting.Azure.Storage (49)
Aspire.Hosting.Azure.Tests (104)
Aspire.Hosting.Azure.WebPubSub (14)
Aspire.Hosting.Blazor (2)
Aspire.Hosting.CodeGeneration.Go.Tests (3)
Aspire.Hosting.CodeGeneration.Java.Tests (3)
Aspire.Hosting.CodeGeneration.Python.Tests (3)
Aspire.Hosting.CodeGeneration.Rust.Tests (3)
Aspire.Hosting.CodeGeneration.TypeScript.Tests (3)
Aspire.Hosting.Containers.Tests (2)
Aspire.Hosting.Docker (9)
Aspire.Hosting.Docker.Tests (14)
DockerComposePublisherTests.cs (13)
34var cs = builder.AddConnectionString("cs", ReferenceExpression.Create($"Url={param0}, Secret={param1}"));
1178var conditional = ReferenceExpression.CreateConditional(
1181ReferenceExpression.Create($",ssl=true"),
1182ReferenceExpression.Empty);
1186var conditionalFalse = ReferenceExpression.CreateConditional(
1189ReferenceExpression.Create($",ssl=true"),
1190ReferenceExpression.Create($",ssl=false"));
1220var conditional = ReferenceExpression.CreateConditional(
1223ReferenceExpression.Create($",ssl=true"),
1224ReferenceExpression.Create($",ssl=false"));
Aspire.Hosting.EntityFrameworkCore.Tests (6)
Aspire.Hosting.Foundry (63)
Toolbox\FoundryToolboxBuilderExtensions.cs (6)
233return builder.WithMcpTool(name, ReferenceExpression.Create($"{endpointUri.AbsoluteUri}"), options);
260return builder.WithMcpTool(name, ReferenceExpression.Create($"{endpoint}"), options);
269/// pointing at a resource endpoint, or a <see cref="ReferenceExpression"/> for cases where the
279[AspireUnion(typeof(string), typeof(EndpointReference), typeof(ReferenceExpression))] object endpoint,
291ReferenceExpression endpointExpression => builder.WithMcpTool(name, endpointExpression, options),
372ReferenceExpression endpointExpression,
Aspire.Hosting.Foundry.Tests (11)
Aspire.Hosting.Garnet (7)
Aspire.Hosting.GitHub.Models (9)
Aspire.Hosting.Java (8)
Aspire.Hosting.Java.Tests (2)
Aspire.Hosting.JavaScript (5)
Aspire.Hosting.JavaScript.Tests (51)
AddViteAppTests.cs (37)
578CertificatePath = ReferenceExpression.Create($"cert.pem"),
579KeyPath = ReferenceExpression.Create($"key.pem"),
580CertificateWithKeyPath = ReferenceExpression.Create($"cert-with-key.pem"),
581PfxPath = ReferenceExpression.Create($"cert.pfx"),
600Assert.IsType<ReferenceExpression>(env["TLS_CONFIG_PFX"]);
638CertificatePath = ReferenceExpression.Create($"cert.pem"),
639KeyPath = ReferenceExpression.Create($"key.pem"),
640CertificateWithKeyPath = ReferenceExpression.Create($"cert-with-key.pem"),
641PfxPath = ReferenceExpression.Create($"cert.pfx"),
690CertificatePath = ReferenceExpression.Create($"cert.pem"),
691KeyPath = ReferenceExpression.Create($"key.pem"),
692CertificateWithKeyPath = ReferenceExpression.Create($"cert-with-key.pem"),
693PfxPath = ReferenceExpression.Create($"cert.pfx"),
736CertificatePath = ReferenceExpression.Create($"cert.pem"),
737KeyPath = ReferenceExpression.Create($"key.pem"),
738CertificateWithKeyPath = ReferenceExpression.Create($"cert-with-key.pem"),
739PfxPath = ReferenceExpression.Create($"cert.pfx"),
788CertificatePath = ReferenceExpression.Create($"cert.pem"),
789KeyPath = ReferenceExpression.Create($"key.pem"),
790CertificateWithKeyPath = ReferenceExpression.Create($"cert-with-key.pem"),
791PfxPath = ReferenceExpression.Create($"cert.pfx"),
847CertificatePath = ReferenceExpression.Create($"cert.pem"),
848KeyPath = ReferenceExpression.Create($"key.pem"),
849CertificateWithKeyPath = ReferenceExpression.Create($"cert-with-key.pem"),
850PfxPath = ReferenceExpression.Create($"cert.pfx"),
920CertificatePath = ReferenceExpression.Create($"cert.pem"),
921KeyPath = ReferenceExpression.Create($"key.pem"),
922CertificateWithKeyPath = ReferenceExpression.Create($"cert-with-key.pem"),
923PfxPath = ReferenceExpression.Create($"cert.pfx"),
1025CertificatePath = ReferenceExpression.Create($"cert.pem"),
1026KeyPath = ReferenceExpression.Create($"key.pem"),
1027CertificateWithKeyPath = ReferenceExpression.Create($"cert-with-key.pem"),
1028PfxPath = ReferenceExpression.Create($"cert.pfx"),
1116CertificatePath = ReferenceExpression.Create($"cert.pem"),
1117KeyPath = ReferenceExpression.Create($"key.pem"),
1118CertificateWithKeyPath = ReferenceExpression.Create($"cert-with-key.pem"),
1119PfxPath = ReferenceExpression.Create($"cert.pfx"),
Aspire.Hosting.Kafka (11)
Aspire.Hosting.Keycloak (3)
Aspire.Hosting.Kubernetes (110)
KubernetesEnvironmentResource.cs (17)
209internal sealed record TlsSecretRequest(ReferenceExpression SecretName, ReferenceExpression Hostname, IResource Owner);
401public ReferenceExpression GetHostAddressExpression(EndpointReference endpointReference)
405return ReferenceExpression.Create($"{resource.Name.ToServiceName()}");
593/// Resolves a <see cref="ReferenceExpression"/> at deploy time. Used by pipeline steps
598private static async Task<string> ResolveExpressionAtDeployTimeAsync(ReferenceExpression expression, CancellationToken cancellationToken)
611/// Resolves a <see cref="ReferenceExpression"/> for inclusion in a Kubernetes manifest
625private async Task<string> ResolveExpressionAsync(ReferenceExpression expression, string owningResourceName, CancellationToken cancellationToken)
709IEnumerable<ReferenceExpression> hostnames,
715foreach (var hostname in hostnames)
1293foreach (var host in gateway.Hostnames)
1308foreach (var host in ingress.Hostnames)
1338private static List<(KubernetesGatewayResource Gateway, ReferenceExpression SecretName)> CollectGatewaysNeedingFqdnDiscovery(
1342var results = new List<(KubernetesGatewayResource Gateway, ReferenceExpression SecretName)>();
1396List<(KubernetesGatewayResource Gateway, ReferenceExpression SecretName)> gatewaysNeedingDiscovery)
2171var seen = new HashSet<(ReferenceExpression SecretName, ReferenceExpression Hostname)>();
KubernetesResource.cs (7)
529ep, [kubernetesEnvironmentResource, kubernetesEnvironmentResource.OwningComputeEnvironment], out var crossExpr))
572epExpr, [kubernetesEnvironmentResource, kubernetesEnvironmentResource.OwningComputeEnvironment], out var crossExpr))
589if (value is ReferenceExpression expr)
604var branch = string.Equals(conditionStr, expr.MatchValue, StringComparison.OrdinalIgnoreCase)
643private async Task<object> BuildHelmConditional(KubernetesEnvironmentContext context, DistributedApplicationExecutionContext executionContext, ReferenceExpression expr, ParameterResource conditionParam, bool embedded)
692private void AllocateBranchParameters(ReferenceExpression branch)
858ReferenceExpression expr => expr.ValueProviders.Any(IsUnresolvedAtPublishTime),
Aspire.Hosting.Kubernetes.Tests (34)
KubernetesPublisherTests.cs (28)
31var cs = builder.AddConnectionString("cs", ReferenceExpression.Create($"Url={param0}, Secret={param1}"));
261var cs = builder.AddConnectionString("api-cs", ReferenceExpression.Create($"Url={param0}, Secret={param1}"));
262var csPlain = builder.AddConnectionString("api-cs2", ReferenceExpression.Create($"host.local:80"));
1126context.EnvironmentVariables["FIRST"] = ReferenceExpression.CreateConditional(
1129ReferenceExpression.Create($"enabled"),
1130ReferenceExpression.Create($"disabled"));
1131context.EnvironmentVariables["SECOND"] = ReferenceExpression.CreateConditional(
1134ReferenceExpression.Create($"enabled"),
1135ReferenceExpression.Create($"disabled"));
1248var conditional = ReferenceExpression.CreateConditional(
1251ReferenceExpression.Create($",ssl=true"),
1252ReferenceExpression.Empty);
1256var conditionalFalse = ReferenceExpression.CreateConditional(
1259ReferenceExpression.Create($",ssl=true"),
1260ReferenceExpression.Create($",ssl=false"));
1313context.EnvironmentVariables["OPTIONS"] = ReferenceExpression.CreateConditional(
1316ReferenceExpression.Create($"user={user};password={password}"),
1317ReferenceExpression.Create($"user={user};disabled"));
1363var conditional = ReferenceExpression.CreateConditional(
1366ReferenceExpression.Create($",ssl=true"),
1367ReferenceExpression.Create($",ssl=false"));
1428var conditional = ReferenceExpression.CreateConditional(
1431ReferenceExpression.Create($"{tlsSuffix.Resource}"),
1432ReferenceExpression.Create($",ssl=false"));
Aspire.Hosting.Milvus (14)
Aspire.Hosting.MongoDB (33)
Aspire.Hosting.MongoDB.Tests (6)
Aspire.Hosting.MySql (18)
Aspire.Hosting.Nats (10)
Aspire.Hosting.OpenAI (11)
Aspire.Hosting.Oracle (18)
Aspire.Hosting.Orleans.Tests (2)
Aspire.Hosting.PostgreSQL (21)
Aspire.Hosting.Qdrant (14)
Aspire.Hosting.RabbitMQ (9)
Aspire.Hosting.Radius (18)
Aspire.Hosting.Radius.Tests (2)
Aspire.Hosting.Redis (9)
Aspire.Hosting.Redis.Tests (5)
Aspire.Hosting.RemoteHost.Tests (55)
AtsMarshallerTests.cs (40)
761var reference = Assert.Single(dto.AddressPrefixReferences);
1229public List<ReferenceExpression> AddressPrefixReferences { get; init; } = [];
1238var whenTrue = ReferenceExpression.Create($",ssl=true");
1239var whenFalse = ReferenceExpression.Empty;
1240var conditional = ReferenceExpression.CreateConditional(condition, bool.TrueString, whenTrue, whenFalse);
1257var whenTrue = ReferenceExpression.Create($",ssl=true");
1258var whenFalse = ReferenceExpression.Empty;
1259var conditional = ReferenceExpression.CreateConditional(condition, bool.TrueString, whenTrue, whenFalse);
1277var whenTrue = ReferenceExpression.Create($",ssl=true");
1278var whenFalse = ReferenceExpression.Empty;
1279var conditional = ReferenceExpression.CreateConditional(condition, bool.TrueString, whenTrue, whenFalse);
1284var retrievedConditional = Assert.IsType<ReferenceExpression>(retrieved);
1296var whenTrue = ReferenceExpression.Create($",ssl=true");
1297var whenFalse = ReferenceExpression.Empty;
1298var conditional = ReferenceExpression.CreateConditional(condition, bool.TrueString, whenTrue, whenFalse);
1303var retrievedConditional = Assert.IsType<ReferenceExpression>(retrieved);
1356var result = marshaller.UnmarshalFromJson(json, typeof(ReferenceExpression), context);
1357var cre = Assert.IsType<ReferenceExpression>(result);
1397var result = marshaller.UnmarshalFromJson(json, typeof(ReferenceExpression), context);
1398var cre = Assert.IsType<ReferenceExpression>(result);
1439var result = marshaller.UnmarshalFromJson(json, typeof(ReferenceExpression), context);
1440var cre = Assert.IsType<ReferenceExpression>(result);
1479marshaller.UnmarshalFromJson(json, typeof(ReferenceExpression), context));
ReferenceExpressionRefTests.cs (6)
118var expr = exprRef.ToReferenceExpression(handles, "test/cap", "param");
143var expr = exprRef.ToReferenceExpression(handles, "test/cap", "param");
180var expr = exprRef.ToReferenceExpression(handles, "test/cap", "param");
203var expr = exprRef.ToReferenceExpression(handles, "test/cap", "param");
233public ReferenceExpression ToReferenceExpression(HandleRegistry handles, string capabilityId, string paramName)
255return (ReferenceExpression)exprRef!.ToReferenceExpression(handles, capabilityId, paramName);
Aspire.Hosting.Seq (7)
Aspire.Hosting.SqlServer (22)
Aspire.Hosting.Tests (230)
ComputeEnvironmentEndpointResolverTests.cs (8)
24endpoint.Property(EndpointProperty.Url), [currentEnv.Resource], out var expression);
45endpoint, [currentEnv.Resource], out var expression);
63endpoint.Property(EndpointProperty.Url), [currentEnv.Resource], out var expression);
82endpoint.Property(EndpointProperty.Url), [currentEnv.Resource], out var expression);
99endpoint.Property(EndpointProperty.Url), [currentEnv.Resource], out var expression);
122endpoint.Property(EndpointProperty.Url), [currentEnv.Resource], out var expression);
160public ReferenceExpression GetHostAddressExpression(EndpointReference endpointReference) =>
161ReferenceExpression.Create($"{endpointReference.Resource.Name}.example.com");
ConditionalReferenceExpressionTests.cs (35)
14var whenTrue = ReferenceExpression.Create($",ssl=true");
15var whenFalse = ReferenceExpression.Empty;
17var expr = ReferenceExpression.CreateConditional(condition, bool.TrueString, whenTrue, whenFalse);
27var whenTrue = ReferenceExpression.Create($",ssl=true");
28var whenFalse = ReferenceExpression.Empty;
30var expr = ReferenceExpression.CreateConditional(condition, bool.TrueString, whenTrue, whenFalse);
40var whenTrue = ReferenceExpression.Create($",ssl=true");
41var whenFalse = ReferenceExpression.Empty;
43var expr = ReferenceExpression.CreateConditional(condition, bool.TrueString, whenTrue, whenFalse);
53var whenTrue = ReferenceExpression.Create($",ssl=true");
54var whenFalse = ReferenceExpression.Empty;
56var conditional = ReferenceExpression.CreateConditional(condition, bool.TrueString, whenTrue, whenFalse);
61var expression = builder.Build();
82var whenTrue = ReferenceExpression.Create($",ssl=true");
83var whenFalse = ReferenceExpression.Empty;
85var expr = ReferenceExpression.CreateConditional(condition, bool.TrueString, whenTrue, whenFalse);
94var expr = ReferenceExpression.CreateConditional(new TestValueProvider(bool.TrueString), bool.TrueString, ReferenceExpression.Empty, ReferenceExpression.Empty);
ConnectionPropertiesExtensionsTests.cs (14)
16new KeyValuePair<string, ReferenceExpression>("Host", ReferenceExpression.Create($"resourceHost")),
17new KeyValuePair<string, ReferenceExpression>("Port", ReferenceExpression.Create($"8080")),
22new KeyValuePair<string, ReferenceExpression>("Port", ReferenceExpression.Create($"9090")),
23new KeyValuePair<string, ReferenceExpression>("Username", ReferenceExpression.Create($"user")),
39private sealed class TestResource(string name, IEnumerable<KeyValuePair<string, ReferenceExpression>> properties)
42private readonly IReadOnlyList<KeyValuePair<string, ReferenceExpression>> _properties = new List<KeyValuePair<string, ReferenceExpression>>(properties);
44public ReferenceExpression ConnectionStringExpression { get; } = ReferenceExpression.Create($"{name}.connectionString");
46IEnumerable<KeyValuePair<string, ReferenceExpression>> IResourceWithConnectionString.GetConnectionProperties() => _properties;
ExpressionResolverTests.cs (17)
326public ReferenceExpression ConnectionStringExpression =>
327ReferenceExpression.Create($"{PrimaryEndpoint.Property(EndpointProperty.Url)}");
344Dictionary<string, ReferenceExpression> Expressions { get; }
351{ "TwoFullEndpoints", ReferenceExpression.Create($"Test1={Endpoint1.Property(EndpointProperty.Scheme)}://{Endpoint1.Property(EndpointProperty.IPV4Host)}:{Endpoint1.Property(EndpointProperty.Port)}/;Test2={Endpoint2.Property(EndpointProperty.Scheme)}://{Endpoint2.Property(EndpointProperty.Host)}:{Endpoint2.Property(EndpointProperty.Port)}/;") },
352{ "Url", ReferenceExpression.Create($"Url={Endpoint1.Property(EndpointProperty.Url)};") },
353{ "Url2", ReferenceExpression.Create($"Url={Endpoint1};") },
354{ "OnlyHost", ReferenceExpression.Create($"Host={Endpoint1.Property(EndpointProperty.Host)};") },
355{ "OnlyPort", ReferenceExpression.Create($"Port={Endpoint1.Property(EndpointProperty.Port)};") },
356{ "HostAndPort", ReferenceExpression.Create($"HostPort={Endpoint1.Property(EndpointProperty.HostAndPort)}") },
357{ "PortBeforeHost", ReferenceExpression.Create($"Port={Endpoint1.Property(EndpointProperty.Port)};Host={Endpoint1.Property(EndpointProperty.Host)};") },
358{ "FullAndPartial", ReferenceExpression.Create($"Test1={Endpoint1.Property(EndpointProperty.Scheme)}://{Endpoint1.Property(EndpointProperty.IPV4Host)}:{Endpoint1.Property(EndpointProperty.Port)}/;Test2={Endpoint2.Property(EndpointProperty.Scheme)}://localhost:{Endpoint2.Property(EndpointProperty.Port)}/;") },
359{ "Empty", ReferenceExpression.Empty },
360{ "String", ReferenceExpression.Create($"String") },
361{ "SecretParameter", ReferenceExpression.Create("SecretParameter", [new ParameterResource("SecretParameter", _ => "SecretParameter", secret: true)], [], [null]) },
362{ "NonSecretParameter", ReferenceExpression.Create("NonSecretParameter", [new ParameterResource("NonSecretParameter", _ => "NonSecretParameter", secret: false)], [], [null]) },
363{ "UrlEncodedHost", ReferenceExpression.Create($"Host={Endpoint3.Property(EndpointProperty.Host):uri};") },
367public ReferenceExpression ConnectionStringExpression => Expressions[_exprName];
ReferenceExpressionTests.cs (52)
19var refExpression = ReferenceExpression.Create($"Hello {input}");
37var expr = ReferenceExpression.Create($"{input}").ValueExpression;
48var expr = ReferenceExpression.Create($"{input}", [new HostUrl("test")], parameters, []).ValueExpression;
62var expr = ReferenceExpression.Create($"{input}", [new HostUrl("test")], [parameterValue], []).ValueExpression;
70var expr = ReferenceExpression.Create($"{s}").ValueExpression;
79var expr = ReferenceExpression.Create($"[{{\"api_uri\":\"{v}\"}}]");
90var expr = ReferenceExpression.Create($"[{{{{\"api_uri\":\"{v}\"}}}}]");
101var expr = ReferenceExpression.Create($"Text: {v:uri}");
143var whenTrue = ReferenceExpression.Create($"prefix-{param1}-{param2}");
144var whenFalse = ReferenceExpression.Create($"fallback-{param3}");
146var conditional = ReferenceExpression.CreateConditional(condition, "True", whenTrue, whenFalse);
160var whenTrue = ReferenceExpression.Create($"literal-a");
161var whenFalse = ReferenceExpression.Create($"literal-b");
163var conditional = ReferenceExpression.CreateConditional(condition, "True", whenTrue, whenFalse);
176var whenTrue = ReferenceExpression.Create($"{param1}");
177var whenFalse = ReferenceExpression.Create($"{param2}");
179var conditional = ReferenceExpression.CreateConditional(condition, "True", whenTrue, whenFalse);
199var innerConditional = ReferenceExpression.CreateConditional(
201ReferenceExpression.Create($"{param1}"),
202ReferenceExpression.Create($"{param2}"));
205var outerConditional = ReferenceExpression.CreateConditional(
208ReferenceExpression.Create($"{param3}"));
227var innerConditional = ReferenceExpression.CreateConditional(
229ReferenceExpression.Create($"{param1}"),
230ReferenceExpression.Create($"{param2}"));
232var outerConditional = ReferenceExpression.CreateConditional(
235ReferenceExpression.Create($"{param3}"));
256var conditional1 = ReferenceExpression.CreateConditional(
258ReferenceExpression.Create($"{param1}"),
259ReferenceExpression.Create($"{param2}"));
261var conditional2 = ReferenceExpression.CreateConditional(
263ReferenceExpression.Create($"{param1}"),
264ReferenceExpression.Create($"{param2}"));
Aspire.Hosting.Valkey (7)
Aspire.Hosting.Yarp.Tests (2)
ParameterEndToEnd.AppHost (1)
TestingAppHost1.AppHost (1)