Last active
October 29, 2020 07:08
-
-
Save mr5z/f95e56cc91690bee4c14a4323b64c0d2 to your computer and use it in GitHub Desktop.
Convert loop in a single query
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foreach(var entry in caveQuery) | |
{ | |
var pointQuery = | |
from path in context.Path | |
join cave in context.Cave on path.CaveId equals cave.Id | |
join point in context.Point on path.Id equals point.PathId | |
where cave.Id == entry.Id | |
select new PointDto | |
{ | |
X = point.X, | |
Y = point.Y, | |
Dx = point.Dx, | |
Dy = point.Dy | |
}; | |
entry.Path.Points = pointQuery.ToList(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment