Reacting to DI changes

This commit is contained in:
Pranav K 2015-12-17 12:03:29 -08:00
parent 70f9431e7f
commit a036ff4738
2 changed files with 4 additions and 4 deletions

View File

@ -123,7 +123,7 @@ namespace Microsoft.Extensions.DependencyInjection
{
if (CompilationServices.Default != null)
{
services.TryAdd(ServiceDescriptor.Instance(CompilationServices.Default.LibraryExporter));
services.TryAddSingleton(CompilationServices.Default.LibraryExporter);
}
services.TryAddEnumerable(
@ -165,7 +165,7 @@ namespace Microsoft.Extensions.DependencyInjection
if (PlatformServices.Default?.AssemblyLoadContextAccessor != null)
{
services.TryAdd(ServiceDescriptor.Instance(PlatformServices.Default.AssemblyLoadContextAccessor));
services.TryAddSingleton(PlatformServices.Default.AssemblyLoadContextAccessor);
}
}
}

View File

@ -67,7 +67,7 @@ namespace Microsoft.AspNet.Mvc.Localization.Internal
collection.Add(ServiceDescriptor.Singleton(typeof(IHtmlLocalizerFactory), typeof(TestHtmlLocalizerFactory)));
collection.Add(ServiceDescriptor.Transient(typeof(IHtmlLocalizer<>), typeof(TestHtmlLocalizer<>)));
collection.Add(ServiceDescriptor.Transient(typeof(IViewLocalizer), typeof(TestViewLocalizer)));
collection.Add(ServiceDescriptor.Instance(typeof(HtmlEncoder), testEncoder));
collection.Add(ServiceDescriptor.Singleton(typeof(HtmlEncoder), testEncoder));
MvcLocalizationServices.AddMvcLocalizationServices(
collection,
@ -125,7 +125,7 @@ namespace Microsoft.AspNet.Mvc.Localization.Internal
collection.Add(ServiceDescriptor.Transient(typeof(IHtmlLocalizer<>), typeof(TestHtmlLocalizer<>)));
collection.Add(ServiceDescriptor.Transient(typeof(IHtmlLocalizer), typeof(TestViewLocalizer)));
collection.Add(ServiceDescriptor.Instance(typeof(HtmlEncoder), typeof(HtmlTestEncoder)));
collection.Add(ServiceDescriptor.Singleton(typeof(HtmlEncoder), typeof(HtmlTestEncoder)));
// Assert
Assert.Collection(collection,