1 write to ServiceKey
Microsoft.Extensions.DependencyInjection.Abstractions (1)
ServiceDescriptor.cs (1)
134
ServiceKey
= serviceKey;
127 references to ServiceKey
Aspire.Azure.AI.OpenAI (2)
AspireAzureOpenAIExtensions.cs (1)
61
/// <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)
53
/// <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)
51
/// <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)
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>
94
/// <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>
140
/// <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>
187
/// <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>
234
/// <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)
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.Azure.Messaging.WebPubSub (1)
AspireWebPubSubExtensions.cs (1)
50
/// <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.Npgsql (1)
AspireAzureNpgsqlExtensions.cs (1)
51
/// <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.Npgsql.EntityFrameworkCore.PostgreSQL (1)
src\Components\Common\EntityFrameworkUtils.cs (1)
77
oldDbContextOptionsDescriptor.
ServiceKey
,
Aspire.Azure.Search.Documents (1)
AspireAzureSearchExtensions.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.Azure.Security.KeyVault (1)
AspireKeyVaultExtensions.cs (1)
53
/// <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)
51
/// <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)
52
/// <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)
100
/// <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)
100
/// <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)
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.Hosting.Testing (1)
DistributedApplicationFactory.cs (1)
558
var hostDescriptor = applicationBuilder.Services.Single(s => s.ServiceType == typeof(IHost) && s.
ServiceKey
is null);
Aspire.Microsoft.Azure.Cosmos (3)
AspireMicrosoftAzureCosmosExtensions.cs (3)
83
/// <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>
109
/// <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>
170
/// <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)
77
oldDbContextOptionsDescriptor.
ServiceKey
,
Aspire.Microsoft.EntityFrameworkCore.SqlServer (1)
src\Components\Common\EntityFrameworkUtils.cs (1)
77
oldDbContextOptionsDescriptor.
ServiceKey
,
Aspire.MongoDB.Driver (1)
AspireMongoDBDriverExtensions.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.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)
104
/// <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)
77
oldDbContextOptionsDescriptor.
ServiceKey
,
Aspire.OpenAI (1)
AspireOpenAIExtensions.cs (1)
41
/// <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)
77
oldDbContextOptionsDescriptor.
ServiceKey
,
Aspire.Pomelo.EntityFrameworkCore.MySql (1)
src\Components\Common\EntityFrameworkUtils.cs (1)
77
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)
51
/// <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)
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>
Microsoft.AspNetCore.OpenApi.Tests (12)
Extensions\OpenApiServiceCollectionExtensionsTests.cs (12)
41
Assert.Contains(services, sd => sd.ServiceType == typeof(OpenApiSchemaService) && sd.Lifetime == ServiceLifetime.Singleton && (string)sd.
ServiceKey
== documentName);
42
Assert.Contains(services, sd => sd.ServiceType == typeof(OpenApiDocumentService) && sd.Lifetime == ServiceLifetime.Singleton && (string)sd.
ServiceKey
== documentName);
75
Assert.Contains(services, sd => sd.ServiceType == typeof(OpenApiSchemaService) && sd.Lifetime == ServiceLifetime.Singleton && (string)sd.
ServiceKey
== documentName);
76
Assert.Contains(services, sd => sd.ServiceType == typeof(OpenApiDocumentService) && sd.Lifetime == ServiceLifetime.Singleton && (string)sd.
ServiceKey
== documentName);
108
Assert.Contains(services, sd => sd.ServiceType == typeof(OpenApiSchemaService) && sd.Lifetime == ServiceLifetime.Singleton && (string)sd.
ServiceKey
== documentName);
109
Assert.Contains(services, sd => sd.ServiceType == typeof(OpenApiDocumentService) && sd.Lifetime == ServiceLifetime.Singleton && (string)sd.
ServiceKey
== documentName);
141
Assert.Contains(services, sd => sd.ServiceType == typeof(OpenApiSchemaService) && sd.Lifetime == ServiceLifetime.Singleton && (string)sd.
ServiceKey
== documentName);
142
Assert.Contains(services, sd => sd.ServiceType == typeof(OpenApiDocumentService) && sd.Lifetime == ServiceLifetime.Singleton && (string)sd.
ServiceKey
== documentName);
163
Assert.Contains(services, sd => sd.ServiceType == typeof(OpenApiSchemaService) && sd.Lifetime == ServiceLifetime.Singleton && (string)sd.
ServiceKey
== documentName);
164
Assert.Contains(services, sd => sd.ServiceType == typeof(OpenApiDocumentService) && sd.Lifetime == ServiceLifetime.Singleton && (string)sd.
ServiceKey
== documentName);
187
Assert.Contains(services, sd => sd.ServiceType == typeof(OpenApiSchemaService) && sd.Lifetime == ServiceLifetime.Singleton && (string)sd.
ServiceKey
== documentName);
188
Assert.Contains(services, sd => sd.ServiceType == typeof(OpenApiDocumentService) && sd.Lifetime == ServiceLifetime.Singleton && (string)sd.
ServiceKey
== documentName);
Microsoft.Extensions.AI.Tests (3)
ChatCompletion\DependencyInjectionPatterns.cs (2)
150
Assert.Equal("key", sd.
ServiceKey
);
219
Assert.Equal("key", sd.
ServiceKey
);
SpeechToText\SpeechToTextClientDependencyInjectionPatterns.cs (1)
150
Assert.Equal("key", sd.
ServiceKey
);
Microsoft.Extensions.DependencyInjection (4)
ServiceLookup\CallSiteFactory.cs (3)
322
if (KeysMatch(cacheKey.ServiceKey, _descriptors[i].
ServiceKey
))
335
if (KeysMatch(cacheKey.ServiceKey, _descriptors[i].
ServiceKey
))
418
callSite = new ConstantCallSite(descriptor.ServiceType, descriptor.GetImplementationInstance(), 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)
35
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
69
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
105
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
248
public bool IsKeyedService =>
ServiceKey
!= null;
257
lifetime += $"{nameof(
ServiceKey
)}: {
ServiceKey
} ";
309
if (
ServiceKey
== null)
374
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
407
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
449
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
485
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
518
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
551
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
581
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
620
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
656
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
689
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
722
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
756
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
798
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
834
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
871
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
907
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
944
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
994
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
1027
/// <param name="serviceKey">The <see cref="ServiceDescriptor.
ServiceKey
"/> of the service.</param>
1043
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
);