I am new to the MVC/Linq party (coming from Java).
I know that I can use something like the following to get strongly typed access, but what about if I want to use a join in my linq query?
public void IQueryable<Product> GetItems(int CategoryID)
{
…linq query…
}enter code here
In your example, if you have used the designer to create your Linq to SQL data context, and there is a foreign key relationship between the Product and Category tables in your database, then the Category will be a property in your Product class, so there is no need to join them.
Something along the lines of the following should help (guessing property names; db is your data context):
Or if you are not comfortable with the lambda syntax, then the following is synonymous:
The Product class has a Category property, providing strongly typed access to all of the properties in category. You would use something like product.Category.Name to get the category name for example.
Also, there are a plethora of good Linq to SQL tutorials out there. Try the following:
http://it-box.blogturk.net/2007/10/19/linq-to-sql-tutorial-series-by-scott-guthrie-pdf-book-format/
http://www.hookedonlinq.com/LINQtoSQL5MinuteOverview.ashx