Skip to content

Commit 59f0c24

Browse files
committed
Move static property to the top of the class
+ instead of inline init of static field (no closure type, but IL is the same) + name violation fixed
1 parent 88d6b57 commit 59f0c24

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

Orm/Xtensive.Orm/IoC/ServiceRegistration.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ namespace Xtensive.IoC
1919
[Serializable]
2020
public sealed class ServiceRegistration
2121
{
22-
private static readonly ConcurrentDictionary<ServiceRegistrationKey, ServiceRegistration[]> serviceRegistrationsByType =
22+
private static readonly ConcurrentDictionary<ServiceRegistrationKey, ServiceRegistration[]> ServiceRegistrationsByType =
2323
new ConcurrentDictionary<ServiceRegistrationKey, ServiceRegistration[]>();
2424

25+
private static readonly Func<ServiceRegistrationKey, ServiceRegistration[]> ServiceRegistrationsExtractor = ServiceRegistrationsExtractorImpl;
26+
2527
/// <summary>
2628
/// Gets the type of the service.
2729
/// </summary>
@@ -74,11 +76,12 @@ public static ServiceRegistration[] CreateAll(Type type) =>
7476
/// An array of <see cref="ServiceRegistration"/> objects.
7577
/// </returns>
7678
public static ServiceRegistration[] CreateAll(Type type, bool defaultOnly) =>
77-
serviceRegistrationsByType.GetOrAdd(new ServiceRegistrationKey(type, defaultOnly), ServiceRegistrationsExtractor);
79+
ServiceRegistrationsByType.GetOrAdd(new ServiceRegistrationKey(type, defaultOnly), ServiceRegistrationsExtractor);
7880

79-
private static readonly Func<ServiceRegistrationKey, ServiceRegistration[]> ServiceRegistrationsExtractor = ((Type type, bool defaultOnly) t) => {
81+
private static ServiceRegistration[] ServiceRegistrationsExtractorImpl(ServiceRegistrationKey t)
82+
{
8083
(var type, var defaultOnly) = t;
81-
ArgumentValidator.EnsureArgumentNotNull(type, "type");
84+
ArgumentValidator.EnsureArgumentNotNull(type, nameof(type));
8285
if (type.IsAbstract)
8386
return Array.Empty<ServiceRegistration>();
8487

@@ -90,8 +93,7 @@ public static ServiceRegistration[] CreateAll(Type type, bool defaultOnly) =>
9093
}
9194
}
9295
return registrations.ToArray();
93-
};
94-
96+
}
9597

9698
// Constructors
9799

0 commit comments

Comments
 (0)