Skip to content

Minor tweaks to improve code readability #1723

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/JsonApiDotNetCore/Configuration/TypeLocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,16 @@ internal sealed class TypeLocator
$"instead of {interfaceTypeArguments.Length}.", nameof(interfaceTypeArguments));
}

return assembly.GetTypes().Select(type => GetContainerRegistrationFromType(type, unboundInterface, interfaceTypeArguments))
// @formatter:wrap_chained_method_calls chop_always
// @formatter:wrap_before_first_method_call true

return assembly
.GetTypes()
.Select(type => GetContainerRegistrationFromType(type, unboundInterface, interfaceTypeArguments))
.FirstOrDefault(result => result != null);

// @formatter:wrap_before_first_method_call restore
// @formatter:wrap_chained_method_calls restore
}

private static (Type implementationType, Type serviceInterface)? GetContainerRegistrationFromType(Type nextType, Type unboundInterface,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,21 @@ private void RecursiveRewriteFilterInLayer(QueryLayer queryLayer)

if (queryLayer.Selection is { IsEmpty: false })
{
foreach (QueryLayer? nextLayer in queryLayer.Selection.GetResourceTypes().Select(queryLayer.Selection.GetOrCreateSelectors)
.SelectMany(selectors => selectors.Select(selector => selector.Value).Where(layer => layer != null)))
// @formatter:wrap_chained_method_calls chop_always
// @formatter:keep_existing_linebreaks true

foreach (QueryLayer? nextLayer in queryLayer.Selection
.GetResourceTypes()
.Select(queryLayer.Selection.GetOrCreateSelectors)
.SelectMany(selectors => selectors
.Select(selector => selector.Value)
.Where(layer => layer != null)))
{
RecursiveRewriteFilterInLayer(nextLayer!);
}

// @formatter:keep_existing_linebreaks restore
// @formatter:wrap_chained_method_calls restore
}
}
}
Loading