2 implementations of Name
Aspire.Hosting (1)
ApplicationModel\Resource.cs (1)
17
public virtual string
Name
{ get; }
Aspire.Hosting.Tests (1)
DistributedApplicationBuilderTests.cs (1)
174
public string
Name
=> nameof(TestResource);
163 references to Name
Aspire.Hosting (60)
ApplicationModel\CustomResourceSnapshot.cs (1)
337
relationships.Add(new(resourceWithParent.Parent.
Name
, KnownRelationshipTypes.Parent));
ApplicationModel\EndpointReference.cs (3)
18
internal EndpointAnnotation EndpointAnnotation => GetEndpointAnnotation() ?? throw new InvalidOperationException($"The endpoint `{EndpointName}` is not defined for the resource `{Resource.
Name
}`.");
61
return $"{{{Resource.
Name
}.bindings.{EndpointName}.{prop}}}";
106
?? throw new InvalidOperationException($"The endpoint `{EndpointName}` is not allocated for the resource `{Resource.
Name
}`.");
ApplicationModel\ExpressionResolver.cs (2)
19
static string EndpointUniqueName(EndpointReference endpointReference) => $"{endpointReference.Resource.
Name
}/{endpointReference.EndpointName}";
68
(EndpointProperty.Host or EndpointProperty.IPV4Host, true, true) => target.
Name
,
ApplicationModel\IResourceWithConnectionString.cs (1)
19
string IManifestExpressionProvider.ValueExpression => $"{{{
Name
}.connectionString}}";
ApplicationModel\ResourceExtensions.cs (1)
362
return [resource.
Name
];
ApplicationModel\ResourceNotificationService.cs (19)
126
resourceLogger.LogInformation("Waiting for resource '{Name}' to enter the '{State}' state.", dependency.
Name
, KnownResourceStates.Running);
129
var resourceEvent = await WaitForResourceAsync(dependency.
Name
, re => IsContinuableState(re.Snapshot), cancellationToken: cancellationToken).ConfigureAwait(false);
136
dependency.
Name
139
throw new DistributedApplicationException($"Dependency resource '{dependency.
Name
}' failed to start.");
145
dependency.
Name
,
150
$"Resource '{dependency.
Name
}' has entered the '{snapshot.State.Text}' state prematurely."
158
resourceLogger.LogInformation("Waiting for resource '{Name}' to become healthy.", dependency.
Name
);
159
await WaitForResourceHealthyAsync(dependency.
Name
, cancellationToken).ConfigureAwait(false);
162
resourceLogger.LogInformation("Finished waiting for resource '{Name}'.", dependency.
Name
);
194
resourceLogger.LogInformation("Waiting for resource '{Name}' to complete.", dependency.
Name
);
197
var resourceEvent = await WaitForResourceAsync(dependency.
Name
, re => IsKnownTerminalState(re.Snapshot), cancellationToken: cancellationToken).ConfigureAwait(false);
204
dependency.
Name
207
throw new DistributedApplicationException($"Dependency resource '{dependency.
Name
}' failed to start.");
213
dependency.
Name
,
220
$"Resource '{dependency.
Name
}' has entered the '{snapshot.State.Text}' state with exit code '{snapshot.ExitCode}', expected '{exitCode}'."
224
resourceLogger.LogInformation("Finished waiting for resource '{Name}'.", dependency.
Name
);
366
_logger.LogDebug("Resource {Resource}/{ResourceId} changed state: {PreviousState} -> {NewState}", resource.
Name
, resourceId, previousStateText, newStateText);
371
_logger.LogDebug("Resource {Resource}/{ResourceId} changed state: {NewState}", resource.
Name
, resourceId, newStateText);
381
resource.
Name
, resourceId,
Dashboard\DashboardServiceData.cs (1)
44
DisplayName = resource.
Name
,
Dcp\ApplicationExecutor.cs (11)
1255
resourceLogger.LogError(ex, "Failed to create resource {ResourceName}", er.ModelResource.
Name
);
1266
resourceLogger.LogError(ex, "Failed to create resource {ResourceName}", resource.
Name
);
1423
logger.LogInformation("Waiting for value from resource '{ResourceName}'", resource.
Name
);
1427
logger.LogInformation("Waiting for value for environment variable value '{Name}' from resource '{ResourceName}'", key, resource.
Name
);
1476
ctr.Annotate(CustomResource.ResourceNameAnnotation, container.
Name
);
1477
ctr.Annotate(CustomResource.OtelServiceNameAnnotation, container.
Name
);
1504
Aliases = new List<string> { container.
Name
},
1521
throw new DistributedApplicationException($"Couldn't find required {nameof(DcpInstancesAnnotation)} annotation on resource {resource.
Name
}.");
1532
throw new DistributedApplicationException($"Couldn't find required instance ID for index {instanceIndex} on resource {resource.
Name
}.");
1570
logger.LogError(ex, "Failed to create container resource {ResourceName}", cr.ModelResource.
Name
);
1958
return maybeWithSuffix(resource.
Name
, suffix, _options.Value.ResourceNameSuffix);
Dcp\DcpNameGenerator.cs (1)
104
return maybeWithSuffix(resource.
Name
, suffix, options.ResourceNameSuffix);
DistributedApplicationBuilder.cs (4)
407
foreach (var duplicateResourceName in Resources.GroupBy(r => r.
Name
, StringComparers.ResourceName)
432
if (Resources.FirstOrDefault(r => string.Equals(r.
Name
, resource.
Name
, StringComparisons.ResourceName)) is { } existingResource)
434
throw new DistributedApplicationException($"Cannot add resource of type '{resource.GetType()}' with name '{resource.
Name
}' because resource of type '{existingResource.GetType()}' with that name already exists. Resource names are case-insensitive.");
ParameterResourceBuilderExtensions.cs (1)
257
var parameter = new ParameterResource(builder.Resource.
Name
, _ => "", secret: true);
Publishing\ManifestPublishingContext.cs (2)
126
Writer.WriteStartObject(resource.
Name
);
656
_referencedResources.TryAdd(resource.
Name
, resource);
ResourceBuilderExtensions.cs (11)
351
connectionName ??= resource.
Name
;
692
throw new DistributedApplicationException($"The '{builder.Resource.
Name
}' resource cannot wait for itself.");
697
throw new DistributedApplicationException($"The '{builder.Resource.
Name
}' resource cannot wait for its parent '{dependency.Resource.
Name
}'.");
747
throw new DistributedApplicationException($"The '{builder.Resource.
Name
}' resource cannot wait for itself.");
752
throw new DistributedApplicationException($"The '{builder.Resource.
Name
}' resource cannot wait for its parent '{dependency.Resource.
Name
}'.");
803
throw new DistributedApplicationException($"Resource '{builder.Resource.
Name
}' already has a health check with key '{key}'.");
864
throw new DistributedApplicationException($"The endpoint '{endpointName}' does not exist on the resource '{builder.Resource.
Name
}'.");
869
throw new DistributedApplicationException($"The endpoint '{endpointName}' on resource '{builder.Resource.
Name
}' was not using the '{desiredScheme}' scheme.");
883
var healthCheckKey = $"{builder.Resource.
Name
}_{endpointName}_{path}_{statusCode}_check";
Utils\ImageNameGenerator.cs (1)
17
return $"{builder.Resource.
Name
}-image-{hex}";
Utils\VolumeNameGenerator.cs (1)
33
var resourceName = builder.Resource.
Name
;
Aspire.Hosting.Azure (8)
AzureResourceExtensions.cs (1)
33
Infrastructure.NormalizeBicepIdentifier(resource.
Name
);
Provisioning\Provisioners\AzureProvisioner.cs (7)
132
s = s with { Properties = s.Properties.SetResourceProperty(KnownProperties.Resource.ParentName, resource.Resource.
Name
) };
298
resourceLogger.LogInformation("Skipping {resourceName} because it is not configured to be provisioned.", resource.AzureResource.
Name
);
303
resourceLogger.LogInformation("Using connection information stored in user secrets for {resourceName}.", resource.AzureResource.
Name
);
308
resourceLogger.LogInformation("Provisioning {resourceName}...", resource.AzureResource.
Name
);
334
resourceLogger.LogError(ex, "Error provisioning {ResourceName} because user secrets file is not well-formed JSON.", resource.AzureResource.
Name
);
339
resourceLogger.LogError(ex, "Error provisioning {ResourceName}.", resource.AzureResource.
Name
);
340
resource.AzureResource.ProvisioningTaskCompletionSource?.TrySetException(new InvalidOperationException($"Unable to resolve references from {resource.AzureResource.
Name
}"));
Aspire.Hosting.Azure.AppContainers (1)
AzureContainerAppsInfrastructure.cs (1)
85
var provisioningResource = new AzureProvisioningResource(resource.
Name
, context.BuildContainerApp);
Aspire.Hosting.Azure.EventHubs (2)
AzureEventHubsExtensions.cs (2)
157
context.EnvironmentVariables.Add("BLOB_SERVER", $"{blobEndpoint.Resource.
Name
}:{blobEndpoint.TargetPort}");
158
context.EnvironmentVariables.Add("METADATA_SERVER", $"{tableEndpoint.Resource.
Name
}:{tableEndpoint.TargetPort}");
Aspire.Hosting.Azure.Functions (1)
AzureFunctionsProjectResourceExtensions.cs (1)
209
connectionName ??= source.Resource.
Name
;
Aspire.Hosting.Azure.Tests (7)
AzureFunctionsTests.cs (2)
22
resource is AzureStorageResource && resource.
Name
.StartsWith(AzureFunctionsProjectResourceExtensions.DefaultAzureFunctionsHostStorageName));
25
resource is AzureFunctionsProjectResource && resource.
Name
== "funcapp");
AzurePostgresExtensionsTests.cs (2)
372
var postgresResourceInModel = builder.Resources.Single(r => r.
Name
== "postgres-data");
373
var dbResourceInModel = builder.Resources.Single(r => r.
Name
== "db1");
AzureRedisExtensionsTests.cs (1)
181
var cacheInModel = builder.Resources.Single(r => r.
Name
== "cache");
AzureSqlExtensionsTests.cs (2)
220
var sqlResourceInModel = builder.Resources.Single(r => r.
Name
== "sql");
221
var dbResourceInModel = builder.Resources.Single(r => r.
Name
== "db1");
Aspire.Hosting.Containers.Tests (4)
ContainerResourceTests.cs (3)
26
Assert.Equal("container", containerResource.
Name
);
45
Assert.Equal("container", containerResource.
Name
);
274
Assert.Equal("containerwithbindmounts", containerResource.
Name
);
src\Aspire.Hosting.Testing\ResourceLoggerForwarderService.cs (1)
66
var logger = loggerFactory.CreateLogger($"{applicationName}.Resources.{resource.
Name
}");
Aspire.Hosting.Dapr (6)
DaprDistributedApplicationLifecycleHook.cs (5)
94
else if (onDemandResourcesPaths.TryGetValue(componentReferenceAnnotation.Component.
Name
, out var onDemandResourcesPath))
116
var appId = sidecarOptions?.AppId ?? resource.
Name
;
149
var daprCliResourceName = $"{daprSidecar.
Name
}-cli";
238
context.Writer.WriteString("application", resource.
Name
);
249
context.Writer.TryWriteStringArray("components", componentReferenceAnnotations.Select(componentReferenceAnnotation => componentReferenceAnnotation.Component.
Name
));
IDistributedApplicationComponentBuilderExtensions.cs (1)
57
var sidecarBuilder = builder.ApplicationBuilder.AddResource(new DaprSidecarResource($"{builder.Resource.
Name
}-dapr"))
Aspire.Hosting.Kafka (2)
KafkaBuilderExtensions.cs (2)
143
? ReferenceExpression.Create($"{endpoint.Resource.
Name
}:{endpoint.Property(EndpointProperty.TargetPort)}")
146
context.EnvironmentVariables.Add($"KAFKA_CLUSTERS_{index}_NAME", endpoint.Resource.
Name
);
Aspire.Hosting.Kafka.Tests (1)
AddKafkaTests.cs (1)
174
var kafkaUiResource = Assert.Single(builder.Resources, r => r.
Name
== expectedContainerName);
Aspire.Hosting.Milvus.Tests (2)
AddMilvusTests.cs (2)
30
Assert.Equal("my-milvus", containerResource.
Name
);
61
Assert.Equal("my-milvus", containerResource.
Name
);
Aspire.Hosting.MySql (2)
MySqlBuilderExtensions.cs (2)
135
context.EnvironmentVariables.Add("PMA_HOST", $"{endpoint.Resource.
Name
}:{endpoint.TargetPort}");
158
writer.WriteLine($"$cfg['Servers'][$i]['host'] = '{endpoint.Resource.
Name
}:{endpoint.TargetPort}';");
Aspire.Hosting.MySql.Tests (4)
AddMySqlTests.cs (4)
87
Assert.Equal("mysql", containerResource.
Name
);
245
var myAdmin = builder.Resources.Single(r => r.
Name
.EndsWith("-phpmyadmin"));
260
var container = builder.Resources.Single(r => r.
Name
== "mySql-phpmyadmin");
278
var myAdmin = builder.Resources.Single(r => r.
Name
.EndsWith("-phpmyadmin"));
Aspire.Hosting.Oracle.Tests (3)
AddOracleTests.cs (3)
46
Assert.Equal("orcl", containerResource.
Name
);
86
Assert.Equal("orcl", containerResource.
Name
);
169
Assert.Equal("oracle", containerResource.
Name
);
Aspire.Hosting.Orleans (4)
OrleansServiceExtensions.cs (3)
131
=> WithGrainStorage(orleansServiceBuilder, provider.Resource.
Name
, provider);
183
=> WithStreaming(orleansServiceBuilder, provider.Resource.
Name
, provider);
299
=> WithGrainDirectory(orleansServiceBuilder, provider.Resource.
Name
, provider);
ProviderConfiguration.cs (1)
21
var serviceKey = resourceBuilder.Resource.
Name
;
Aspire.Hosting.PostgreSQL (1)
PostgresBuilderExtensions.cs (1)
189
writer.WriteString("Host", endpoint.Resource.
Name
);
Aspire.Hosting.PostgreSQL.Tests (8)
AddPostgresTests.cs (8)
56
Assert.Equal("myPostgres", containerResource.
Name
);
111
Assert.Equal("myPostgres", containerResource.
Name
);
203
Assert.Equal("postgres", containerResource.
Name
);
380
var container = builder.Resources.Single(r => r.
Name
== "mypostgres-pgadmin");
435
var container = builder.Resources.Single(r => r.
Name
== "mypostgres-pgadmin");
448
builder.Resources.Single(r => r.
Name
.EndsWith("-pgadmin"));
463
var pgadmin = builder.Resources.Single(r => r.
Name
.EndsWith("-pgadmin"));
510
var pgadmin = builder.Resources.Single(r => r.
Name
.EndsWith("-pgweb"));
Aspire.Hosting.Qdrant.Tests (3)
AddQdrantTests.cs (3)
49
Assert.Equal("my-qdrant", containerResource.
Name
);
88
Assert.Equal("my-qdrant", containerResource.
Name
);
122
Assert.Equal("my-qdrant", containerResource.
Name
);
Aspire.Hosting.Redis.Tests (2)
AddRedisTests.cs (2)
218
var commander = builder.Resources.Single(r => r.
Name
.EndsWith("-commander"));
242
var commander = builder.Resources.Single(r => r.
Name
.EndsWith("-commander"));
Aspire.Hosting.Testing (2)
DistributedApplicationHostingTestingExtensions.cs (1)
69
var resource = resources.SingleOrDefault(r => string.Equals(r.
Name
, resourceName, StringComparison.OrdinalIgnoreCase));
ResourceLoggerForwarderService.cs (1)
66
var logger = loggerFactory.CreateLogger($"{applicationName}.Resources.{resource.
Name
}");
Aspire.Hosting.Testing.Tests (4)
TestingBuilderTests.cs (1)
141
Assert.Contains(appModel.GetContainerResources(), c => c.
Name
== "redis1");
TestingFactoryTests.cs (1)
38
Assert.Contains(appModel.GetContainerResources(), c => c.
Name
== "redis1");
tests\Aspire.Hosting.Tests\Utils\LoggerNotificationExtensions.cs (2)
36
await rns.WaitForResourceHealthyAsync(resource.Resource.
Name
, cancellationToken);
125
if (resourceName != null && !string.Equals(resourceEvent.Resource.
Name
, resourceName, StringComparison.OrdinalIgnoreCase))
Aspire.Hosting.Tests (27)
Codespaces\CodespacesUrlRewriterTests.cs (1)
85
resource.Resource.
Name
,
Dashboard\DashboardLifecycleHookTests.cs (1)
92
var dashboardResource = model.Resources.Single(r => string.Equals(r.
Name
, KnownResourceNames.AspireDashboard, StringComparisons.ResourceName));
Dashboard\DashboardResourceTests.cs (5)
73
r => Assert.Equal("aspire-dashboard", r.
Name
),
74
r => Assert.Equal("my-container", r.
Name
)
313
var container = Assert.Single(model.Resources.Where(r => r.
Name
== "my-container"));
317
var dashboard = Assert.Single(model.Resources.Where(r => r.
Name
== "aspire-dashboard"));
355
var dashboard = Assert.Single(model.Resources.Where(r => r.
Name
== "aspire-dashboard"));
Health\ResourceHealthCheckServiceTests.cs (2)
112
await rns.WaitForResourceHealthyAsync(resource.Resource.
Name
, abortTokenSource.Token).DefaultTimeout();
159
await rns.WaitForResourceAsync(resource.Resource.
Name
, KnownResourceStates.Running, abortTokenSource.Token).DefaultTimeout();
src\Aspire.Hosting.Testing\ResourceLoggerForwarderService.cs (1)
66
var logger = loggerFactory.CreateLogger($"{applicationName}.Resources.{resource.
Name
}");
Utils\LoggerNotificationExtensions.cs (2)
36
await rns.WaitForResourceHealthyAsync(resource.Resource.
Name
, cancellationToken);
125
if (resourceName != null && !string.Equals(resourceEvent.Resource.
Name
, resourceName, StringComparison.OrdinalIgnoreCase))
Utils\ManifestUtils.cs (3)
35
var resourceNode = obj[resource.
Name
];
57
var resourceNode = obj[r.
Name
];
70
string manifestDir = Directory.CreateTempSubdirectory(resource.
Name
).FullName;
Utils\VolumeNameGeneratorTests.cs (2)
67
Assert.Equal($"{runVolumePrefix}-{runResource.Resource.
Name
}-data", runVolumeName);
68
Assert.Equal($"{publishVolumePrefix}-{publishResource.Resource.
Name
}-data", publishVolumeName);
WaitForTests.cs (10)
108
await rns.WaitForResourceAsync(nginx.Resource.
Name
, "Waiting", waitingStateCts.Token);
149
await rns.WaitForResourceAsync(nginx.Resource.
Name
, KnownResourceStates.Waiting, waitingStateCts.Token);
164
await rns.WaitForResourceAsync(nginx.Resource.
Name
, KnownResourceStates.Running, runningStateCts.Token);
197
await rns.WaitForResourceAsync(nginx.Resource.
Name
, "Waiting", waitingStateCts.Token);
212
await rns.WaitForResourceAsync(nginx.Resource.
Name
, KnownResourceStates.FailedToStart, runningStateCts.Token);
245
await rns.WaitForResourceAsync(nginx.Resource.
Name
, KnownResourceStates.Waiting, waitingStateCts.Token);
259
await rns.WaitForResourceAsync(nginx.Resource.
Name
, KnownResourceStates.FailedToStart, runningStateCts.Token);
294
await rns.WaitForResourceAsync(nginx.Resource.
Name
, "FailedToStart", waitingStateCts.Token);
328
await rns.WaitForResourceAsync(nginx.Resource.
Name
, KnownResourceStates.Waiting, waitingStateCts.Token);
336
await rns.WaitForResourceAsync(nginx.Resource.
Name
, KnownResourceStates.Running, waitingStateCts.Token);
Aspire.Playground.Tests (5)
Infrastructure\DistributedApplicationExtensions.cs (3)
105
return Task.WhenAll(applicationModel.Resources.Select(r => resourceNotificationService.WaitForResourceAsync(r.
Name
, targetStates, cancellationToken)));
133
var assertableResourceLogNames = applicationModel.Resources.Where(ShouldAssertErrorsForResource).Select(r => $"{environment.ApplicationName}.Resources.{r.
Name
}").ToList();
151
&& !resource.
Name
.EndsWith("-dapr-cli");
tests\Aspire.Hosting.Tests\Utils\LoggerNotificationExtensions.cs (2)
36
await rns.WaitForResourceHealthyAsync(resource.Resource.
Name
, cancellationToken);
125
if (resourceName != null && !string.Equals(resourceEvent.Resource.
Name
, resourceName, StringComparison.OrdinalIgnoreCase))
Stress.AppHost (3)
ResourceBuilderExtensions.cs (2)
45
?? throw new DistributedApplicationException($"Could not create HTTP command for resource '{builder.Resource.
Name
}' as no endpoint named '{endpointName}' was found.");
58
return new ExecuteCommandResult { Success = false, ErrorMessage = $"The endpoint named '{endpointName}' on resource '{builder.Resource.
Name
}' does not have the expected scheme of '{expectedScheme}'." };
TestResource.cs (1)
40
new(KnownProperties.Resource.ParentName, parent.
Name
)
TestProject.AppHost (1)
src\Aspire.Hosting.Testing\ResourceLoggerForwarderService.cs (1)
66
var logger = loggerFactory.CreateLogger($"{applicationName}.Resources.{resource.
Name
}");