-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
[API Proposal]: Make Lookup<TKey,TElement>
publicly constructable
#62949
Comments
Tagging subscribers to this area: @dotnet/area-system-linq Issue DetailsBackground and motivationThis would allow EF Core to implement API ProposalMake current internal public static Lookup<TKey, TElement> Create<TSource>(
IEnumerable<TSource> source,
Func<TSource, TKey> keySelector,
Func<TSource, TElement> elementSelector,
IEqualityComparer<TKey> comparer)
{
}
public static Lookup<TKey, TElement> Create(
IEnumerable<TElement> source,
Func<TElement, TKey> keySelector,
IEqualityComparer<TKey> comparer)
{
} API Usagevar childLookup = await context.ChildEntities
.Where(c => Enumerable.Contains(parentIds, c.ParentId))
.ToLookupAsync(c => c.ParentId); Alternative DesignsNo response RisksNo response
|
/cc @smitpatel |
namespace System.Linq
{
public partial class Lookup<TKey, TElement>
{
public static Task<Lookup<TKey, TElement>> CreateAsync<TSource>(
IAsyncEnumerable<TSource> source,
Func<TSource, TKey> keySelector,
Func<TSource, TElement> elementSelector,
IEqualityComparer<TKey> comparer);
}
} |
I missed the review, but this seems inconsistent with the points made below. It seems to me that we can close this until dotnet/efcore#26867 can explore alternative avenues, what say you @ajcvickers? |
This issue has been marked |
Yes, the conclusion was that @smitpatel will try the custom implementation of |
Closing in that case, can revisit if the need arises. |
Background and motivation
This would allow EF Core to implement
ToLookUpAsync
in the same way we implementToDictionaryAsync
without needing to go through an intermediate data structure.See dotnet/efcore#26867
API Proposal
Make current internal
Create
methods public.API Usage
Alternative Designs
No response
Risks
No response
The text was updated successfully, but these errors were encountered: