Add IAssemblyLoadContextAccessor to the service collection

This commit is contained in:
Pranav K 2015-12-08 15:42:09 -08:00
parent 218613bc0a
commit be46c7602e
1 changed files with 6 additions and 0 deletions

View File

@ -17,6 +17,7 @@ using Microsoft.Extensions.CompilationAbstractions;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.MemoryPool;
using Microsoft.Extensions.OptionsModel;
using Microsoft.Extensions.PlatformAbstractions;
namespace Microsoft.Extensions.DependencyInjection
{
@ -161,6 +162,11 @@ namespace Microsoft.Extensions.DependencyInjection
services.TryAddSingleton<IArraySegmentPool<RazorValue>, DefaultArraySegmentPool<RazorValue>>();
services.TryAddScoped<IRazorBufferScope, MemoryPoolRazorBufferScope>();
if (PlatformServices.Default?.AssemblyLoadContextAccessor != null)
{
services.TryAdd(ServiceDescriptor.Instance(PlatformServices.Default.AssemblyLoadContextAccessor));
}
}
}
}