1 write to ServiceKey
Microsoft.Extensions.DependencyInjection.Abstractions (1)
ServiceDescriptor.cs (1)
133
ServiceKey
= serviceKey;
120 references to ServiceKey
Aspire.Azure.AI.OpenAI (2)
AspireAzureOpenAIExtensions.cs (1)
55
/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.
ServiceKey
"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
AspireConfigurableOpenAIExtensions.cs (1)
56
/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.
ServiceKey
"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
Aspire.Azure.Data.Tables (1)
AspireTablesExtensions.cs (1)
48
/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.
ServiceKey
"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
Aspire.Azure.Messaging.EventHubs (5)
AspireEventHubsExtensions.cs (5)
45
/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.
ServiceKey
"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
87
/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.
ServiceKey
"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
129
/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.
ServiceKey
"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
172
/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.
ServiceKey
"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
215
/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.
ServiceKey
"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
Aspire.Azure.Messaging.ServiceBus (1)
AspireServiceBusExtensions.cs (1)
47
/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.
ServiceKey
"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
Aspire.Azure.Messaging.WebPubSub (1)
AspireWebPubSubExtensions.cs (1)
47
/// <param name="serviceKey">The name of the component, which is used as the <see cref="ServiceDescriptor.
ServiceKey
"/> of the service, as well as the hub name is hub name is not set in the settings</param>
Aspire.Azure.Search.Documents (1)
AspireAzureSearchExtensions.cs (1)
47
/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.
ServiceKey
"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
Aspire.Azure.Security.KeyVault (1)
AspireKeyVaultExtensions.cs (1)
50
/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.
ServiceKey
"/> of the service and also to retrieve the connection information from the ConnectionStrings configuration section.</param>
Aspire.Azure.Storage.Blobs (1)
AspireBlobStorageExtensions.cs (1)
48
/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.
ServiceKey
"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
Aspire.Azure.Storage.Queues (1)
AspireQueueStorageExtensions.cs (1)
49
/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.
ServiceKey
"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
Aspire.Confluent.Kafka (2)
AspireKafkaConsumerExtensions.cs (1)
93
/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.
ServiceKey
"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
AspireKafkaProducerExtensions.cs (1)
93
/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.
ServiceKey
"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
Aspire.Elastic.Clients.Elasticsearch (1)
AspireElasticClientsElasticsearchExtensions.cs (1)
46
/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.
ServiceKey
"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
Aspire.Hosting.Testing (1)
DistributedApplicationFactory.cs (1)
393
var hostDescriptor = applicationBuilder.Services.Single(s => s.ServiceType == typeof(IHost) && s.
ServiceKey
is null);
Aspire.Microsoft.Azure.Cosmos (1)
AspireMicrosoftAzureCosmosExtensions.cs (1)
44
/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.
ServiceKey
"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
Aspire.Microsoft.Data.SqlClient (1)
AspireSqlServerSqlClientExtensions.cs (1)
39
/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.
ServiceKey
"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
Aspire.Microsoft.EntityFrameworkCore.Cosmos (1)
src\Components\Common\EntityFrameworkUtils.cs (1)
68
oldDbContextOptionsDescriptor.
ServiceKey
,
Aspire.Microsoft.EntityFrameworkCore.SqlServer (1)
src\Components\Common\EntityFrameworkUtils.cs (1)
68
oldDbContextOptionsDescriptor.
ServiceKey
,
Aspire.MongoDB.Driver (1)
AspireMongoDBDriverExtensions.cs (1)
48
/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.
ServiceKey
"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
Aspire.MySqlConnector (1)
AspireMySqlConnectorExtensions.cs (1)
40
/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.
ServiceKey
"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
Aspire.NATS.Net (1)
AspireNatsClientExtensions.cs (1)
47
/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.
ServiceKey
"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
Aspire.Npgsql (1)
AspirePostgreSqlNpgsqlExtensions.cs (1)
40
/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.
ServiceKey
"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
Aspire.Npgsql.EntityFrameworkCore.PostgreSQL (1)
src\Components\Common\EntityFrameworkUtils.cs (1)
68
oldDbContextOptionsDescriptor.
ServiceKey
,
Aspire.OpenAI (1)
AspireOpenAIExtensions.cs (1)
45
/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.
ServiceKey
"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
Aspire.Oracle.EntityFrameworkCore (1)
src\Components\Common\EntityFrameworkUtils.cs (1)
68
oldDbContextOptionsDescriptor.
ServiceKey
,
Aspire.Pomelo.EntityFrameworkCore.MySql (1)
src\Components\Common\EntityFrameworkUtils.cs (1)
68
oldDbContextOptionsDescriptor.
ServiceKey
,
Aspire.RabbitMQ.Client (1)
AspireRabbitMQExtensions.cs (1)
50
/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.
ServiceKey
"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
Aspire.StackExchange.Redis (1)
AspireRedisExtensions.cs (1)
46
/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.
ServiceKey
"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
Aspire.StackExchange.Redis.DistributedCaching (1)
AspireRedisDistributedCacheExtensions.cs (1)
44
/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.
ServiceKey
"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
Aspire.StackExchange.Redis.OutputCaching (1)
AspireRedisOutputCacheExtensions.cs (1)
43
/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.
ServiceKey
"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
Microsoft.AspNetCore.OpenApi.Tests (12)
Extensions\OpenApiServiceCollectionExtensionsTests.cs (12)
38
Assert.Contains(services, sd => sd.ServiceType == typeof(OpenApiSchemaService) && sd.Lifetime == ServiceLifetime.Singleton && (string)sd.
ServiceKey
== documentName);
39
Assert.Contains(services, sd => sd.ServiceType == typeof(OpenApiDocumentService) && sd.Lifetime == ServiceLifetime.Singleton && (string)sd.
ServiceKey
== documentName);
72
Assert.Contains(services, sd => sd.ServiceType == typeof(OpenApiSchemaService) && sd.Lifetime == ServiceLifetime.Singleton && (string)sd.
ServiceKey
== documentName);
73
Assert.Contains(services, sd => sd.ServiceType == typeof(OpenApiDocumentService) && sd.Lifetime == ServiceLifetime.Singleton && (string)sd.
ServiceKey
== documentName);
105
Assert.Contains(services, sd => sd.ServiceType == typeof(OpenApiSchemaService) && sd.Lifetime == ServiceLifetime.Singleton && (string)sd.
ServiceKey
== documentName);
106
Assert.Contains(services, sd => sd.ServiceType == typeof(OpenApiDocumentService) && sd.Lifetime == ServiceLifetime.Singleton && (string)sd.
ServiceKey
== documentName);
138
Assert.Contains(services, sd => sd.ServiceType == typeof(OpenApiSchemaService) && sd.Lifetime == ServiceLifetime.Singleton && (string)sd.
ServiceKey
== documentName);
139
Assert.Contains(services, sd => sd.ServiceType == typeof(OpenApiDocumentService) && sd.Lifetime == ServiceLifetime.Singleton && (string)sd.
ServiceKey
== documentName);
160
Assert.Contains(services, sd => sd.ServiceType == typeof(OpenApiSchemaService) && sd.Lifetime == ServiceLifetime.Singleton && (string)sd.
ServiceKey
== documentName);
161
Assert.Contains(services, sd => sd.ServiceType == typeof(OpenApiDocumentService) && sd.Lifetime == ServiceLifetime.Singleton && (string)sd.
ServiceKey
== documentName);
184
Assert.Contains(services, sd => sd.ServiceType == typeof(OpenApiSchemaService) && sd.Lifetime == ServiceLifetime.Singleton && (string)sd.
ServiceKey
== documentName);
185
Assert.Contains(services, sd => sd.ServiceType == typeof(OpenApiDocumentService) && sd.Lifetime == ServiceLifetime.Singleton && (string)sd.
ServiceKey
== documentName);
Microsoft.Extensions.DependencyInjection (4)
ServiceLookup\CallSiteFactory.cs (3)
320
if (KeysMatch(_descriptors[i].
ServiceKey
, cacheKey.ServiceKey))
330
if (KeysMatch(_descriptors[i].
ServiceKey
, cacheKey.ServiceKey))
402
callSite.Key = descriptor.
ServiceKey
;
ServiceLookup\ServiceIdentifier.cs (1)
27
=> new ServiceIdentifier(serviceDescriptor.
ServiceKey
, serviceDescriptor.ServiceType);
Microsoft.Extensions.DependencyInjection.Abstractions (60)
Extensions\ServiceCollectionDescriptorExtensions.cs (7)
70
&& object.Equals(collection[i].
ServiceKey
, descriptor.
ServiceKey
))
477
object.Equals(service.
ServiceKey
, descriptor.
ServiceKey
))
535
if (collection[i].ServiceType == descriptor.ServiceType && object.Equals(collection[i].
ServiceKey
, descriptor.
ServiceKey
))
569
if (descriptor.ServiceType == serviceType && descriptor.
ServiceKey
== null)
Extensions\ServiceCollectionDescriptorExtensions.Keyed.cs (1)
404
if (descriptor.ServiceType == serviceType && object.Equals(descriptor.
ServiceKey
, serviceKey))
IKeyedServiceProvider.cs (1)
28
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
IServiceProviderIsKeyedService.cs (1)
19
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
ServiceCollectionServiceExtensions.Keyed.cs (23)
21
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
45
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
70
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
90
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
110
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
130
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
155
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
179
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
203
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
228
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
248
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
268
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
288
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
313
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
337
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
361
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
386
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
406
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
426
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
446
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
471
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
495
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
520
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
ServiceDescriptor.cs (27)
34
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
68
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
104
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
247
public bool IsKeyedService =>
ServiceKey
!= null;
256
lifetime += $"{nameof(
ServiceKey
)}: {
ServiceKey
} ";
288
if (
ServiceKey
== null)
353
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
386
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
428
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
464
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
497
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
530
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
560
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
599
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
635
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
668
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
701
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
735
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
777
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
813
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
850
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
886
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
923
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
973
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
1006
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
1022
debugText += $@", ServiceKey = ""{
ServiceKey
}""";
Microsoft.Extensions.DependencyInjection.AutoActivation (10)
AutoActivationExtensions.cs (4)
317
if (services.Any(d => d.ServiceType == descriptor.ServiceType && d.
ServiceKey
== descriptor.
ServiceKey
))
328
if (services.Any(d => d.ServiceType == descriptor.ServiceType && d.
ServiceKey
== descriptor.
ServiceKey
))
AutoActivationExtensions.Keyed.cs (6)
351
if (services.Any(d => d.ServiceType == descriptor.ServiceType && d.
ServiceKey
== descriptor.
ServiceKey
))
357
_ = services.ActivateKeyedSingleton<TService>(descriptor.
ServiceKey
);
362
if (services.Any(d => d.ServiceType == descriptor.ServiceType && d.
ServiceKey
== descriptor.
ServiceKey
))
368
_ = services.ActivateKeyedSingleton(descriptor.ServiceType, descriptor.
ServiceKey
);