Skip to content

Commit

Permalink
Query: Remove extension methods on IAsyncEnumerable
Browse files Browse the repository at this point in the history
Remove test for #15950
Remove ToLookup API for #15916
Resolves #15924
  • Loading branch information
smitpatel committed Jun 6, 2019
1 parent 9e0fb47 commit e9fb676
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 659 deletions.
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

0 comments on commit e9fb676

Please sign in to comment.