This repository was archived by the owner on Apr 8, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +3
-8
lines changed
src/Microsoft.AspNetCore.SpaServices/Prerendering Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Original file line number Diff line number Diff line change 77using Microsoft . AspNetCore . NodeServices ;
88using Microsoft . AspNetCore . SpaServices ;
99using Microsoft . AspNetCore . SpaServices . Prerendering ;
10+ using Microsoft . Extensions . DependencyInjection ;
1011using System ;
1112using System . Threading . Tasks ;
1213
@@ -41,9 +42,9 @@ public static void UsePrerendering(
4142 var appBuilder = spaBuilder . AppBuilder ;
4243 var serviceProvider = appBuilder . ApplicationServices ;
4344 var nodeServices = GetNodeServices ( serviceProvider ) ;
44- var applicationStoppingToken = GetRequiredService < IApplicationLifetime > ( serviceProvider )
45+ var applicationStoppingToken = serviceProvider . GetRequiredService < IApplicationLifetime > ( )
4546 . ApplicationStopping ;
46- var applicationBasePath = GetRequiredService < IHostingEnvironment > ( serviceProvider )
47+ var applicationBasePath = serviceProvider . GetRequiredService < IHostingEnvironment > ( )
4748 . ContentRootPath ;
4849 var moduleExport = new JavaScriptModuleExport ( entryPoint ) ;
4950
@@ -92,12 +93,6 @@ public static void UsePrerendering(
9293 } ) ;
9394 }
9495
95- private static T GetRequiredService < T > ( IServiceProvider serviceProvider ) where T : class
96- {
97- return ( T ) serviceProvider . GetService ( typeof ( T ) )
98- ?? throw new Exception ( $ "Could not resolve service of type { typeof ( T ) . FullName } in service provider.") ;
99- }
100-
10196 private static async Task ApplyRenderResult ( HttpContext context , RenderToStringResult renderResult )
10297 {
10398 if ( ! string . IsNullOrEmpty ( renderResult . RedirectUrl ) )
You can’t perform that action at this time.
0 commit comments