Migrate to using System.Runtime.Loader.AssemblyLoadContext

This commit is contained in:
Pavel Krymets 2016-01-20 15:36:46 -08:00
parent 7dddd06a38
commit 79eb0138c7
6 changed files with 9 additions and 9 deletions

View File

@ -61,9 +61,9 @@ namespace Microsoft.Extensions.DependencyInjection
//
// RuntimeServices
//
if (PlatformServices.Default?.LibraryManager != null)
if (DnxPlatformServices.Default?.LibraryManager != null)
{
services.TryAddSingleton(PlatformServices.Default.LibraryManager);
services.TryAddSingleton(DnxPlatformServices.Default.LibraryManager);
}
//
@ -78,7 +78,7 @@ namespace Microsoft.Extensions.DependencyInjection
// Action Discovery
//
// These are consumed only when creating action descriptors, then they can be de-allocated
if (PlatformServices.Default?.LibraryManager != null)
if (DnxPlatformServices.Default?.LibraryManager != null)
{
services.TryAddTransient<IAssemblyProvider, DefaultAssemblyProvider>();
}

View File

@ -21,6 +21,7 @@
},
"Microsoft.Extensions.FileProviders.Abstractions": "1.0.0-*",
"Microsoft.Extensions.PlatformAbstractions": "1.0.0-*",
"Microsoft.Extensions.PlatformAbstractions.Dnx": "1.0.0-*",
"Microsoft.Extensions.DependencyModel": "1.0.0-*",
"Microsoft.Extensions.ClosedGenericMatcher.Sources": {
"version": "1.0.0-*",
@ -59,4 +60,4 @@
}
}
}
}
}

View File

@ -145,9 +145,9 @@ namespace Microsoft.Extensions.DependencyInjection
// Consumed by the Cache tag helper to cache results across the lifetime of the application.
services.TryAddSingleton<IMemoryCache, MemoryCache>();
if (PlatformServices.Default?.AssemblyLoadContextAccessor != null)
if (DnxPlatformServices.Default?.AssemblyLoadContextAccessor != null)
{
services.TryAddSingleton(PlatformServices.Default.AssemblyLoadContextAccessor);
services.TryAddSingleton(DnxPlatformServices.Default.AssemblyLoadContextAccessor);
}
}
}

View File

@ -250,7 +250,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure
private static ILibraryManager GetLibraryManager()
{
return PlatformServices.Default.LibraryManager;
return DnxPlatformServices.Default.LibraryManager;
}
}
}

View File

@ -48,7 +48,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
protected virtual void InitializeServices(IServiceCollection services)
{
var libraryManager = PlatformServices.Default.LibraryManager;
var libraryManager = DnxPlatformServices.Default.LibraryManager;
// When an application executes in a regular context, the application base path points to the root
// directory where the application is located, for example .../samples/MvcSample.Web. However, when

View File

@ -249,7 +249,6 @@ namespace Microsoft.AspNetCore.Mvc
serviceCollection.AddSingleton(Mock.Of<ILibraryManager>());
serviceCollection.AddSingleton(Mock.Of<ILibraryExporter>());
serviceCollection.AddSingleton(Mock.Of<ICompilerOptionsProvider>());
serviceCollection.AddSingleton(Mock.Of<IAssemblyLoadContextAccessor>());
serviceCollection.AddSingleton(Mock.Of<IHostingEnvironment>());
var applicationEnvironment = new Mock<IApplicationEnvironment>();