@@ -138,8 +138,6 @@ private ResourceContext CreateResourceContext(string publicName, Type resourceTy
138
138
139
139
private IReadOnlyCollection < AttrAttribute > GetAttributes ( Type resourceType )
140
140
{
141
- ArgumentGuard . NotNull ( resourceType , nameof ( resourceType ) ) ;
142
-
143
141
var attributes = new List < AttrAttribute > ( ) ;
144
142
145
143
foreach ( PropertyInfo property in resourceType . GetProperties ( ) )
@@ -183,8 +181,6 @@ private IReadOnlyCollection<AttrAttribute> GetAttributes(Type resourceType)
183
181
184
182
private IReadOnlyCollection < RelationshipAttribute > GetRelationships ( Type resourceType )
185
183
{
186
- ArgumentGuard . NotNull ( resourceType , nameof ( resourceType ) ) ;
187
-
188
184
var attributes = new List < RelationshipAttribute > ( ) ;
189
185
PropertyInfo [ ] properties = resourceType . GetProperties ( ) ;
190
186
@@ -309,13 +305,9 @@ private Type GetRelationshipType(RelationshipAttribute relationship, PropertyInf
309
305
return relationship is HasOneAttribute ? property . PropertyType : property . PropertyType . GetGenericArguments ( ) [ 0 ] ;
310
306
}
311
307
312
- // ReSharper disable once ParameterOnlyUsedForPreconditionCheck.Local
313
308
private IReadOnlyCollection < EagerLoadAttribute > GetEagerLoads ( Type resourceType , int recursionDepth = 0 )
314
309
{
315
- if ( recursionDepth >= 500 )
316
- {
317
- throw new InvalidOperationException ( "Infinite recursion detected in eager-load chain." ) ;
318
- }
310
+ AssertNoInfiniteRecursion ( recursionDepth ) ;
319
311
320
312
var attributes = new List < EagerLoadAttribute > ( ) ;
321
313
PropertyInfo [ ] properties = resourceType . GetProperties ( ) ;
@@ -339,6 +331,15 @@ private IReadOnlyCollection<EagerLoadAttribute> GetEagerLoads(Type resourceType,
339
331
return attributes ;
340
332
}
341
333
334
+ [ AssertionMethod ]
335
+ private static void AssertNoInfiniteRecursion ( int recursionDepth )
336
+ {
337
+ if ( recursionDepth >= 500 )
338
+ {
339
+ throw new InvalidOperationException ( "Infinite recursion detected in eager-load chain." ) ;
340
+ }
341
+ }
342
+
342
343
private Type TypeOrElementType ( Type type )
343
344
{
344
345
Type [ ] interfaces = type . GetInterfaces ( )
0 commit comments