1

I'm getting lost down the rabbit-hole of EF and Lambdas. I'm trying to get all records from across linking tables.

I'm pretty sure my question is answered here but I can't work out how to apply the answer to my situation.

Here's a simplified model layout of my db.

Simplified DB Model

I'm trying to get a list of all the Speakers for a given event but can't work out how to build the Linq / Lambdas.

To be clear:

  • An Event can have zero, one or many Sessions
  • A Session can have zero, one or many Speakers
  • A Speaker can talk in more than one Session or Event

Any help?

Craig Poole
  • 740
  • 8
  • 19

1 Answers1

1

Typically after staring at the problem for over an hour and then posting here I think I've worked it out.

context.SessionSpeakers.Where(x => x.Session.EventId == odv.EventId).Select(x => x.Speaker);

I'll leave this here in case this helps someone else or anyone wants to offer a better answer.

Craig Poole
  • 740
  • 8
  • 19