Awesome lib linq2db
https://github.com/linq2db/linq2db supports Window-Functions with LEAD
and LAG
:
from p in db.Parent
join c in db.Child on p.ParentID equals c.ParentID
select new
{
Diff = Sql.Ext
.Lag(x.time, Sql.Nulls.None)
.Over()
.PartitionBy(p.time.Date)
.OrderBy(p.time)
.ToValue()
};