From 3c6309a6d09a3132b265631f76b7ece0a26a4920 Mon Sep 17 00:00:00 2001 From: alexmg Date: Tue, 14 Apr 2015 23:24:40 +1000 Subject: [PATCH] Resolved #635 - Use the ConcurrentDictionary for constructor invoker caching in DNX451 and DNXCORE50. --- .../Activators/Reflection/ConstructorParameterBinding.cs | 7 +++++++ src/Autofac/project.json | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Autofac/Core/Activators/Reflection/ConstructorParameterBinding.cs b/src/Autofac/Core/Activators/Reflection/ConstructorParameterBinding.cs index feac2477c..667303ba5 100644 --- a/src/Autofac/Core/Activators/Reflection/ConstructorParameterBinding.cs +++ b/src/Autofac/Core/Activators/Reflection/ConstructorParameterBinding.cs @@ -24,6 +24,9 @@ // OTHER DEALINGS IN THE SOFTWARE. using System; +#if DNX451 || DNXCORE50 +using System.Collections.Concurrent; +#endif using System.Collections.Generic; using System.Globalization; using System.Linq.Expressions; @@ -39,7 +42,11 @@ public class ConstructorParameterBinding { readonly ConstructorInfo _ci; readonly Func[] _valueRetrievers; +#if DNX451 || DNXCORE50 + readonly static ConcurrentDictionary> _constructorInvokers = new ConcurrentDictionary>(); +#else readonly static SafeDictionary> _constructorInvokers = new SafeDictionary>(); +#endif // We really need to report all non-bindable parameters, howevers some refactoring // will be necessary before this is possible. Adding this now to ease the diff --git a/src/Autofac/project.json b/src/Autofac/project.json index dd808e232..092506b26 100644 --- a/src/Autofac/project.json +++ b/src/Autofac/project.json @@ -19,7 +19,8 @@ "dnx451": { }, "dnxcore50": { "dependencies": { - "System.Collections": "4.0.10-beta-*", + "System.Collections": "4.0.10-beta-*", + "System.Collections.Concurrent": "4.0.10-beta-*", "System.ComponentModel": "4.0.0-beta-*", "System.Diagnostics.Contracts": "4.0.0-beta-*", "System.Diagnostics.Debug": "4.0.10-beta-*",