142 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)
193case 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.Hosting.Testing.Tests (1)
ResourceLoggerForwarderServiceTests.cs (1)
25&& 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)
107}, contextLifetime: ServiceLifetime.Singleton); 113Assert.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)
258}, contextLifetime: ServiceLifetime.Singleton); 264Assert.Equal(ServiceLifetime.Singleton, optionsDescriptor.Lifetime);
Aspire.Npgsql.Tests (1)
ConformanceTests.cs (1)
20protected override ServiceLifetime ServiceLifetime => ServiceLifetime.Singleton;
Aspire.Oracle.EntityFrameworkCore.Tests (3)
ConformanceTests.cs (1)
18protected override ServiceLifetime ServiceLifetime => ServiceLifetime.Singleton;
EnrichOracleDatabaseTests.cs (2)
245}, contextLifetime: ServiceLifetime.Singleton); 251Assert.Equal(ServiceLifetime.Singleton, optionsDescriptor.Lifetime);
Aspire.Pomelo.EntityFrameworkCore.MySql.Tests (3)
ConformanceTests.cs (1)
23protected override ServiceLifetime ServiceLifetime => ServiceLifetime.Singleton;
EnrichMySqlTests.cs (2)
263}, contextLifetime: ServiceLifetime.Singleton); 269Assert.Equal(ServiceLifetime.Singleton, optionsDescriptor.Lifetime);
Aspire.Qdrant.Client.Tests (1)
ConformanceTests.cs (1)
21protected 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.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.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) 688/// and the <see cref="ServiceLifetime.Singleton"/> lifetime. 697return DescribeKeyed<TService, TImplementation>(null, ServiceLifetime.Singleton); 703/// and the <see cref="ServiceLifetime.Singleton"/> lifetime. 714return DescribeKeyed<TService, TImplementation>(serviceKey, ServiceLifetime.Singleton); 720/// and the <see cref="ServiceLifetime.Singleton"/> lifetime. 732return Describe(service, implementationType, ServiceLifetime.Singleton); 738/// and the <see cref="ServiceLifetime.Singleton"/> lifetime. 752return DescribeKeyed(service, serviceKey, implementationType, ServiceLifetime.Singleton); 759/// and the <see cref="ServiceLifetime.Singleton"/> lifetime. 772return Describe(typeof(TService), implementationFactory, ServiceLifetime.Singleton); 779/// and the <see cref="ServiceLifetime.Singleton"/> lifetime. 794return DescribeKeyed(typeof(TService), serviceKey, implementationFactory, ServiceLifetime.Singleton); 800/// and the <see cref="ServiceLifetime.Singleton"/> lifetime. 810return Describe(typeof(TService), implementationFactory, ServiceLifetime.Singleton); 816/// and the <see cref="ServiceLifetime.Singleton"/> lifetime. 829return DescribeKeyed(typeof(TService), serviceKey, implementationFactory, ServiceLifetime.Singleton); 835/// and the <see cref="ServiceLifetime.Singleton"/> lifetime. 847return Describe(serviceType, implementationFactory, ServiceLifetime.Singleton); 853/// and the <see cref="ServiceLifetime.Singleton"/> lifetime. 867return DescribeKeyed(serviceType, serviceKey, implementationFactory, ServiceLifetime.Singleton); 873/// and the <see cref="ServiceLifetime.Singleton"/> lifetime. 889/// and the <see cref="ServiceLifetime.Singleton"/> lifetime. 908/// and the <see cref="ServiceLifetime.Singleton"/> lifetime. 926/// 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);