SQL To LinQ do you know ?, Sqllinq
You should have used the linQ to SQL tool LinQPad when learning LinQ. It was used at the beginning and is not very familiar with it. What should I do if it involves multi-table queries and does not write a LinQ statement?
This is not a problem. Next we will introduce another tool, SQL to LinQ. SQL has been learned for a long time. It is often used in system development. It should be familiar with SQL statements.
Open SQL Server 2008 and create a new query. I want to match the information in the three tables one by one, and as long as the information of the fields I want, the SQL statement:
SELECT [t2].[VirtualExamRoomId], [t2].[VirtualExamRoomName], [t0].[ExamId], [t0].[ExamName], [t1].[ExamineeExamId], [t1].[ExamineeName]FROM [ExamExamEntity] AS [t0], [ExamExamineeExamEntity] AS [t1], [ExamExamRoomPlanEntity] AS [t2]WHERE ([t0].[ExamId] = [t1].[ExamExamEntityExamId]) AND ([t1].[ExamExamRoomPlanEntityVirtualExamRoomId] = [t2].[VirtualExamRoomId])
Run the command to display the fields in the three tables I want:
Then, open SQL to LinQ, Tools -- Linqer Connections, and create a connection:
Select Add:
Set the database to be connected,
Select LinQ to Entities:
Create a file and put it in a folder:
Confirm, copy the SQL statement to the SQL box on the left, select the Connection you just created from the Connection on the top, and execute it. Then the corresponding LinQ statement will be displayed on the right:
Copy the LinQ statement to LinqPad and run:
Perfect !!!, Make good use of tools to improve development efficiency!