views:

25

answers:

2

Hello,

Linq commands are translated into transact-sql statements. I've VS2008 professional. How and where can I see how this majic happens? (by debugging?)

EDIT

Let's say I have this

var allProducts = db.Products;

I guess this will be translate by

SELECT * FROM Products

Where can I look at to see that? For instance, when I debug my code, I can see on the bottom are changing value each time I press f10. Is there something like that in vs2008 for linq command?

Thanks for helping

+2  A: 

You can use the Log property on the DataContext object.

Janus Tøndering
I'm not sure if Richard77 intends to see how the SQL generation works or if he wants to log the generated SQL.
Florian Reischl
Yeah, I could have misunderstood his intentions...
Janus Tøndering
Myself, I agree that I didn't state clearly my thoughts. So, see the edit above. The idea is to show to my friend that all linq does is translating linq commands into transact-sql. He keeps writing raw transact-sql (which is not bad but he needs to know the alternatives too)
Richard77
@Florian Reischl:Thanks.
Richard77
+1  A: 

You can configure VS to step into .NET source code:

Configuring Visual Studio to Debug .NET Framework Source Code

Greets Flo

Florian Reischl