Skip to content

Instantly share code, notes, and snippets.

@mr5z

mr5z/CaveAndPoints.cs

Last active Oct 29, 2020
Embed
What would you like to do?
Convert loop in a single query
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
You can’t perform that action at this time.