LINQ to SQL Group Join
In LINQ to SQL, a Join clause with an into 'expression' is called a Group Join. In LINQ to SQL, the Group Join produces a sequence of object element based on the matching elements from both the collection.
Syntax of LINQ to SQL Group Join
The syntax of using the LINQ to SQL Group Join to get the data from multiple tables.
From the above syntax, we joined "EmployeeDetails", "Departments" tables to get the required data by using group join.
Example of LINQ to SQL Group Join
Before we start to implement LINQ to SQL group join example, first we need to create a database with required tables and map those tables to LINQ to SQL file (.dbml).
To know the process of the mapping, click on the link LINQ to SQL.
Once we create and map the required tables to .dbml file. Now we want to show the data in our application. For that, we have to do the right click on the application->Select Add->New Item->Select Web Form->Give name as Default.aspx and click ok button.
Now open the Default.aspx page and write the code as shown below:
Now open the code behind the file and write the code as shown below:
From the above example, we are trying to get the data from "EmployeeDetails" and "Departments" table using Group Join.