File tree Expand file tree Collapse file tree
React.Sample.Webpack.CoreMvc Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33 * All rights reserved.
44 *
55 * 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
77 * of patent rights can be found in the PATENTS file in the same directory.
88 */
99
@@ -40,12 +40,10 @@ public static IApplicationBuilder UseReact(
4040 BabelFileOptions fileOptions = null
4141 )
4242 {
43- EnsureServicesRegistered ( app ) ;
44-
4543 RegisterAspNetServices ( React . AssemblyRegistration . Container , app . ApplicationServices ) ;
4644
4745 Initializer . Initialize ( registerOptions => AsPerRequestSingleton (
48- app . ApplicationServices . GetService < IHttpContextAccessor > ( ) ,
46+ app . ApplicationServices . GetService < IHttpContextAccessor > ( ) ,
4947 registerOptions
5048 ) ) ;
5149
@@ -79,19 +77,6 @@ TinyIoCContainer.RegisterOptions registerOptions
7977 ) ;
8078 }
8179
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-
9580 /// <summary>
9681 /// Registers required ASP.NET services in ReactJS.NET's TinyIoC container. This is used
9782 /// 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)
2020 public IConfiguration Configuration { get ; }
2121
2222 // 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 )
2424 {
2525 services . AddMvc ( ) ;
2626
@@ -31,7 +31,7 @@ public IServiceProvider ConfigureServices(IServiceCollection services)
3131 services . AddSingleton < IHttpContextAccessor , HttpContextAccessor > ( ) ;
3232
3333 // Build the intermediate service provider then return it
34- return services . BuildServiceProvider ( ) ;
34+ services . BuildServiceProvider ( ) ;
3535 }
3636
3737 // 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