File tree 2 files changed +4
-19
lines changed
React.Sample.Webpack.CoreMvc
2 files changed +4
-19
lines changed Original file line number Diff line number Diff line change 3
3
* All rights reserved.
4
4
*
5
5
* This source code is licensed under the BSD-style license found in the
6
- * LICENSE file in the root directory of this source tree. An additional grant
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
7
* of patent rights can be found in the PATENTS file in the same directory.
8
8
*/
9
9
@@ -40,12 +40,10 @@ public static IApplicationBuilder UseReact(
40
40
BabelFileOptions fileOptions = null
41
41
)
42
42
{
43
- EnsureServicesRegistered ( app ) ;
44
-
45
43
RegisterAspNetServices ( React . AssemblyRegistration . Container , app . ApplicationServices ) ;
46
44
47
45
Initializer . Initialize ( registerOptions => AsPerRequestSingleton (
48
- app . ApplicationServices . GetService < IHttpContextAccessor > ( ) ,
46
+ app . ApplicationServices . GetService < IHttpContextAccessor > ( ) ,
49
47
registerOptions
50
48
) ) ;
51
49
@@ -79,19 +77,6 @@ TinyIoCContainer.RegisterOptions registerOptions
79
77
) ;
80
78
}
81
79
82
- /// <summary>
83
- /// Ensures React services have been registered in the ASP.NET dependency injection container.
84
- /// </summary>
85
- /// <param name="app">ASP.NET application builder</param>
86
- private static void EnsureServicesRegistered ( IApplicationBuilder app )
87
- {
88
- var registrations = app . ApplicationServices . GetService < HttpContextLifetimeProvider . PerRequestRegistrations > ( ) ;
89
- if ( registrations == null )
90
- {
91
- throw new ReactNotInitialisedException ( "Please call services.AddReact() before app.UseReact()." ) ;
92
- }
93
- }
94
-
95
80
/// <summary>
96
81
/// Registers required ASP.NET services in ReactJS.NET's TinyIoC container. This is used
97
82
/// for ASP.NET services that are required by ReactJS.NET.
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ public Startup(IConfiguration configuration)
20
20
public IConfiguration Configuration { get ; }
21
21
22
22
// This method gets called by the runtime. Use this method to add services to the container.
23
- public IServiceProvider ConfigureServices ( IServiceCollection services )
23
+ public void ConfigureServices ( IServiceCollection services )
24
24
{
25
25
services . AddMvc ( ) ;
26
26
@@ -31,7 +31,7 @@ public IServiceProvider ConfigureServices(IServiceCollection services)
31
31
services . AddSingleton < IHttpContextAccessor , HttpContextAccessor > ( ) ;
32
32
33
33
// Build the intermediate service provider then return it
34
- return services . BuildServiceProvider ( ) ;
34
+ services . BuildServiceProvider ( ) ;
35
35
}
36
36
37
37
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
You can’t perform that action at this time.
0 commit comments