Saturday, August 16, 2008

[Tutorial] ADO.NET Entity Framework
Part 3 - Accessing data and using LINQ (2/2)

The last part showed how to use LINQ in combination with the Entity Framework. This part explains how to trace the automatically generated SQL statements that are executed in the background. You need to have the correctly configured project from the last part as prerequisite for the following examples.

  • Cast the query object into an "ObjectQuery<Product>" for being able to access the "ToTraceString()" function.

  • Run the application and you will get the following output.

  • Now change the LINQ query so that there are additional constraints.

  • Run the application again to compare the differences in the generated SQL statements.


  • Now add a Lambda expression to see what type of SQL statements are generated in this case.

  • Run the application and you will get the following output.



Share/Save/Bookmark

1 comment:

Unknown said...

Thank you for creating the training series for ADO.NET Entity Framework. Appreciate very much.