Reputation: 1455
I have two tables (and a joining table)
Fruit -> Schedule
A fruit can have many schedules and a schedule can have many fruits.
I need a linq query using the repository pattern to join them, how do I do this?
var query = from p in _fruitRepository.Table
join s in _scheduleRepository.Table on p.[SomeProperty] on s.[SomeProperty]
Thanks :)
Upvotes: 0
Views: 87
Reputation: 125630
You should have Schedules
navigation property in your Fruit
class. Us it:
var items = from f in _context.Fruits
from s in f.Schedules
select new { f, s }
Upvotes: 2