When creating an object class from an SQL database using the LINQ to SQL tool in Visual Studio 2008, SQL table relationships get mapped to object relationships. For example lets say I have a database with a "Customers" table and an "Orders" table and there is a foreign key relationship between the two tables. When I use LINQ to SQL to create a C# class library for this database I will end up with two data classes; Customer and Order. The nice thing is that LINQ will automatically create a parent/child realtionship between the two data classes (because of the foreign key relationship in the DB). The LINQ generated Customer data class might look something like this:
Customer:
FirstName
LastName
Address
Orders
where the "Orders" property is actually a data collection that is related to the parent Customer record. When populating an instance of the "Customer" object (call it aCustomer) LINQ will automatically do the heavy lifting of retrieving the related "Orders" collection, all we have to do is reference aCustomer.Orders and we have all the order records for that customer.
So now my question: when setting up a Telerik grid using a LINQ datasource with the 'Customer' object being the <mastertable> data, can I use the 'Customer.Orders' column as the datasource for an embeded <detailstable>?
Thanks,
Stephen
Customer:
FirstName
LastName
Address
Orders
where the "Orders" property is actually a data collection that is related to the parent Customer record. When populating an instance of the "Customer" object (call it aCustomer) LINQ will automatically do the heavy lifting of retrieving the related "Orders" collection, all we have to do is reference aCustomer.Orders and we have all the order records for that customer.
So now my question: when setting up a Telerik grid using a LINQ datasource with the 'Customer' object being the <mastertable> data, can I use the 'Customer.Orders' column as the datasource for an embeded <detailstable>?
Thanks,
Stephen