我需要返回所有事件的列表以及用户可能对某个事件拥有的任何 rsvps。但是,无论我通过什么用户名,它都会返回每个 rsvp。我的 linq 查询->
return (from events in this._context.Context.Events
join rsvps in (this._context.Context.RSVPs
.Where(o=> o.UserName == userName))
on events equals rsvps.Event into re
from rsvps in re.DefaultIfEmpty()
select events);
关系是
Events.EventID = RSVPs.EventID