152 references to Singleton
Aspire.Azure.AI.OpenAI.Tests (1)
ConformanceTests.cs (1)
19protected override ServiceLifetime ServiceLifetime => ServiceLifetime.Singleton;
Aspire.Azure.Data.Tables.Tests (1)
ConformanceTests.cs (1)
23protected override ServiceLifetime ServiceLifetime => ServiceLifetime.Singleton;
Aspire.Azure.Messaging.ServiceBus.Tests (1)
ConformanceTests.cs (1)
20protected override ServiceLifetime ServiceLifetime => ServiceLifetime.Singleton;
Aspire.Azure.Messaging.WebPubSub.Tests (1)
ConformanceTests.cs (1)
20protected override ServiceLifetime ServiceLifetime => ServiceLifetime.Singleton;
Aspire.Azure.Search.Documents.Tests (1)
ConformanceTests.cs (1)
19protected override ServiceLifetime ServiceLifetime => ServiceLifetime.Singleton;
Aspire.Azure.Security.KeyVault.Tests (1)
ConformanceTests.cs (1)
22protected override ServiceLifetime ServiceLifetime => ServiceLifetime.Singleton;
Aspire.Azure.Storage.Blobs.Tests (1)
ConformanceTests.cs (1)
23protected override ServiceLifetime ServiceLifetime => ServiceLifetime.Singleton;
Aspire.Azure.Storage.Queues.Tests (1)
ConformanceTests.cs (1)
23protected override ServiceLifetime ServiceLifetime => ServiceLifetime.Singleton;
Aspire.Components.Common.Tests (1)
ConformanceTests.cs (1)
196case ServiceLifetime.Singleton:
Aspire.Confluent.Kafka.Tests (2)
ConsumerConformanceTests.cs (1)
14protected override ServiceLifetime ServiceLifetime => ServiceLifetime.Singleton;
ProducerConformanceTests.cs (1)
15protected override ServiceLifetime ServiceLifetime => ServiceLifetime.Singleton;
Aspire.Elastic.Clients.Elasticsearch.Tests (1)
ConformanceTests.cs (1)
19protected override ServiceLifetime ServiceLifetime => ServiceLifetime.Singleton;
Aspire.Hosting.Testing.Tests (1)
ResourceLoggerForwarderServiceTests.cs (1)
26&& sd.Lifetime == ServiceLifetime.Singleton);
Aspire.Microsoft.Azure.Cosmos.Tests (1)
ConformanceTests.cs (1)
15protected override ServiceLifetime ServiceLifetime => ServiceLifetime.Singleton;
Aspire.Microsoft.EntityFrameworkCore.Cosmos.Tests (3)
ConformanceTests.cs (1)
17protected override ServiceLifetime ServiceLifetime => ServiceLifetime.Singleton;
EnrichCosmosDbTests.cs (2)
109}, contextLifetime: ServiceLifetime.Singleton); 115Assert.Equal(ServiceLifetime.Singleton, optionsDescriptor.Lifetime);
Aspire.Microsoft.EntityFrameworkCore.SqlServer.Tests (3)
ConformanceTests.cs (1)
22protected override ServiceLifetime ServiceLifetime => ServiceLifetime.Singleton;
EnrichSqlServerTests.cs (2)
250}, contextLifetime: ServiceLifetime.Singleton); 256Assert.Equal(ServiceLifetime.Singleton, optionsDescriptor.Lifetime);
Aspire.Milvus.Client.Tests (1)
ConformanceTests.cs (1)
32protected override ServiceLifetime ServiceLifetime => ServiceLifetime.Singleton;
Aspire.MongoDB.Driver.Tests (1)
ConformanceTests.cs (1)
18protected override ServiceLifetime ServiceLifetime => ServiceLifetime.Singleton;
Aspire.MySqlConnector.Tests (1)
ConformanceTests.cs (1)
20protected override ServiceLifetime ServiceLifetime => ServiceLifetime.Singleton;
Aspire.NATS.Net.Tests (1)
ConformanceTests.cs (1)
27protected override ServiceLifetime ServiceLifetime => ServiceLifetime.Singleton;
Aspire.Npgsql.EntityFrameworkCore.PostgreSQL.Tests (3)
ConformanceTests.cs (1)
21protected override ServiceLifetime ServiceLifetime => ServiceLifetime.Singleton;
EnrichNpgsqlTests.cs (2)
259}, contextLifetime: ServiceLifetime.Singleton); 265Assert.Equal(ServiceLifetime.Singleton, optionsDescriptor.Lifetime);
Aspire.Npgsql.Tests (1)
ConformanceTests.cs (1)
20protected override ServiceLifetime ServiceLifetime => ServiceLifetime.Singleton;
Aspire.OpenAI.Tests (1)
ConformanceTests.cs (1)
18protected override ServiceLifetime ServiceLifetime => ServiceLifetime.Singleton;
Aspire.Oracle.EntityFrameworkCore.Tests (3)
ConformanceTests.cs (1)
27protected override ServiceLifetime ServiceLifetime => ServiceLifetime.Singleton;
EnrichOracleDatabaseTests.cs (2)
251}, contextLifetime: ServiceLifetime.Singleton); 257Assert.Equal(ServiceLifetime.Singleton, optionsDescriptor.Lifetime);
Aspire.Pomelo.EntityFrameworkCore.MySql.Tests (3)
ConformanceTests.cs (1)
23protected override ServiceLifetime ServiceLifetime => ServiceLifetime.Singleton;
EnrichMySqlTests.cs (2)
264}, contextLifetime: ServiceLifetime.Singleton); 270Assert.Equal(ServiceLifetime.Singleton, optionsDescriptor.Lifetime);
Aspire.Qdrant.Client.Tests (1)
ConformanceTests.cs (1)
26protected override ServiceLifetime ServiceLifetime => ServiceLifetime.Singleton;
Aspire.RabbitMQ.Client.Tests (1)
ConformanceTests.cs (1)
24protected override ServiceLifetime ServiceLifetime => ServiceLifetime.Singleton;
Aspire.StackExchange.Redis.Tests (1)
ConformanceTests.cs (1)
20protected override ServiceLifetime ServiceLifetime => ServiceLifetime.Singleton;
Microsoft.AspNetCore.AsyncState.Tests (2)
AsyncStateHttpContextExtensionsTests.cs (2)
29Assert.Equal(ServiceLifetime.Singleton, serviceDescriptor.Lifetime); 32Assert.Equal(ServiceLifetime.Singleton, serviceDescriptor.Lifetime);
Microsoft.AspNetCore.DataProtection (2)
DataProtectionBuilderExtensions.cs (2)
81/// Registrations are additive. The factory is registered as <see cref="ServiceLifetime.Singleton"/>. 107/// Registrations are additive. The factory is registered as <see cref="ServiceLifetime.Singleton"/>.
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore (1)
DatabaseDeveloperPageExceptionFilterServiceExtensions.cs (1)
30services.TryAddEnumerable(new ServiceDescriptor(typeof(IDeveloperPageExceptionFilter), typeof(DatabaseDeveloperPageExceptionFilter), ServiceLifetime.Singleton));
Microsoft.AspNetCore.Http.Tests (1)
HttpServiceCollectionExtensionsTests.cs (1)
21Assert.Equal(ServiceLifetime.Singleton, descriptor.Lifetime);
Microsoft.AspNetCore.Mvc.Localization.Test (5)
MvcLocalizationMvcBuilderExtensionsTest.cs (3)
49Assert.Equal(ServiceLifetime.Singleton, service.Lifetime); 67Assert.Equal(ServiceLifetime.Singleton, service.Lifetime); 72Assert.Equal(ServiceLifetime.Singleton, service.Lifetime);
MvcLocalizationMvcCoreBuilderExtensionsTest.cs (2)
49Assert.Equal(ServiceLifetime.Singleton, service.Lifetime); 72Assert.Equal(ServiceLifetime.Singleton, service.Lifetime);
Microsoft.AspNetCore.Mvc.Test (3)
MvcServiceCollectionExtensionsTest.cs (3)
311Assert.Equal(ServiceLifetime.Singleton, descriptor.Lifetime); 339Assert.Equal(ServiceLifetime.Singleton, descriptor.Lifetime); 365Assert.Equal(ServiceLifetime.Singleton, descriptor.Lifetime);
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (1)
DependencyInjection\MvcViewFeaturesMvcBuilderExtensionsTest.cs (1)
155Assert.Equal(ServiceLifetime.Singleton, collection[2].Lifetime);
Microsoft.AspNetCore.OpenApi.Tests (18)
Extensions\OpenApiServiceCollectionExtensionsTests.cs (18)
38Assert.Contains(services, sd => sd.ServiceType == typeof(OpenApiSchemaService) && sd.Lifetime == ServiceLifetime.Singleton && (string)sd.ServiceKey == documentName); 39Assert.Contains(services, sd => sd.ServiceType == typeof(OpenApiDocumentService) && sd.Lifetime == ServiceLifetime.Singleton && (string)sd.ServiceKey == documentName); 40Assert.Contains(services, sd => sd.ServiceType == typeof(IDocumentProvider) && sd.Lifetime == ServiceLifetime.Singleton); 72Assert.Contains(services, sd => sd.ServiceType == typeof(OpenApiSchemaService) && sd.Lifetime == ServiceLifetime.Singleton && (string)sd.ServiceKey == documentName); 73Assert.Contains(services, sd => sd.ServiceType == typeof(OpenApiDocumentService) && sd.Lifetime == ServiceLifetime.Singleton && (string)sd.ServiceKey == documentName); 74Assert.Contains(services, sd => sd.ServiceType == typeof(IDocumentProvider) && sd.Lifetime == ServiceLifetime.Singleton); 105Assert.Contains(services, sd => sd.ServiceType == typeof(OpenApiSchemaService) && sd.Lifetime == ServiceLifetime.Singleton && (string)sd.ServiceKey == documentName); 106Assert.Contains(services, sd => sd.ServiceType == typeof(OpenApiDocumentService) && sd.Lifetime == ServiceLifetime.Singleton && (string)sd.ServiceKey == documentName); 107Assert.Contains(services, sd => sd.ServiceType == typeof(IDocumentProvider) && sd.Lifetime == ServiceLifetime.Singleton); 138Assert.Contains(services, sd => sd.ServiceType == typeof(OpenApiSchemaService) && sd.Lifetime == ServiceLifetime.Singleton && (string)sd.ServiceKey == documentName); 139Assert.Contains(services, sd => sd.ServiceType == typeof(OpenApiDocumentService) && sd.Lifetime == ServiceLifetime.Singleton && (string)sd.ServiceKey == documentName); 140Assert.Contains(services, sd => sd.ServiceType == typeof(IDocumentProvider) && sd.Lifetime == ServiceLifetime.Singleton); 160Assert.Contains(services, sd => sd.ServiceType == typeof(OpenApiSchemaService) && sd.Lifetime == ServiceLifetime.Singleton && (string)sd.ServiceKey == documentName); 161Assert.Contains(services, sd => sd.ServiceType == typeof(OpenApiDocumentService) && sd.Lifetime == ServiceLifetime.Singleton && (string)sd.ServiceKey == documentName); 162Assert.Contains(services, sd => sd.ServiceType == typeof(IDocumentProvider) && sd.Lifetime == ServiceLifetime.Singleton); 184Assert.Contains(services, sd => sd.ServiceType == typeof(OpenApiSchemaService) && sd.Lifetime == ServiceLifetime.Singleton && (string)sd.ServiceKey == documentName); 185Assert.Contains(services, sd => sd.ServiceType == typeof(OpenApiDocumentService) && sd.Lifetime == ServiceLifetime.Singleton && (string)sd.ServiceKey == documentName); 186Assert.Contains(services, sd => sd.ServiceType == typeof(IDocumentProvider) && sd.Lifetime == ServiceLifetime.Singleton);
Microsoft.DotNet.Internal.DependencyInjection.Testing (2)
DependencyInjectionValidation.cs (2)
78if (!IsTypeResolvable(scopedType, services, allErrors, ServiceLifetime.Singleton)) 148if (serviceLifetime == ServiceLifetime.Singleton &&
Microsoft.Extensions.AsyncState.Tests (3)
AsyncContextServiceCollectionExtensionsTests.cs (3)
30Assert.Equal(ServiceLifetime.Singleton, serviceDescriptor.Lifetime); 33Assert.Equal(ServiceLifetime.Singleton, serviceDescriptor.Lifetime); 36Assert.Equal(ServiceLifetime.Singleton, serviceDescriptor.Lifetime);
Microsoft.Extensions.Caching.SqlServer.Tests (1)
SqlServerCacheServicesExtensionsTest.cs (1)
27Assert.Equal(ServiceLifetime.Singleton, serviceDescriptor.Lifetime);
Microsoft.Extensions.Caching.StackExchangeRedis.Tests (1)
CacheServiceExtensionsTests.cs (1)
29Assert.Equal(ServiceLifetime.Singleton, distributedCache.Lifetime);
Microsoft.Extensions.DependencyInjection (3)
DependencyInjectionEventSource.cs (1)
198case ServiceLifetime.Singleton:
ServiceLookup\CallSiteValidator.cs (1)
60nameof(ServiceLifetime.Singleton).ToLowerInvariant()
ServiceLookup\ResultCache.cs (1)
27case ServiceLifetime.Singleton:
Microsoft.Extensions.DependencyInjection.Abstractions (63)
Extensions\ServiceCollectionDescriptorExtensions.cs (7)
312/// Adds the specified <paramref name="service"/> as a <see cref="ServiceLifetime.Singleton"/> service 329/// Adds the specified <paramref name="service"/> as a <see cref="ServiceLifetime.Singleton"/> service 350/// Adds the specified <paramref name="service"/> as a <see cref="ServiceLifetime.Singleton"/> service 371/// Adds the specified <typeparamref name="TService"/> as a <see cref="ServiceLifetime.Singleton"/> service 385/// Adds the specified <typeparamref name="TService"/> as a <see cref="ServiceLifetime.Singleton"/> service 402/// Adds the specified <typeparamref name="TService"/> as a <see cref="ServiceLifetime.Singleton"/> service 420/// Adds the specified <typeparamref name="TService"/> as a <see cref="ServiceLifetime.Singleton"/> service
Extensions\ServiceCollectionDescriptorExtensions.Keyed.cs (7)
245/// Adds the specified <paramref name="service"/> as a <see cref="ServiceLifetime.Singleton"/> service 264/// Adds the specified <paramref name="service"/> as a <see cref="ServiceLifetime.Singleton"/> service 287/// Adds the specified <paramref name="service"/> as a <see cref="ServiceLifetime.Singleton"/> service 310/// Adds the specified <typeparamref name="TService"/> as a <see cref="ServiceLifetime.Singleton"/> service 325/// Adds the specified <typeparamref name="TService"/> as a <see cref="ServiceLifetime.Singleton"/> service 343/// Adds the specified <typeparamref name="TService"/> as a <see cref="ServiceLifetime.Singleton"/> service 362/// Adds the specified <typeparamref name="TService"/> as a <see cref="ServiceLifetime.Singleton"/> service
ServiceCollectionServiceExtensions.cs (11)
308/// <seealso cref="ServiceLifetime.Singleton"/> 318return Add(services, serviceType, implementationType, ServiceLifetime.Singleton); 330/// <seealso cref="ServiceLifetime.Singleton"/> 340return Add(services, serviceType, implementationFactory, ServiceLifetime.Singleton); 352/// <seealso cref="ServiceLifetime.Singleton"/> 369/// <seealso cref="ServiceLifetime.Singleton"/> 387/// <seealso cref="ServiceLifetime.Singleton"/> 405/// <seealso cref="ServiceLifetime.Singleton"/> 428/// <seealso cref="ServiceLifetime.Singleton"/> 450/// <seealso cref="ServiceLifetime.Singleton"/> 473/// <seealso cref="ServiceLifetime.Singleton"/>
ServiceCollectionServiceExtensions.Keyed.cs (11)
340/// <seealso cref="ServiceLifetime.Singleton"/> 351return AddKeyed(services, serviceType, serviceKey, implementationType, ServiceLifetime.Singleton); 364/// <seealso cref="ServiceLifetime.Singleton"/> 375return AddKeyed(services, serviceType, serviceKey, implementationFactory, ServiceLifetime.Singleton); 388/// <seealso cref="ServiceLifetime.Singleton"/> 408/// <seealso cref="ServiceLifetime.Singleton"/> 428/// <seealso cref="ServiceLifetime.Singleton"/> 449/// <seealso cref="ServiceLifetime.Singleton"/> 474/// <seealso cref="ServiceLifetime.Singleton"/> 498/// <seealso cref="ServiceLifetime.Singleton"/> 523/// <seealso cref="ServiceLifetime.Singleton"/>
ServiceDescriptor.cs (27)
52/// as a <see cref="ServiceLifetime.Singleton"/>. 65/// as a <see cref="ServiceLifetime.Singleton"/>. 74: this(serviceType, serviceKey, ServiceLifetime.Singleton) 682/// and the <see cref="ServiceLifetime.Singleton"/> lifetime. 691return DescribeKeyed<TService, TImplementation>(null, ServiceLifetime.Singleton); 697/// and the <see cref="ServiceLifetime.Singleton"/> lifetime. 708return DescribeKeyed<TService, TImplementation>(serviceKey, ServiceLifetime.Singleton); 714/// and the <see cref="ServiceLifetime.Singleton"/> lifetime. 726return Describe(service, implementationType, ServiceLifetime.Singleton); 732/// and the <see cref="ServiceLifetime.Singleton"/> lifetime. 746return DescribeKeyed(service, serviceKey, implementationType, ServiceLifetime.Singleton); 753/// and the <see cref="ServiceLifetime.Singleton"/> lifetime. 766return Describe(typeof(TService), implementationFactory, ServiceLifetime.Singleton); 773/// and the <see cref="ServiceLifetime.Singleton"/> lifetime. 788return DescribeKeyed(typeof(TService), serviceKey, implementationFactory, ServiceLifetime.Singleton); 794/// and the <see cref="ServiceLifetime.Singleton"/> lifetime. 804return Describe(typeof(TService), implementationFactory, ServiceLifetime.Singleton); 810/// and the <see cref="ServiceLifetime.Singleton"/> lifetime. 823return DescribeKeyed(typeof(TService), serviceKey, implementationFactory, ServiceLifetime.Singleton); 829/// and the <see cref="ServiceLifetime.Singleton"/> lifetime. 841return Describe(serviceType, implementationFactory, ServiceLifetime.Singleton); 847/// and the <see cref="ServiceLifetime.Singleton"/> lifetime. 861return DescribeKeyed(serviceType, serviceKey, implementationFactory, ServiceLifetime.Singleton); 867/// and the <see cref="ServiceLifetime.Singleton"/> lifetime. 883/// and the <see cref="ServiceLifetime.Singleton"/> lifetime. 902/// and the <see cref="ServiceLifetime.Singleton"/> lifetime. 920/// and the <see cref="ServiceLifetime.Singleton"/> lifetime.
Microsoft.Extensions.Diagnostics.HealthChecks.Tests (5)
DependencyInjection\ServiceCollectionExtensionsTest.cs (5)
29Assert.Equal(ServiceLifetime.Singleton, actual.Lifetime); 37Assert.Equal(ServiceLifetime.Singleton, actual.Lifetime); 59Assert.Equal(ServiceLifetime.Singleton, actual.Lifetime); 67Assert.Equal(ServiceLifetime.Singleton, actual.Lifetime); 75Assert.Equal(ServiceLifetime.Singleton, actual.Lifetime);
Microsoft.Extensions.Http (3)
DependencyInjection\HttpClientBuilderExtensions.cs (3)
666/// <see cref="ServiceLifetime.Singleton"/> service. 669/// WARNING: In case of (1) a keyed <see cref="ServiceLifetime.Singleton"/> <see cref="HttpClient"/> registration, or (2) a keyed <see cref="ServiceLifetime.Transient"/> 670/// <see cref="HttpClient"/> injected into a <see cref="ServiceLifetime.Singleton"/> service, or (3) long-running application scopes,