Using the simple example below, what is the best way to return results from multiple tables using Linq to SQL?
Say I have two tables:
Dogs: Name, A
Well, if you're returning Dogs, you'd do:
public IQueryable GetDogsWithBreedNames()
{
var db = new DogDataContext(ConnectString);
return from d in db.Dogs
join b in db.Breeds on d.BreedId equals b.BreedId
select d;
}
If you want the Breed eager-loaded and not lazy-loaded, just use the appropriate DataLoadOptions construct.