mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-22 17:47:53 +00:00
Clean up how IHttpContextAccessor is added
This commit is contained in:
@@ -1,10 +1,4 @@
|
|||||||
using System;
|
using Microsoft.AspNetCore.SpaServices.Prerendering;
|
||||||
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
|
||||||
{
|
{
|
||||||
@@ -20,7 +14,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.TryAddSingleton<IHttpContextAccessor, HttpContextAccessor>();
|
serviceCollection.AddHttpContextAccessor();
|
||||||
serviceCollection.AddSingleton<ISpaPrerenderer, DefaultSpaPrerenderer>();
|
serviceCollection.AddSingleton<ISpaPrerenderer, DefaultSpaPrerenderer>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user