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

Query: Remove extension methods on IAsyncEnumerable #15983

Merged
merged 1 commit into from
Jun 6, 2019
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
440 changes: 0 additions & 440 deletions src/EFCore/EntityFrameworkEnumerableExtensions.cs

This file was deleted.

235 changes: 31 additions & 204 deletions src/EFCore/EntityFrameworkQueryableExtensions.cs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/EFCore/Query/Internal/QueryCompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public virtual Func<QueryContext, TResult> CompileQueryCore<TResult>(
IModel model,
bool async)
{
return database.CompileQuery2<TResult>(query, async);
return database.CompileQuery<TResult>(query, async);
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/EFCore/Storage/Database.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public abstract Task<int> SaveChangesAsync(
IList<IUpdateEntry> entries,
CancellationToken cancellationToken = default);

public virtual Func<QueryContext, TResult> CompileQuery2<TResult>(Expression query, bool async)
public virtual Func<QueryContext, TResult> CompileQuery<TResult>(Expression query, bool async)
{
return Dependencies.QueryCompilationContextFactory
.Create(async)
Expand Down
2 changes: 1 addition & 1 deletion src/EFCore/Storage/IDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ Task<int> SaveChangesAsync(
[NotNull] IList<IUpdateEntry> entries,
CancellationToken cancellationToken = default);

Func<QueryContext, TResult> CompileQuery2<TResult>([NotNull] Expression query, bool async);
Func<QueryContext, TResult> CompileQuery<TResult>([NotNull] Expression query, bool async);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -698,11 +698,6 @@ await AssertQuery<Gear>(
await AssertQuery<Gear>(
isAsync,
gs => gs.Where(g => ((short)g.Rank & (short)1) == 1));

// Issue#15950
//await AssertQuery<Gear>(
// isAsync,
// gs => gs.Where(g => ((char)g.Rank & '\x0001') == '\x0001'));
}

[ConditionalTheory]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,16 @@ public static Task<List<TSource>> ToListAsync<TSource>(this IQueryable source, C
{
return ((IQueryable<TSource>)source).ToListAsync(cancellationToken);
}

public static async Task<List<TSource>> ToListAsync<TSource>(this IAsyncEnumerable<TSource> source, CancellationToken cancellationToken = default)
{
var list = new List<TSource>();
await foreach (var element in source.WithCancellation(cancellationToken))
{
list.Add(element);
}

return list;
}
}
}
7 changes: 0 additions & 7 deletions test/EFCore.Tests/Extensions/QueryableExtensionsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -305,13 +305,6 @@ public async Task Extension_methods_throw_on_non_async_source()
await SourceNonAsyncEnumerableTest<int>(() => Source().ToDictionaryAsync(e => e, e => e, ReferenceEqualityComparer.Instance));
await SourceNonAsyncEnumerableTest<int>(
() => Source().ToDictionaryAsync(e => e, e => e, ReferenceEqualityComparer.Instance, new CancellationToken()));
await SourceNonAsyncEnumerableTest<int>(() => Source().ToLookupAsync(e => e));
await SourceNonAsyncEnumerableTest<int>(() => Source().ToLookupAsync(e => e, e => e));
await SourceNonAsyncEnumerableTest<int>(() => Source().ToLookupAsync(e => e, ReferenceEqualityComparer.Instance));
await SourceNonAsyncEnumerableTest<int>(() => Source().ToLookupAsync(e => e, ReferenceEqualityComparer.Instance));
await SourceNonAsyncEnumerableTest<int>(() => Source().ToLookupAsync(e => e, e => e, ReferenceEqualityComparer.Instance));
await SourceNonAsyncEnumerableTest<int>(
() => Source().ToLookupAsync(e => e, e => e, ReferenceEqualityComparer.Instance, new CancellationToken()));
await SourceNonAsyncEnumerableTest<int>(() => Source().ToListAsync());

Assert.Equal(
Expand Down