@@ -19,9 +19,11 @@ namespace Xtensive.IoC
19
19
[ Serializable ]
20
20
public sealed class ServiceRegistration
21
21
{
22
- private static readonly ConcurrentDictionary < ServiceRegistrationKey , ServiceRegistration [ ] > serviceRegistrationsByType =
22
+ private static readonly ConcurrentDictionary < ServiceRegistrationKey , ServiceRegistration [ ] > ServiceRegistrationsByType =
23
23
new ConcurrentDictionary < ServiceRegistrationKey , ServiceRegistration [ ] > ( ) ;
24
24
25
+ private static readonly Func < ServiceRegistrationKey , ServiceRegistration [ ] > ServiceRegistrationsExtractor = ServiceRegistrationsExtractorImpl ;
26
+
25
27
/// <summary>
26
28
/// Gets the type of the service.
27
29
/// </summary>
@@ -74,11 +76,12 @@ public static ServiceRegistration[] CreateAll(Type type) =>
74
76
/// An array of <see cref="ServiceRegistration"/> objects.
75
77
/// </returns>
76
78
public static ServiceRegistration [ ] CreateAll ( Type type , bool defaultOnly ) =>
77
- serviceRegistrationsByType . GetOrAdd ( new ServiceRegistrationKey ( type , defaultOnly ) , ServiceRegistrationsExtractor ) ;
79
+ ServiceRegistrationsByType . GetOrAdd ( new ServiceRegistrationKey ( type , defaultOnly ) , ServiceRegistrationsExtractor ) ;
78
80
79
- private static readonly Func < ServiceRegistrationKey , ServiceRegistration [ ] > ServiceRegistrationsExtractor = ( ( Type type , bool defaultOnly ) t ) => {
81
+ private static ServiceRegistration [ ] ServiceRegistrationsExtractorImpl ( ServiceRegistrationKey t )
82
+ {
80
83
( var type , var defaultOnly ) = t ;
81
- ArgumentValidator . EnsureArgumentNotNull ( type , " type" ) ;
84
+ ArgumentValidator . EnsureArgumentNotNull ( type , nameof ( type ) ) ;
82
85
if ( type . IsAbstract )
83
86
return Array . Empty < ServiceRegistration > ( ) ;
84
87
@@ -90,8 +93,7 @@ public static ServiceRegistration[] CreateAll(Type type, bool defaultOnly) =>
90
93
}
91
94
}
92
95
return registrations . ToArray ( ) ;
93
- } ;
94
-
96
+ }
95
97
96
98
// Constructors
97
99
0 commit comments