Revert "Clean up how IHttpContextAccessor is added" because this API

only exists in 2.1.x, and this branch is for 2.0.1

This reverts commit e583a17ef8.
This commit is contained in:
Steve Sanderson
2017-11-16 10:05:26 +00:00
parent e6309ba784
commit 685f7da091

View File

@@ -1,4 +1,10 @@
using Microsoft.AspNetCore.SpaServices.Prerendering; using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.NodeServices;
using Microsoft.AspNetCore.SpaServices.Prerendering;
using Microsoft.Extensions.DependencyInjection.Extensions;
namespace Microsoft.Extensions.DependencyInjection namespace Microsoft.Extensions.DependencyInjection
{ {
@@ -14,7 +20,7 @@ namespace Microsoft.Extensions.DependencyInjection
/// <param name="serviceCollection">The <see cref="IServiceCollection"/>.</param> /// <param name="serviceCollection">The <see cref="IServiceCollection"/>.</param>
public static void AddSpaPrerenderer(this IServiceCollection serviceCollection) public static void AddSpaPrerenderer(this IServiceCollection serviceCollection)
{ {
serviceCollection.AddHttpContextAccessor(); serviceCollection.TryAddSingleton<IHttpContextAccessor, HttpContextAccessor>();
serviceCollection.AddSingleton<ISpaPrerenderer, DefaultSpaPrerenderer>(); serviceCollection.AddSingleton<ISpaPrerenderer, DefaultSpaPrerenderer>();
} }
} }