Skip to content

Commit 85b7a73

Browse files
Tyler CarlsonTyler Carlson
authored andcommitted
Making SinglePredicateExpressionArgumentType caching thread safe
1 parent 3bfa4ec commit 85b7a73

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/AutoMapper.Collection/AutoMapper.Collection/Equivilency Expression/ExpressionExtentions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
using System;
2-
using System.Collections.Generic;
2+
using System.Collections.Concurrent;
33
using System.Linq;
44
using System.Linq.Expressions;
55

66
namespace AutoMapper.EquivilencyExpression
77
{
88
public static class ExpressionExtentions
99
{
10-
private static readonly IDictionary<Type, Type> _singleParameterTypeDictionary = new Dictionary<Type, Type>();
10+
private static readonly ConcurrentDictionary<Type, Type> _singleParameterTypeDictionary = new ConcurrentDictionary<Type, Type>();
1111

1212
public static Type GetSinglePredicateExpressionArgumentType(this Type type)
1313
{
@@ -33,7 +33,7 @@ public static Type GetSinglePredicateExpressionArgumentType(this Type type)
3333

3434
private static Type CacheAndReturnType(Type type, Type objType)
3535
{
36-
_singleParameterTypeDictionary.Add(type, objType);
36+
_singleParameterTypeDictionary.AddOrUpdate(type, objType, (t,t2) => objType);
3737
return objType;
3838
}
3939
}

src/AutoMapper.Collection/AutoMapper.Collection/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.2.0.0")]
36-
[assembly: AssemblyFileVersion("1.2.0.0")]
35+
[assembly: AssemblyVersion("1.2.1.0")]
36+
[assembly: AssemblyFileVersion("1.2.1.0")]

0 commit comments

Comments
 (0)