You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some complex situation, the LINQ query will be loss the readability and hard to maintain.
so it would be better if the LINQ query syntax improved like below.
allow more condition expression in the join clause. the equals expression is the only choice nowdays.
fromlinEntityList
join rinEntityList on l.ParentId==r.ParentId&&l.Id>r.Idselect r
allow left join clause in LINQ to let the query more simplify .
fromlinEntityListleft join r in EntityList on l.ParentId == r.ParentId && l.Id > r.Id
select r
I'm not good at English, but hope you guys understand what I'm saying. 😄
The text was updated successfully, but these errors were encountered:
For the first example proposed:
In terms of LINQ to Objects the current semantics of the join clause are that it does not enumerate the right sequence for each item in the left sequence. Instead it produces the keys used in the equals clause a single time for each sequence and correlates items accordingly.
This has two nice properties:
It improves performance when items only need to be correlated thusly.
It may improve readability in these cases by highlighting the simplicity of the correlation. This can be especially true for scenarios which perform ad hoc correlations.
Continuing with LINQ to Objects, the first example proposed:
fromlinEntityList
join rinEntityList on l.ParentId==r.ParentId&&l.Id>r.Idselect r
Would currently quite clearly written as either:
fromlinEntityListfromrinEntityListwherel.ParentId==r.ParentId&&l.Id>r.Idselect r
or, if we want potentially better performance*:
fromlinEntityList
join rinEntityList on l.ParentId equals r.ParentIdwherel.Id>r.Idselect r
Either option is very readable in my opinion.
*note that equals and == can behave differently for some types
My reason for the above statements is to clarify the nature of the first part of the feature request.
Is it because that you find join on x == y && a > b more readable than the currently available options?
The reason I am specifying Linq to Objects is that an external query provider, such as LINQ to SQL is free to optimize the multiple from clauses into a compound join if it so chooses.
In the second example:
fromlinEntityListleft join r in EntityList on l.ParentId == r.ParentId && l.Id > r.Id
select r
I think this could be useful as it could clean up or clarify some code that currently look something like this:
Although I think it would be better to add query expression support for more generalized cases as is proposed in #100 Extend LINQ syntax.
Update: Actually left join syntax is also already proposed in #100.
In some complex situation, the LINQ query will be loss the readability and hard to maintain.
so it would be better if the LINQ query syntax improved like below.
allow more condition expression in the join clause. the equals expression is the only choice nowdays.
allow left join clause in LINQ to let the query more simplify .
I'm not good at English, but hope you guys understand what I'm saying. 😄
The text was updated successfully, but these errors were encountered: