I am using ASP.NET MVC framework and accessing DB records with Entities. I am doing some joins like this:
public IQueryable<...> GetThem()
{
var ords = from o in db.Orders
join c in db.Categories on o.CategoryID equals c.ID
select new {Order=o, Category=c};
return ords;
}
I need to use/pass 'ords' from one function to other in a strongly-typed manner. (I will be doing this kind of joins in multiple places.)
What is the best way to do this? Do I need create a new class containing both returned vals for every join I do? Eg: public class OrderAndCategory { public Order; public Category; } in this case.
Is there any simpler way?
Thanks!