Hello, I'm trying to figure out the best way to handle a simple problem: I have a simple LINQ join to two tables. I know how to return the type for one table, since it is the same as the generated dbml class. However, what if I want to return data from both tables- isn't there a way to return both and use their relationships? Do I really have to create another return type to return the data from both tables? FYI- I don't want to return an output parameter with the other table object; I'm also not really interested in returning an anonymous type. What is the best practice recommendation?
public IQueryable<Consumer_Question> GetQuestions(int subCategoryId)
{
//create DataContext
MototoolsDataContext mototoolsDataContext = new MototoolsDataContext();
mototoolsDataContext.Log = Console.Out;
var subcategoriestag = (from subCatTag in mototoolsDataContext.Consumer_SubCategoriesTags
join tagQuestion in mototoolsDataContext.Consumer_TagQuestions on subCatTag.TagID equals tagQuestion.TagID
join question in mototoolsDataContext.Consumer_Questions on tagQuestion.QuestionsID equals question.ID
where subCatTag.SubCategoriesID == subCategoryId
orderby subCatTag.ID descending
select question);
//select new { question, tagQuestion });
return subcategoriestag;
}
Thanks for any help,