1 write to Lifetime
Microsoft.Extensions.DependencyInjection.Abstractions (1)
ServiceDescriptor.cs (1)
131Lifetime = lifetime;
83 references to Lifetime
Aspire.Hosting.Testing.Tests (1)
ResourceLoggerForwarderServiceTests.cs (1)
26&& sd.Lifetime == ServiceLifetime.Singleton);
Aspire.Microsoft.EntityFrameworkCore.Cosmos (1)
src\Components\Common\EntityFrameworkUtils.cs (1)
84oldDbContextOptionsDescriptor.Lifetime
Aspire.Microsoft.EntityFrameworkCore.Cosmos.Tests (1)
EnrichCosmosDbTests.cs (1)
115Assert.Equal(ServiceLifetime.Singleton, optionsDescriptor.Lifetime);
Aspire.Microsoft.EntityFrameworkCore.SqlServer (1)
src\Components\Common\EntityFrameworkUtils.cs (1)
84oldDbContextOptionsDescriptor.Lifetime
Aspire.Microsoft.EntityFrameworkCore.SqlServer.Tests (1)
EnrichSqlServerTests.cs (1)
256Assert.Equal(ServiceLifetime.Singleton, optionsDescriptor.Lifetime);
Aspire.Npgsql.EntityFrameworkCore.PostgreSQL (1)
src\Components\Common\EntityFrameworkUtils.cs (1)
84oldDbContextOptionsDescriptor.Lifetime
Aspire.Npgsql.EntityFrameworkCore.PostgreSQL.Tests (1)
EnrichNpgsqlTests.cs (1)
265Assert.Equal(ServiceLifetime.Singleton, optionsDescriptor.Lifetime);
Aspire.Oracle.EntityFrameworkCore (1)
src\Components\Common\EntityFrameworkUtils.cs (1)
84oldDbContextOptionsDescriptor.Lifetime
Aspire.Oracle.EntityFrameworkCore.Tests (1)
EnrichOracleDatabaseTests.cs (1)
257Assert.Equal(ServiceLifetime.Singleton, optionsDescriptor.Lifetime);
Aspire.Pomelo.EntityFrameworkCore.MySql (1)
src\Components\Common\EntityFrameworkUtils.cs (1)
84oldDbContextOptionsDescriptor.Lifetime
Aspire.Pomelo.EntityFrameworkCore.MySql.Tests (1)
EnrichMySqlTests.cs (1)
270Assert.Equal(ServiceLifetime.Singleton, optionsDescriptor.Lifetime);
Microsoft.AspNetCore.AsyncState.Tests (2)
AsyncStateHttpContextExtensionsTests.cs (2)
29Assert.Equal(ServiceLifetime.Singleton, serviceDescriptor.Lifetime); 32Assert.Equal(ServiceLifetime.Singleton, serviceDescriptor.Lifetime);
Microsoft.AspNetCore.Http.Tests (1)
HttpServiceCollectionExtensionsTests.cs (1)
21Assert.Equal(ServiceLifetime.Singleton, descriptor.Lifetime);
Microsoft.AspNetCore.Mvc.Core.Test (3)
DependencyInjection\MvcBuilderExtensionsTest.cs (3)
100Assert.Equal(ServiceLifetime.Transient, services[0].Lifetime); 104Assert.Equal(ServiceLifetime.Transient, services[1].Lifetime); 108Assert.Equal(ServiceLifetime.Transient, services[2].Lifetime);
Microsoft.AspNetCore.Mvc.Localization.Test (14)
MvcLocalizationMvcBuilderExtensionsTest.cs (7)
49Assert.Equal(ServiceLifetime.Singleton, service.Lifetime); 55Assert.Equal(ServiceLifetime.Transient, service.Lifetime); 62Assert.Equal(ServiceLifetime.Transient, service.Lifetime); 67Assert.Equal(ServiceLifetime.Singleton, service.Lifetime); 72Assert.Equal(ServiceLifetime.Singleton, service.Lifetime); 77Assert.Equal(ServiceLifetime.Transient, service.Lifetime); 82Assert.Equal(ServiceLifetime.Transient, service.Lifetime);
MvcLocalizationMvcCoreBuilderExtensionsTest.cs (7)
49Assert.Equal(ServiceLifetime.Singleton, service.Lifetime); 55Assert.Equal(ServiceLifetime.Transient, service.Lifetime); 62Assert.Equal(ServiceLifetime.Transient, service.Lifetime); 67Assert.Equal(ServiceLifetime.Transient, service.Lifetime); 72Assert.Equal(ServiceLifetime.Singleton, service.Lifetime); 77Assert.Equal(ServiceLifetime.Transient, service.Lifetime); 82Assert.Equal(ServiceLifetime.Transient, service.Lifetime);
Microsoft.AspNetCore.Mvc.Razor.Test (6)
DependencyInjection\MvcRazorMvcBuilderExtensionsTest.cs (3)
56Assert.Equal(ServiceLifetime.Transient, tagHelperOne.Lifetime); 60Assert.Equal(ServiceLifetime.Transient, tagHelperTwo.Lifetime); 64Assert.Equal(ServiceLifetime.Transient, activator.Lifetime);
DependencyInjection\MvcRazorMvcCoreBuilderExtensionsTest.cs (3)
96Assert.Equal(ServiceLifetime.Transient, tagHelperOne.Lifetime); 100Assert.Equal(ServiceLifetime.Transient, tagHelperTwo.Lifetime); 104Assert.Equal(ServiceLifetime.Transient, activator.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 (3)
DependencyInjection\MvcViewFeaturesMvcBuilderExtensionsTest.cs (3)
147Assert.Equal(ServiceLifetime.Transient, collection[0].Lifetime); 151Assert.Equal(ServiceLifetime.Transient, collection[1].Lifetime); 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)
62if (!IsTypeResolvable(service.ImplementationType, services, allErrors, service.Lifetime)) 149parameterService.Lifetime == ServiceLifetime.Scoped)
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 (2)
SqlServerCacheServicesExtensionsTest.cs (2)
27Assert.Equal(ServiceLifetime.Singleton, serviceDescriptor.Lifetime); 51Assert.Equal(ServiceLifetime.Scoped, distributedCache.Lifetime);
Microsoft.Extensions.Caching.StackExchangeRedis.Tests (3)
CacheServiceExtensionsTests.cs (3)
29Assert.Equal(ServiceLifetime.Singleton, distributedCache.Lifetime); 48Assert.Equal(ServiceLifetime.Scoped, distributedCache.Lifetime); 119Assert.Equal(ServiceLifetime.Scoped, distributedCache.Lifetime);
Microsoft.Extensions.DependencyInjection (4)
DependencyInjectionEventSource.cs (2)
196switch (descriptor.Lifetime) 244builder.Append(descriptor.Lifetime);
ServiceLookup\CallSiteFactory.cs (2)
381var lifetime = new ResultCache(descriptor.Lifetime, serviceIdentifier, slot); 430var lifetime = new ResultCache(descriptor.Lifetime, serviceIdentifier, slot);
Microsoft.Extensions.DependencyInjection.Abstractions (3)
ServiceDescriptor.cs (3)
252string? lifetime = $"{nameof(ServiceType)}: {ServiceType} {nameof(Lifetime)}: {Lifetime} "; 1017string debugText = $@"Lifetime = {Lifetime}, ServiceType = ""{ServiceType.FullName}""";
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);