Skip to content
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

Convert various sync calls to async #7287

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

Shane32
Copy link
Contributor

@Shane32 Shane32 commented Aug 8, 2024

Using the Shane32.Analyzers NuGet package, all implicit casts of IQuerable to IEnumerable can be detected and fixed. This PR does not add the NuGet package, but fixes many of the detected errors.

I did not attempt to fix errors within synchronous methods, such as within data migration classes.

Comment on lines +677 to +680
public static IAsyncEnumerable<T> ToAsyncEnumerable<T>(this IQueryable<T> source)
{
return AsyncExtensions.AsAsyncEnumerable(source);
}
Copy link
Contributor Author

@Shane32 Shane32 Aug 8, 2024

Choose a reason for hiding this comment

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

The existing calls to ToAsyncEnumerable(IEnumerable) were simply wrapping an IEnumerable into an IAsyncEnumerable wrapper and were not asynchronous. LinqToDb provides the AsAsyncEnumerable method to properly convert a IQueryable to IAsyncEnumerable. This new method has a tighter scope (accepting a IQueryable) and receives precedence from the compiler.

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.

2 participants