4 ms·
I really think this depends on the situation. If you have an objet with foreign key relations to a lot of other objects then using lambda syntax is most likely
by kkoste 3y ago
I really think this depends on the situation.
If you have an objet with foreign key relations to a lot of other objects then using lambda syntax is most likely preferred:
var res = context.Objects.Include(x=> x.ChildObjects)
But if you have to do joins then definitely query syntax is much clearer. For example the join above in lambda syntax looks like this:
var query = await context.Objects
.Join(context.ObjectChildren,
obj => obj.Id,
objChild => objChild.ObjId,
(obj, objChild) => new { Obj = obj, ObjChild = objChild })
.Where(objAndObjChild => objAndObjChild.Obj.Name == "SomeName")
.ToListAsync();