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