public class Payment
{
[Key]
public int doc_number{ get; set; }
public int? parrent_doc_number{ get; set; }
public virtual Payment parrent { get; set; }
или
public virtual Payment parrent_ { get; set; }
public virtual ICollection ChildPayments { get; set; }
}
public static class Helper{
public static int? GetWorkingTime(this MyContext context){
var query = (from e in context.events
join a in context.actions on e.CurrEventID equals a.CurrEventID into es
from p in es.DefaultIfEmpty()
select new { UnitDate = e.ActionDate, UnitId = e.CurrEventID, HeaderID = p.HeaderID, IsDone = p.MarkerOn, Begin = e.BeginTime, End = e.EndTime })
.Where(w => w.HeaderID == this.HeaderID)
.Where(w => w.IsDone == true && w.Begin<w.UnitDate && w.UnitDate<w.End )
.Distinct()
.Select(s => DbFunctions.DiffMinutes(s.Begin, s.End)).Sum();
return query ?? 0;
}
}