Skip to content

Conversation

@alex-kulakov
Copy link
Contributor

As in main assembly it rewrites calls like localCollection.Contains(value) with usage of In extension method like value.In(IncludeAlgorithm.ComplexCondition, localCollection)

Fix for issue #20

Performs rewrites like
    localCollection.Contains(value) -> value.In(localCollection)
}

if (methodInfo.DeclaringType == typeof(QueryableExtensions) &&
methodInfo.Name == "In" &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better to use StringComparison.Ordinal on a hot paths like expression tree processing.

//rewrite localCollection.Contains(entity.SomeField) -> entity.SomeField.In(localCollection)
if (methodInfo.DeclaringType == typeof(Enumerable) &&
methodInfo.Name == "Contains" &&
string.Equals(methodInfo.Name, "Contains", StringComparison.OrdinalIgnoreCase) &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, Why IgnoreCase ?

@alex-kulakov alex-kulakov reopened this Jun 2, 2020
@alex-kulakov alex-kulakov merged commit d2703e1 into master Jun 2, 2020
@alex-kulakov alex-kulakov deleted the master-bulk-with-in branch August 10, 2020 07:57
alex-kulakov pushed a commit that referenced this pull request Dec 21, 2021
…ay (#33)

* Optimizing refactoring: use ArraySegment instead of allocating subarray

* Copyright lines
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants