Skip to content

Commit 8ef08cb

Browse files
committed
Fixes after code review #1
1 parent 7c6a88e commit 8ef08cb

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

Orm/Xtensive.Orm/Orm/Providers/NameBuilder.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using System.Collections.Generic;
1010
using System.Linq;
1111
using System.Reflection;
12+
using System.Runtime.CompilerServices;
1213
using System.Security.Cryptography;
1314
using System.Text;
1415
using Xtensive.Core;
@@ -20,7 +21,6 @@
2021
using Xtensive.Orm.Weaving;
2122
using Xtensive.Reflection;
2223
using FieldInfo = Xtensive.Orm.Model.FieldInfo;
23-
using Module = System.Reflection.Module;
2424
using TypeInfo = Xtensive.Orm.Model.TypeInfo;
2525

2626
namespace Xtensive.Orm.Providers
@@ -38,15 +38,15 @@ public sealed class NameBuilder
3838
private const string ReferenceForeignKeyFormat = "FK_{0}_{1}_{2}";
3939
private const string HierarchyForeignKeyFormat = "FK_{0}_{1}";
4040

41-
private readonly ConcurrentDictionary<PropertyInfo, string> fieldNameCache =
42-
new ConcurrentDictionary<PropertyInfo, string>();
43-
private static readonly Func<PropertyInfo, string> _fieldNameCacheValueFactory =
41+
private static readonly Func<PropertyInfo, string> fieldNameCacheValueFactory =
4442
field => field.GetAttribute<OverrideFieldNameAttribute>()?.Name ?? field.Name;
4543

4644
private readonly int maxIdentifierLength;
4745
private readonly NamingConvention namingConvention;
4846
private readonly bool isMultidatabase;
4947
private readonly string defaultDatabase;
48+
private readonly ConcurrentDictionary<PropertyInfo, string> fieldNameCache =
49+
new ConcurrentDictionary<PropertyInfo, string>();
5050

5151
/// <summary>
5252
/// Gets the <see cref="Entity.TypeId"/> column name.
@@ -186,16 +186,17 @@ public string BuildFieldName(FieldDef field)
186186
return result;
187187
}
188188

189+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
189190
private string BuildFieldNameInternal(PropertyInfo propertyInfo)
190-
=> fieldNameCache.GetOrAdd(propertyInfo, _fieldNameCacheValueFactory);
191+
=> fieldNameCache.GetOrAdd(propertyInfo, fieldNameCacheValueFactory);
191192

192193
/// <summary>
193194
/// Builds the name of the field.
194195
/// </summary>
195196
/// <param name="propertyInfo">The property info.</param>
196197
public string BuildFieldName(PropertyInfo propertyInfo)
197198
{
198-
ArgumentValidator.EnsureArgumentNotNull(propertyInfo, nameof(propertyInfo));
199+
ArgumentValidator.EnsureArgumentNotNull(propertyInfo, "propertyInfo");
199200
return BuildFieldNameInternal(propertyInfo);
200201
}
201202

0 commit comments

Comments
 (0)