8 implementations of ServiceProvider
Microsoft.AspNetCore.Http.Extensions.Tests (2)
RequestDelegateFactoryTests.cs (1)
3678public IServiceProvider ServiceProvider => this;
RequestDelegateGenerator\RequestDelegateCreationTestBase.cs (1)
445public IServiceProvider ServiceProvider => this;
Microsoft.AspNetCore.Http.Microbenchmarks (1)
src\Http\Http.Extensions\test\RequestDelegateGenerator\RequestDelegateCreationTestBase.cs (1)
445public IServiceProvider ServiceProvider => this;
Microsoft.AspNetCore.Http.Tests (1)
DefaultHttpContextTests.cs (1)
569public IServiceProvider ServiceProvider => _scope.ServiceProvider;
Microsoft.AspNetCore.OpenApi.Tests (1)
Services\OpenApiDocumentServiceTestsBase.cs (1)
260public IServiceProvider ServiceProvider => this;
Microsoft.AspNetCore.Routing.Tests (1)
Builder\RouteHandlerEndpointRouteBuilderExtensionsTest.cs (1)
1160public IServiceProvider ServiceProvider => this;
Microsoft.Extensions.DependencyInjection (1)
ServiceLookup\ServiceProviderEngineScope.cs (1)
73public IServiceProvider ServiceProvider => this;
Microsoft.Extensions.DependencyInjection.Abstractions (1)
AsyncServiceScope.cs (1)
31public IServiceProvider ServiceProvider => _serviceScope.ServiceProvider;
88 references to ServiceProvider
Aspire.Components.Common.Tests (3)
ConformanceTests.cs (3)
180serviceFromFirstScope = Resolve(scope1.ServiceProvider, key); 185serviceFromSecondScope = Resolve(scope2.ServiceProvider, key); 187secondServiceFromSecondScope = Resolve(scope2.ServiceProvider, key);
CatalogDb (1)
CatalogDbInitializer.cs (1)
16var dbContext = scope.ServiceProvider.GetRequiredService<CatalogDbContext>();
DatabaseMigration.MigrationService (1)
ApiDbInitializer.cs (1)
27var dbContext = scope.ServiceProvider.GetRequiredService<MyDb1Context>();
Microsoft.AspNetCore.Components.Endpoints.Tests (1)
EndpointHtmlRendererTest.cs (1)
672var scopedProvider = scope.ServiceProvider;
Microsoft.AspNetCore.DataProtection.EntityFrameworkCore (2)
EntityFrameworkCoreXmlRepository.cs (2)
50var context = scope.ServiceProvider.GetRequiredService<TContext>(); 70var context = scope.ServiceProvider.GetRequiredService<TContext>();
Microsoft.AspNetCore.Diagnostics.Middleware.Tests (4)
Latency\RequestLatencyTelemetryExtensionsTests.cs (4)
43Assert.Equal(scope1.ServiceProvider.GetService<ILatencyContext>(), 44scope1.ServiceProvider.GetService<ILatencyContext>()); 45Assert.NotEqual(scope1.ServiceProvider.GetService<ILatencyContext>(), 46scope2.ServiceProvider.GetService<ILatencyContext>());
Microsoft.AspNetCore.Hosting (1)
Internal\ConfigureBuilder.cs (1)
28var serviceProvider = scope.ServiceProvider;
Microsoft.AspNetCore.Http (1)
Features\RequestServicesFeature.cs (1)
39_requestServices = _scope.ServiceProvider;
Microsoft.AspNetCore.Http.Extensions.Tests (1)
RequestDelegateFactoryTests.cs (1)
1182httpContext.RequestServices = requestScoped.ServiceProvider;
Microsoft.AspNetCore.Http.Tests (1)
DefaultHttpContextTests.cs (1)
569public IServiceProvider ServiceProvider => _scope.ServiceProvider;
Microsoft.AspNetCore.Identity.EntityFrameworkCore.Test (15)
CustomSchemaTest.cs (2)
35var db = scope.ServiceProvider.GetRequiredService<CustomVersionDbContext>(); 43var db = scope.ServiceProvider.GetRequiredService<CustomVersionDbContext>();
DefaultPocoTest.cs (1)
37scoped.ServiceProvider.GetRequiredService<IdentityDbContext>().Database.EnsureCreated();
EmptySchemaTest.cs (2)
35var db = scope.ServiceProvider.GetRequiredService<EmptyDbContext>(); 43var db = scope.ServiceProvider.GetRequiredService<EmptyDbContext>();
MaxKeyLengthSchemaTest.cs (2)
36scope.ServiceProvider.GetRequiredService<VerstappenDbContext>().Database.EnsureCreated(); 54var db = scope.ServiceProvider.GetRequiredService<VerstappenDbContext>();
UserOnlyCustomContextTest.cs (1)
80using (var db = scoped.ServiceProvider.GetRequiredService<CustomContext>())
UserOnlyTest.cs (1)
41using (var db = scoped.ServiceProvider.GetRequiredService<TestUserDbContext>())
UserStoreEncryptPersonalDataTest.cs (2)
196var dbContext = scope.ServiceProvider.GetRequiredService<TContext>(); 199var manager = scope.ServiceProvider.GetService<UserManager<CustomUser>>();
VersionOneSchemaTest.cs (2)
37var db = scope.ServiceProvider.GetRequiredService<VersionOneDbContext>(); 45var db = scope.ServiceProvider.GetRequiredService<VersionOneDbContext>();
VersionTwoSchemaTest.cs (2)
37var db = scope.ServiceProvider.GetRequiredService<VersionTwoDbContext>(); 45var db = scope.ServiceProvider.GetRequiredService<VersionTwoDbContext>();
Microsoft.AspNetCore.Identity.FunctionalTests (1)
Infrastructure\ServerFactory.cs (1)
77scope.ServiceProvider.GetService<TContext>()?.Database?.EnsureCreated();
Microsoft.AspNetCore.Mvc.FunctionalTests (1)
TestingInfrastructureInheritanceTests.cs (1)
102var sink = scope.ServiceProvider.GetRequiredService<DisposableService>();
Microsoft.AspNetCore.Mvc.Test (1)
MvcServiceCollectionExtensionsTest.cs (1)
421scope.ServiceProvider.GetService(typeof(IEnumerable<>).MakeGenericType(serviceType));
Microsoft.AspNetCore.OpenApi (1)
Services\OpenApiDocumentProvider.cs (1)
48var document = await targetDocumentService.GetOpenApiDocumentAsync(scopedService.ServiceProvider);
Microsoft.AspNetCore.OpenApi.Microbenchmarks (7)
GenerationBenchmarks.cs (1)
39_serviceProvider = _builder.ServiceProvider.CreateScope().ServiceProvider;
TransformersBenchmark.cs (6)
38_serviceProvider = _builder.ServiceProvider.CreateScope().ServiceProvider; 54_serviceProvider = _builder.ServiceProvider.CreateScope().ServiceProvider; 66_serviceProvider = _builder.ServiceProvider.CreateScope().ServiceProvider; 82_serviceProvider = _builder.ServiceProvider.CreateScope().ServiceProvider; 94_serviceProvider = _builder.ServiceProvider.CreateScope().ServiceProvider; 117_serviceProvider = _builder.ServiceProvider.CreateScope().ServiceProvider;
Microsoft.AspNetCore.OpenApi.Tests (4)
Integration\OpenApiDocumentIntegrationTests.cs (1)
25var document = await documentService.GetOpenApiDocumentAsync(scopedServiceProvider.ServiceProvider);
Services\OpenApiDocumentServiceTestsBase.cs (3)
38var document = await documentService.GetOpenApiDocumentAsync(scopedService.ServiceProvider, cancellationToken); 47var document = await documentService.GetOpenApiDocumentAsync(scopedService.ServiceProvider); 278if (scope.ServiceProvider is IKeyedServiceProvider scopedServiceProvider)
Microsoft.AspNetCore.SignalR.Core (1)
Internal\DefaultHubDispatcher.cs (1)
777serviceProviderIsService = scope.ServiceProvider.GetService<IServiceProviderIsService>();
Microsoft.Extensions.DependencyInjection.Abstractions (3)
AsyncServiceScope.cs (1)
31public IServiceProvider ServiceProvider => _serviceScope.ServiceProvider;
IServiceScope.cs (1)
14/// <see cref="Microsoft.Extensions.DependencyInjection.IServiceScope.ServiceProvider"/> will be
IServiceScopeFactory.cs (1)
20/// from the <see cref="Microsoft.Extensions.DependencyInjection.IServiceScope.ServiceProvider"/>
Microsoft.Extensions.Http (1)
DefaultHttpClientFactory.cs (1)
140services = scope.ServiceProvider;
Microsoft.Extensions.ObjectPool.DependencyInjection.Tests (10)
DependencyInjectionExtensionsTests.cs (10)
240resolved1 = scope.ServiceProvider.GetRequiredService<ITestClass>(); 241resolved2 = scope.ServiceProvider.GetRequiredService<ITestClass>(); 273resolved1 = scope1.ServiceProvider.GetRequiredService<ITestClass>(); 274resolved2 = scope1.ServiceProvider.GetRequiredService<ITestClass>(); 277resolved3 = scope2.ServiceProvider.GetRequiredService<ITestClass>(); 278resolved4 = scope2.ServiceProvider.GetRequiredService<ITestClass>(); 330resolved1 = scope1.ServiceProvider.GetRequiredService<ITestClass>(); 331resolved2 = scope1.ServiceProvider.GetRequiredService<ITestClass>(); 334resolved3 = scope2.ServiceProvider.GetRequiredService<ITestClass>(); 335resolved4 = scope2.ServiceProvider.GetRequiredService<ITestClass>();
Microsoft.Extensions.Telemetry.Abstractions.Tests (8)
Latency\NoopLatencyContextTests.cs (8)
42Assert.Equal(scope1.ServiceProvider.GetRequiredService<ILatencyContextProvider>(), 43scope1.ServiceProvider.GetRequiredService<ILatencyContextProvider>()); 44Assert.Equal(scope1.ServiceProvider.GetRequiredService<ILatencyContextTokenIssuer>(), 45scope1.ServiceProvider.GetRequiredService<ILatencyContextTokenIssuer>()); 48Assert.Equal(scope1.ServiceProvider.GetRequiredService<ILatencyContextProvider>(), 49scope2.ServiceProvider.GetRequiredService<ILatencyContextProvider>()); 50Assert.Equal(scope1.ServiceProvider.GetRequiredService<ILatencyContextTokenIssuer>(), 51scope2.ServiceProvider.GetRequiredService<ILatencyContextTokenIssuer>());
Microsoft.Extensions.Telemetry.Tests (16)
Latency\Internal\LatencyContextTests.cs (8)
82var services = scope.ServiceProvider; 109var services = scope.ServiceProvider; 135var services = scope.ServiceProvider; 163var services = scope.ServiceProvider; 193var services = scope.ServiceProvider; 219var services = scope.ServiceProvider; 244var services = scope.ServiceProvider; 270var services = scope.ServiceProvider;
Latency\LatencyContextExtensionTests.cs (8)
51Assert.Equal(scope1.ServiceProvider.GetRequiredService<ILatencyContextProvider>(), 52scope1.ServiceProvider.GetRequiredService<ILatencyContextProvider>()); 53Assert.Equal(scope1.ServiceProvider.GetRequiredService<ILatencyContextTokenIssuer>(), 54scope1.ServiceProvider.GetRequiredService<ILatencyContextTokenIssuer>()); 57Assert.Equal(scope1.ServiceProvider.GetRequiredService<ILatencyContextProvider>(), 58scope2.ServiceProvider.GetRequiredService<ILatencyContextProvider>()); 59Assert.Equal(scope1.ServiceProvider.GetRequiredService<ILatencyContextTokenIssuer>(), 60scope1.ServiceProvider.GetRequiredService<ILatencyContextTokenIssuer>());
SqlServerEndToEnd.DbSetup (2)
Program.cs (2)
12using var db1 = scope.ServiceProvider.GetRequiredService<MyDb1Context>(); 13using var db2 = scope.ServiceProvider.GetRequiredService<MyDb2Context>();
WaitForSandbox.DbSetup (1)
Program.cs (1)
10using var db = scope.ServiceProvider.GetRequiredService<MyDbContext>();