Я нашел ответ, используя лямбда-запрос, как показано ниже.
var no_ctivities = db.Activities
.Join(
db.Enrollments,
ac => ac.ActivityId,
en => en.ActivityId,
(enr, act) => new { en = enr, ac = act })
.Join(
db.Participants.Where(pr => pr.ParticipantId == id),
en => en.ac.ParticipantId,
prt => prt.ParticipantId,
(enr, prt) => new { enr.ac.PostTestScore1, enr.ac.PostTestScore2, enr.ac.ActivityId, enr.ac.AttendFirstday, enr.ac.AttendSecondDay })
.Select(c => new
{
c.ActivityId,
c.PostTestScore1,
c.PostTestScore2,
c.AttendFirstday,
c.AttendSecondDay
}).count();