I'd like to know if there's any better way to write this query:
(from a in Context.Pages
join b in Context.Visitors on a.PageID equals b.PageFK
join c in Context.Visits on b.VisitorID equals c.VisitorFK
join d in Context.Signups on c.VisitID equals d.VisitFK
where
d.DateOptinUtc.HasValue && a.UserFK == USER_ID
group d by new { a.PageID, a.DateCreated, a.BaseName, a.Name }
into g
select
new ListReport
{
DateCreated = g.Key.DateCreated,
BaseName = g.Key.BaseName,
Id = g.Key.PageID,
Name = g.Key.Name,
Optins = g.Count(),
Views =
(from h in Context.Visits
where
h.Visitors.PageFK == g.Key.PageID
select h).Count()
}).AsQueryable();
Are there any performance issues writing subqueries like these? I don't how I can get that value from the groupby.