Have you created a relationship between your tables in SQL Server???
On Tue, Mar 31, 2009 at 4:55 PM, eddiec <[email protected]> wrote: > > Hi, > > I have added a SQL Server - LINQ item to my C# asp project and have > created classes that correspond to the tables in my database. > > This has automatically created classes that map to the tables in the > database. I can instantiate instances of the classes that map directly > to a table: > var Orders = > from c in context.Orders > where (c.OrderID.Equals(intCurrentOrder)) > select c; > > Can someone please advise me how I can create an object / class where > the class has attributes that are a join of two tables. (The Order > object should contain Line Items. In the database the Orders table and > LineItems table has a 1:M join.) > > For example, I have classes Order and LineItem that have been created > automatically through LINQ. Do I need to create a new Order class that > inherits from the Order class created automatically by LINQ and that > contains an array LineItems? > > cheers, > > eddiec :-)
