LINQ to SQL Debug Visualizer

Probably the biggest programming model improvement being made in .NET 3.5 is the work being done to make querying data a first class programming concept.  We call this overall querying programming model "LINQ", which stands for .NET Language Integrated Query.  Developers can use LINQ with any data source, and built-in libraries are included with .NET 3.5 that enable LINQ support against Objects, XML, and Databases.

Earlier this summer I started writing a multi-part blog series that discusses the built-in LINQ to SQL provider in .NET 3.5.  LINQ to SQL is an ORM (object relational mapping) implementation that allows you to model a relational database using .NET classes.  You can then query the database using LINQ, as well as update/insert/delete data from it.  LINQ to SQL fully supports transactions, views, and stored procedures.  It also provides an easy way to integrate data validation and business logic rules into your data model.

You can learn more about LINQ to SQL by reading my posts below (more will be coming soon):

Using the LINQ to SQL Debug Visualizer

One of the nice development features that LINQ to SQL supports is the ability to use a "debug visualizer" to hover over a LINQ expression while in the VS 2008 debugger and inspect the raw SQL that the ORM will ultimately execute at runtime when evaluating the LINQ query expression.

For example, assume we write the below LINQ query expression code against a set of data model classes:

We could then use the VS 2008 debugger to hover over the "products" variable after the query expression has been assigned:

And if we click the small magnifying glass in the expression above, we can launch the LINQ to SQL debug visualizer to inspect the raw SQL that the ORM will execute based on that LINQ query:

If you click the "Execute" button, you can even test out the SQL query and see the raw returned results that will be returned from the database:

This obviously makes it super easy to see precisely what SQL query logic LINQ to SQL ORM is doing for you. 

You can learn even more about how all this works by reading the Part 3: Querying our Database segment in my LINQ to SQL series above.

How to Install the LINQ to SQL Debug Visualizer

The LINQ to SQL Debug Visualizer isn't built-in to VS 2008 - instead it is an add-in that you need to download to use.  You can download a copy of it here.

The download contains both a binary .dll assembly version of the visualizer (within the \bin\debug directory below), as well as all of the source code for the visualizer:

To install the LINQ to SQL debug visualizer, follow the below steps:

1) Shutdown all running versions of Visual Studio 2008

2) Copy the SqlServerQueryVisualizer.dll assembly from the \bin\debug\ directory in the .zip download above into your local \Program Files\Microsoft Visual Studio 9.0\Common7\Packages\Debugger\Visualizers\ directory:

3) Start up Visual Studio 2008 again.  Now when you use the debugger with LINQ to SQL you should be able to hover over LINQ query expressions and inspect their raw SQL (no extra registration is required).

Hope this helps,

Scott

Published Tuesday, July 31, 2007 10:23 PM by ScottGu

Comments

# re: LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 1:39 AM by Steven Nagy

Of course it helps. Everything you do helps.

# re: LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 1:47 AM by Andrej

Hello Scott,

thank you! But I'm wondering if it's so easy to extend the studio for debugging, why don't you put in also more refactoring while designing? The VS is very basic in this recard, see the resharper as an example(www.jetbrains.com/resharper), it would be so cool to have all the refactoring w/out needing 3rd parties for basic use cases like relocating classes, searching for files, class shortcuts etc. etc. To refactor a bigger project using VS w/out some additional tool hurts.

Thank you,

Andrej

# re: LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 2:00 AM by Al Pascual

I'm loving this VS2008 series as I'm testing the new build this week. Thanks Scott

Cheers

Al

# re: LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 2:32 AM by ScottGu

Hi Andrej,

>>>>> thank you! But I'm wondering if it's so easy to extend the studio for debugging, why don't you put in also more refactoring while designing? The VS is very basic in this recard, see the resharper as an example(www.jetbrains.com/resharper), it would be so cool to have all the refactoring w/out needing 3rd parties for basic use cases like relocating classes, searching for files, class shortcuts etc. etc. To refactor a bigger project using VS w/out some additional tool hurts.

I definitely hear you on refactoring - that is something Visual Studio is planning on improving considerably in the future.  In VS 2008 a lot of the base work was done with the code model engines to enable much richer refactoring - with the next release of VS you should see considerable improvements there.

I do also highly recommend resharper - it is really an invaluable tool and well worth buying.

Thanks,

Scott

# re: LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 2:53 AM by Lenny76

Hi Scott,

maybe this is a stupid question, but I've not yet found a "supported databases by linq" page.

which databases linq support? is MS Access supported for example?

bye

Lenny76

# re: LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 3:29 AM by Kangnoz

Hi Scott,

Do you have a plan for beta 3?If you have,when is it release?Or what is the next edition of vs2008?

# re: LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 4:10 AM by Zin Ko Aung

I am wondering performance issue while using LINQ. Is there any performance issue between using LINQ and without using LINQ?

# re: LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 4:25 AM by Kangnoz

Continue above,why I can't find "JavaScript" item in "tools-options-TextEditor"?

# re: LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 4:44 AM by Mike

I think you might as well make the visualizer a part of the standard install for VS 2008.

With all the talk about LINQ to SQL I'm not sure I understand this: is there no LINQ to Access, or LINQ to Oracle? Or is that not the way it works?

# re: LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 4:45 AM by James Spibey

Does this only work in C#? I have it working in C# but in VB.Net the visualiser just shows the results of the query

# re: LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 5:16 AM by Ralf Ehlert

It works great with C# but have anybody an idea why isn't this visulizer doesn't work with VB?

# re: LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 5:40 AM by Boris Yeltsin's Zombie

Hey Scott,

How is this implemented?

Any pointers on how to implement this on my own LINQ provider?

Thanks again,

Zombie

# Using LINQ to SQL

Wednesday, August 01, 2007 6:08 AM by Hannes's Mind Maze

Hi, Scott Guthrie, wrote a series of blog posts titled “ Using LINQ to SQL ”. Go have a look here . To

# re: LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 7:20 AM by PBZ

Is this going to be in the RTM?

# re: LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 7:40 AM by Thomas H. Lanier

Is there a way to debug the LINQ code being executing within the LinqDataSource? When I try to duplicate your seemingly simple demos with timestamp fields added, I get various errors. Is there a way see the source code being executed behind the scenes to understand what is causing the errors?

# re: LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 7:51 AM by Christian

Hi Scott,

I tried installing the visualizer on a 64 bit system, without much luck unfortunately.

I dropped the dll in both of the following location:

C:\Program Files\Microsoft Visual Studio 9.0\Common7\Packages\Debugger\x86

C:\Program Files\Microsoft Visual Studio 9.0\Common7\Packages\Debugger\X64

You got any suggetions to what the problem might be.

Brgds.

Christian

# re: LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 8:48 AM by Bilal Haidar [MVP]

Hi Scott,

There was a DataShape and Include methods in Beta 1 that were used when we don't want to allow deferred loading! what happened to this object/Method in Beta 2? is there an online place to check changes?

Thanks

# re: LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 8:51 AM by Vikram

Another good blog on LINQ to SQl. But can we have a project download we are using the LINQ to SQl in the data acces layer.

What will be the data type that I will pass back when I am using a LINQ query in a function.(I want to return the value retrieved from the LINQ query back)

In the same condition above if I want to send only 2 of the 4 column what data type to be used to return the value of the LINQ query?

# re: LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 9:54 AM by Ryan Ternier

Hey Scott,

How does the performance of LINQ stand against running a SQL QUery that returns a result set saved to an IList?

I'm thinking in turns of, if 1,000 of these statements were ran every second, which one would be faster, and use less memory?

Thanks,

Ryan.

# re: LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 10:04 AM by Joe Rattz

Any reason this is not part of the VS 2008 install?  Will it be at some point in the future?

Thanks.

# re: LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 10:18 AM by Ben Hayat

Hi Scott;

>>- with the next release of VS you should see considerable improvements there.<<

When you say "Next release", are you referring to Beta 3 or RC or RTM or are you referring to future major upgrades like VS2009 0r VS2010?

I thought you had mentioned (long time ago) that you're more likely going to do videos than blog. Or hopefully someone else will do some lengthy videos on datacontext, and all the relevant info like locking, transaction, life span of DC, "Events" and so on. Do you know if any thing is cooking for a series of formal Linq videos?

Thanks!

# re: LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 10:34 AM by Scott Gurvey

I've now got my data context suppling data to a data grid view in a windows forms project. Can i use it to supply data to a WPF Grid in a WPF project?

# re: LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 10:53 AM by ScottGu

Hi Zin,

>>>>>> I am wondering performance issue while using LINQ. Is there any performance issue between using LINQ and without using LINQ?

LINQ to SQL is very fast.  If you are surfacing an object model for your data (meaning creating objects to represent relational data), I think you'll find LINQ to SQL is about as efficient as if you did it completely by hand.

If you use a compiled LINQ to SQL query, you'll find with beta2 that it is about 93% the performance of iterating over a raw SQLDataReader object: blogs.msdn.com/.../linq-to-sql-rico-drops-the-other-shoe.aspx

Hope this helps,

Scott

# re: LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 10:57 AM by ScottGu

Hi Mike,

>>>>>>> I think you might as well make the visualizer a part of the standard install for VS 2008.

We wanted to have the debub visualizer built-in, but unfortunately due to time we won't be able to.  Instead we'll continue to make it available as a separate free download with full source code.

Hope this helps,

Scott

# re: LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 10:59 AM by ScottGu

Hi Boris,

>>>>>> How is this implemented?

The source code for the debug visualizer can be downloaded above - so you'll be able to see exactly how it is implemented. :-)

>>>>>>> Any pointers on how to implement this on my own LINQ provider?

Matt Warren from the LINQ to SQL team has recently completed an outstanding two part series on how to build a custom LINQ provider.  You can read about it here:

blogs.msdn.com/.../linq-building-an-iqueryable-provider-part-i.aspx

blogs.msdn.com/.../linq-building-an-iqueryable-provider-part-ii.aspx

Hope this helps,

Scott

# re: LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 11:19 AM by ScottGu

Hi Bilal,

>>>>>> There was a DataShape and Include methods in Beta 1 that were used when we don't want to allow deferred loading! what happened to this object/Method in Beta 2? is there an online place to check changes?

The DataContext has a LoadOptions property that allows you to specify loading behavior when using the DataContext.  Specifically, it allows you to indicate whether to use deferred or eager loading for associations.

I'll cover how to use this more in a future blog post.

Thanks,

Scott

# re: LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 11:20 AM by ScottGu

Hi Ryan,

>>>>>>> How does the performance of LINQ stand against running a SQL QUery that returns a result set saved to an IList?  I'm thinking in turns of, if 1,000 of these statements were ran every second, which one would be faster, and use less memory?

LINQ to SQL is very fast.  If you are surfacing an object model for your data (meaning creating objects to represent relational data), I think you'll find LINQ to SQL is about as efficient as if you did it completely by hand.

If you use a compiled LINQ to SQL query, you'll find with beta2 that it is about 93% the performance of iterating over a raw SQLDataReader object: blogs.msdn.com/.../linq-to-sql-rico-drops-the-other-shoe.aspx

Hope this helps,

Scott

# re: LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 11:25 AM by ScottGu

Hi Vikram,

>>>>>> What will be the data type that I will pass back when I am using a LINQ query in a function.(I want to return the value retrieved from the LINQ query back).  In the same condition above if I want to send only 2 of the 4 column what data type to be used to return the value of the LINQ query?

You can indicate what data type you want to return from a LINQ query expression using the "select" clause of the LINQ query expression statement.  For example, you could say:

IEnumerable<MyFoo> products = from p in northwind.Products

                             where p.Category.CategoryName == "Beverages"

                             select new MyFoo {

                                 ID = p.ProductID,

                                 Name = p.ProductName

                             };

This would give you back a sequence of objects of type "MyFoo".  You could then pass this back from any method you are in.

Hope this helps,

Scott

# re: LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 11:26 AM by ScottGu

Hi Scott,

>>>>>>> I've now got my data context suppling data to a data grid view in a windows forms project. Can i use it to supply data to a WPF Grid in a WPF project?

Yep - you can also databind the results of LINQ expressions to WPF controls.  There isn't a built-in datagrid in WPF, but you can use the ListBox control with databinding expressions on this.  I have it on my list of things to-do to cover this in a future blog post.

Hope this helps,

Scott

# re: LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 11:28 AM by ScottGu

Hi Ben,

>>>>>> When you say "Next release", are you referring to Beta 3 or RC or RTM or are you referring to future major upgrades like VS2009 0r VS2010?

For major refactoring improvements I was thinking the next release of VS (which doesn't currently have a name).  Unfortunately we won't be able to get those before RTM of VS 2008.

>>>>>>> I thought you had mentioned (long time ago) that you're more likely going to do videos than blog. Or hopefully someone else will do some lengthy videos on datacontext, and all the relevant info like locking, transaction, life span of DC, "Events" and so on. Do you know if any thing is cooking for a series of formal Linq videos?

It is on my list of things todo. :-)  In the meantime, I'd also definitely recommend checking out the samples and whitepapers on the C# dev center on MSDN: msdn2.microsoft.com/.../default.aspx as well as the VB dev center on MSDN: msdn2.microsoft.com/.../default.aspx

They both have a lot of great content on LINQ and LINQ to SQL.

Hope this helps,

Scott

# re: LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 11:30 AM by ScottGu

Hi Thomas,

>>>>>> Is there a way to debug the LINQ code being executing within the LinqDataSource? When I try to duplicate your seemingly simple demos with timestamp fields added, I get various errors. Is there a way see the source code being executed behind the scenes to understand what is causing the errors?

Unfortunately I haven't found a good way to use the debug visualizer with the LinqDataSource.  What I sometimes do to watch update statements is to fire up the SQL profiler and keep it in trace mode in the background.  I can then look at the changes there.

Can you send me an email (scottgu@microsoft.com) about the schema for the table with the timestamp issue?  I can then take a look and get it working for you.

Thanks,

Scott

# re: LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 11:31 AM by ScottGu

Hi Ralf,

>>>>>> It works great with C# but have anybody an idea why isn't this visulizer doesn't work with VB?

Sorry about that - I just assumed it worked with VB.  I have mail out to the VB team to understand why this isn't showing up.  We should be able to get a fix.

Thanks,

Scott

# re: LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 11:32 AM by ScottGu

Hi Christian,

>>>>>>> I tried installing the visualizer on a 64 bit system, without much luck unfortunately.

I've got some mail out to folks who understand better how debug visualizers should be installed on x64 systems.  I'll let you know once I hear back from them.

Thanks,

Scott

# re: LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 11:33 AM by Mehfuz Hossain

Sql Visualizer , surely rocks in terms of debugging LINQ queries, it reminds me of Sql Profiler in right in Visual studio.

In addition , i want to ask, the queries generated by LINQ, how can i optimize that more, let say,i want to select some products on basis of a fixed criteria, and i know that Index A has the best coverrge, how can i forcely specify the index, right in LINQ query?Will there be something like the following in future.

var query = from p in db.Products

           where p.OrderDetails.Count > 5

           with index p.OrderDetail_Index

           select p;

Also it will be nicer to know , how to implement , RANK, CTE , using LINQ

# re: LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 11:43 AM by Ryan Ternier

|Hi Ryan,

|>>>>>>> How does the performance of LINQ stand against running a SQL QUery that returns a |result set saved to an IList?  I'm thinking in turns of, if 1,000 of these statements were |ran every second, which one would be faster, and use less memory?

|LINQ to SQL is very fast.  If you are surfacing an object model for your data (meaning |creating objects to represent relational data), I think you'll find LINQ to SQL is about as |efficient as if you did it completely by hand.

|If you use a compiled LINQ to SQL query, you'll find with beta2 that it is about 93% the |performance of iterating over a raw SQLDataReader object: |blogs.msdn.com/.../linq-to-sql-rico-drops-the-other-shoe.aspx

Scott, that's pretty amazing. Instead of having 600+ stored procedures (which we have :P ) you could have your DataBase as an actual layer in code, and you could build your data access layer totally out of LINQ, eliminating Stored Procedures and Functions.

Very interesting, as I doubt people will want to create a solution of 1/2 LINQ and 1/2 Stored Procedures - it would get messy. Time to play :)

Interesting.

# re: LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 12:22 PM by Tony Stratton

I have been using a similar tool (llblgen), and there is an improvement you can make that would make the query visualizer superior.

Can you do a textual parameter replacement in the query, so I can just copy the query to a query tool and run it without modification?

In your example I would have to search for @p0 and replace it with 'Beverages' which can be cumbersome with, say, 15 parameters...

Yours,

Tony Stratton

# re: LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 1:02 PM by Bilal Haidar [MVP]

Thanks Scott!!

Regards

# LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 1:39 PM by A world apart from the everday ...

Another great post from Scott Guthrie about installing and using the Linq to SQL Debug Visualizer ..

# re: LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 1:44 PM by ScottGu

Hi Mehfuz,

>>>>>> In addition , i want to ask, the queries generated by LINQ, how can i optimize that more, let say,i want to select some products on basis of a fixed criteria, and i know that Index A has the best coverrge, how can i forcely specify the index, right in LINQ query?Will there be something like the following in future.

You can actually override the raw SQL that LINQ to SQL uses if you want absolute control over the SQL executed.  In general I'd recommend against it unless you absolutely need to, but you do have that option.

Hope this helps,

Scott

# re: LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 1:46 PM by ScottGu

Hi Tony,

>>>>>>> Can you do a textual parameter replacement in the query, so I can just copy the query to a query tool and run it without modification?  In your example I would have to search for @p0 and replace it with 'Beverages' which can be cumbersome with, say, 15 parameters...

The good news is that this is supported today!  Just uncheck the "Original Query" checkbox and it will show you the raw SQL with the paramters encoded and placed in the SQL.  This allows you to copy/paste like you are after and run it in any database query tool.

Hope this helps,

Scott

# re: LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 4:16 PM by geoff

Hey Scott,

Love the new VS2008 it’s awesome. I have been finding some minor bugs during use but when I try to report them at:

connect.microsoft.com/visualstudio

It puts me in a infinite loop.

After doing the requested login.

It tells me I don’t have access to submit a bug but I when I got available connections section is says I do?

  I don’t want to bother with such a minor bug as array index notation not working properly.

Am I not looking at the right place to submit bugs?

    Thanks for everything seriously I don’t remember what programming was like before your blog,

  G

# re: LINQ to SQL Debug Visualizer

Wednesday, August 01, 2007 4:44 PM by ScottGu

Hi Geoff,

>>>>>> Hey Scott, Love the new VS2008 it’s awesome. I have been finding some minor bugs during use but when I try to report them at: connect.microsoft.com/visualstudio It puts me in a infinite loop. After doing the requested login. It tells me I don’t have access.

Feel free to send all bug reports directly to me (scottgu@microsoft.com).  I can then forward them to the appropriate team and put you in touch with them.

Thanks,

Scott

# links for 2007-08-01 &laquo; Inferis&#8217; Mind Dump

Wednesday, August 01, 2007 6:18 PM by links for 2007-08-01 « Inferis’ Mind Dump

Pingback from  links for 2007-08-01 &laquo; Inferis&#8217; Mind Dump

# re: LINQ to SQL Debug Visualizer

Thursday, August 02, 2007 8:21 AM by Ken

Scott,

Can you give us an update on the compatability with vb.net.

Thanks

Ken

# re: LINQ to SQL Debug Visualizer

Thursday, August 02, 2007 11:06 AM by ScottGu

Hi Ken,

>>>>>>> Can you give us an update on the compatability with vb.net.

We've reprod the problem here internally, and someone is working on it now.  I'll let you know once there is an update or a potential fix.

Thanks,

Scott

# re: LINQ to SQL Debug Visualizer

Thursday, August 02, 2007 1:04 PM by Vikram

HI Scott,

Thanks fo9r the explanation. That was very helpful

# re: LINQ to SQL Debug Visualizer

Thursday, August 02, 2007 8:04 PM by William

Have issue with deleting a record. The where statement below seems a bit strange "WHERE 0 = 1".

SELECT [t0].[SSNum], [t0].[FirstName], [t0].[LastName], [t0].[MiddleName], [t0].[LastEditDate], [t0].[CreationDate], [t0].[HireDate], [t0].[ExitDate], [t0].[Active], [t0].[RawImage2], [t0].[RawImage3], [t0].[Picture], [t0].[Attachment], [t0].[Template1], [t0].[Template2], [t0].[Template3]

FROM [dbo].[Employees] AS [t0]

-- Context: SqlProvider(Sql2005) Model: AttributedMetaModel Build: 3.5.20706.1

DELETE FROM [dbo].[Employees] WHERE 0 = 1

-- Context: SqlProvider(Sql2005) Model: AttributedMetaModel Build: 3.5.20706.1

SELECT [t1].[value]

FROM (

   SELECT @p0 AS [value], [t0].[SSNum]

   FROM [dbo].[Employees] AS [t0]

   ) AS [t1]

WHERE [t1].[SSNum] = @p1

-- @p0: Input Int32 (Size = 0; Prec = 0; Scale = 0) [0]

-- @p1: Input StringFixedLength (Size = 9; Prec = 0; Scale = 0) [111111111]

-- Context: SqlProvider(Sql2005) Model: AttributedMetaModel Build: 3.5.20706.1

**********************************************************

System.Data.Linq.ChangeConflictException was unhandled

 Message="Row not found or changed."

 Source="System.Data.Linq"

 StackTrace:

      at System.Data.Linq.ChangeProcessor.SubmitChanges(ConflictMode failureMode)

      at System.Data.Linq.DataContext.SubmitChanges(ConflictMode failureMode)

      at PunchMeIn.TestForm.employeeBindingNavigatorSaveItem_Click(Object sender, EventArgs e) in C:\Documents and Settings\Administrator\My Documents\Visual Studio Codename Orcas\Projects\VSMacros80\PunchMeIn\TestForm.cs:line 28

Table

----------------------------------

CREATE TABLE [dbo].[Employees](

[SSNum] [nchar](9) NOT NULL,

[FirstName] [nvarchar](50) NOT NULL,

[LastName] [nvarchar](50) NOT NULL,

[MiddleName] [nvarchar](50) NULL,

[LastEditDate] [datetime] NULL,

[CreationDate] [datetime] NULL,

[HireDate] [datetime] NULL,

[ExitDate] [datetime] NULL,

[Active] [bit] NOT NULL CONSTRAINT [DF_Employees_Active]  DEFAULT ((1)),

[RawImage1] [varbinary](max) NULL,

[RawImage2] [varbinary](max) NULL,

[RawImage3] [varbinary](max) NULL,

[Picture] [varbinary](max) NULL,

[Attachment] [varbinary](max) NULL,

[Template1] [varbinary](max) NULL,

[Template2] [varbinary](max) NULL,

[Template3] [varbinary](max) NULL,

CONSTRAINT [PK_Employees] PRIMARY KEY CLUSTERED

(

[SSNum] ASC

)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]

) ON [PRIMARY]

# { null != Steve } &raquo; Blog Archive &raquo; More on Linq to SQL

Thursday, August 02, 2007 9:07 PM by { null != Steve } » Blog Archive » More on Linq to SQL

Pingback from  { null != Steve }  &raquo; Blog Archive   &raquo; More on Linq to SQL

# re: LINQ to SQL Debug Visualizer

Friday, August 03, 2007 2:39 PM by Pawel Tarnik

Hi Scott,

I'm very impressed by LINQ, however one thing bothers me:

Is it possible that LINQ to SQL would generate it's entity classes (e.g. Product for Products table) in separate files?

Or even better - in separate project?

That's how it is e.g. in NHibernate, and it makes sharing those classes across layers in multi-layered application a lot easier. It's also easier to use it with distributed application, web services etc.

LINQ to SQL is totally totally better than typed datasets, and I'm very happy that MS chose this way. But until all generated classes will be stored simply in one file - it still won't be fully "enterprise" solution :(

Your reply will be appreciated.

# re: LINQ to SQL Debug Visualizer

Friday, August 03, 2007 2:41 PM by PaoloTCS

I am having difficulty connecting to a remote SQL Server.  I have 2 copies of a database, one local and one remote.  Using the wizard for a Dataset, I tried in both cases to create a new Stored PRocedure.  IN the local case, all went fine, (as it has for years with 2005).  However, when I try to do the same on the remote, it fails on the last step with the error msg, "THe specific schema for "woofwoof" either does not exist, or you do not have permission to use it."  ("woofwoof" is the username for the database).  It seems like a permission problem.  I am running it in Vista Business OS. I have an capture of the error, if that helps.  

Otherwise, this looks like a great product!

# re: LINQ to SQL Debug Visualizer

Saturday, August 04, 2007 2:56 AM by charlesgc

Hi scott. i found a bug in the linq to sql. if the table name has any dot like 'Movie.Base.Studio' the linq to sql will generate the following code: [dbo].[[Movie].[Base].[Studio]]] instead of [dbo].[Movie.Base.Studio] and then return the following error: "Could not find server 'dbo' in sys.servers. Verify that the correct server name was specified. If necessary, execute the stored procedure sp_addlinkedserver to add the server to sys.servers."

# re: LINQ to SQL Debug Visualizer

Saturday, August 04, 2007 3:08 AM by charlesgc

I could not find a method inside the linqdatasource that could return the results to a datatable or dataset. I found some sites saying about the GetDataTable() method in later linq releases. Do you know how is it called in the current release?

# re: LINQ to SQL Debug Visualizer

Saturday, August 04, 2007 10:41 AM by Eric

Hi Scott, I found some mistakes in 101 LINQ Samples (msdn2.microsoft.com/.../aa336746.aspx)

I think some of the code (such as 'List<Product>') did not show up.

# re: LINQ to SQL Debug Visualizer

Monday, August 06, 2007 5:04 PM by Hank L

Scott,

What are your thoughts on the whole issue of using SQL Server stored procedures or not?  I assume that LINQ appeals to developers who send SQL statements to SQL Server rather than calling stored procedures.

In your opinion, is it best to do as much in SQL stored procedures as possible, for better performance, scalability, etc, rather than using ASP to construct all the SQL necessary, and thus not needing stored procedures?

Thanks,

Hank

# LINQ to SQL デザイナビジュアライザ

Tuesday, August 07, 2007 10:56 AM by Chica's Blog

LINQ to SQL デザイナビジュアライザ

# re: LINQ to SQL Debug Visualizer

Tuesday, August 07, 2007 4:01 PM by David Terrie

Scott,

For those of us used to thinking in T-SQL, and who often take advantage of things like common table expressions and the new row and rank functions in 2005, would it be possible to provide a reverse visualizer/code generator that would generate C# LINQ from T-SQL? Any third parties working on this?

# re: LINQ to SQL Debug Visualizer

Wednesday, August 08, 2007 4:15 PM by Vijay

Hi Scott,

Thank you much for your continued support of the community. It's a great thing to have the MS folks blogging about the upcoming products.

My question is about mapping automation and the LINQ to SQL approach.  For the most part LINQ to SQL appears to only take the bottom up approach where you start from the database meta-data and work up to (or generate) the object model.  What about the other direction?  What if I have a robust domain model and I want to map to (or even generate) my data model.  Are there any plans to expand the designer to allow for more complete mapping functionality?  It would be nice to be able to drag my classes from "Solution Explorer" or "Class View" and have them show up in the dbml designer.

Thanks

# re: LINQ to SQL Debug Visualizer

Thursday, August 09, 2007 11:12 AM by ScottGu

Hi PaoloTCS,

>>>>>> I am having difficulty connecting to a remote SQL Server.  I have 2 copies of a database, one local and one remote.  Using the wizard for a Dataset, I tried in both cases to create a new Stored PRocedure.  IN the local case, all went fine, (as it has for years with 2005).  However, when I try to do the same on the remote, it fails on the last step with the error msg, "THe specific schema for "woofwoof" either does not exist, or you do not have permission to use it."  ("woofwoof" is the username for the database).  It seems like a permission problem.  I am running it in Vista Business OS. I have an capture of the error, if that helps.  

If you can send me more emails about this problem, I can try and get someone to help investigate.  

Thanks,

Scott

# re: LINQ to SQL Debug Visualizer

Thursday, August 09, 2007 11:12 AM by ScottGu

Hi Charles,

>>>>>>> Hi scott. i found a bug in the linq to sql. if the table name has any dot like 'Movie.Base.Studio' the linq to sql will generate the following code: [dbo].[[Movie].[Base].[Studio]]] instead of [dbo].[Movie.Base.Studio] and then return the following error: "Could not find server 'dbo' in sys.servers. Verify that the correct server name was specified. If necessary, execute the stored procedure sp_addlinkedserver to add the server to sys.servers."

I think you sent me email on this issue - if not, would you mind doing so (scottgu@microsoft.com)?

Thanks,

Scott

# re: LINQ to SQL Debug Visualizer

Thursday, August 09, 2007 11:15 AM by ScottGu

Hi Hank,

>>>>>> What are your thoughts on the whole issue of using SQL Server stored procedures or not?  I assume that LINQ appeals to developers who send SQL statements to SQL Server rather than calling stored procedures.  In your opinion, is it best to do as much in SQL stored procedures as possible, for better performance, scalability, etc, rather than using ASP to construct all the SQL necessary, and thus not needing stored procedures?

I'm actually going to be doing a blog post on using SPROCs with LINQ to SQL shortly (probably over the weekend).  Stay tuned!

Scott

# re: LINQ to SQL Debug Visualizer

Thursday, August 09, 2007 11:19 AM by ScottGu

Hi David,

>>>>>>> For those of us used to thinking in T-SQL, and who often take advantage of things like common table expressions and the new row and rank functions in 2005, would it be possible to provide a reverse visualizer/code generator that would generate C# LINQ from T-SQL? Any third parties working on this?

That is a great idea.  I'm not aware of someone working on just such a reverse code generator right now - but it definitley sems doable.  As part of my upcoming SPROC post, I will also probably be covering how to use common table expressions and UDTs.

Thanks,

Scott

# re: LINQ to SQL Debug Visualizer

Thursday, August 09, 2007 11:23 AM by ScottGu

Hi Vijay,

>>>>>> My question is about mapping automation and the LINQ to SQL approach.  For the most part LINQ to SQL appears to only take the bottom up approach where you start from the database meta-data and work up to (or generate) the object model.  What about the other direction?  What if I have a robust domain model and I want to map to (or even generate) my data model.  Are there any plans to expand the designer to allow for more complete mapping functionality?  It would be nice to be able to drag my classes from "Solution Explorer" or "Class View" and have them show up in the dbml designer.

LINQ to SQL does have the ability to start with a "class first" approach instead of starting with the schema.  The modeling support within the LINQ to SQL designer is ok for this (not perfect, but still usable I think).  On the toolbox there is a "Class" icon you can add to the designer and use to model your entities there.

Alternatively, you can define your classes in code first, and then apply either attributes or use an external XML mapping file to define the mapping layer.

Note that LINQ to SQL's mapping layer typically needs to map to the schema of the underlying database.  LINQ to Entities provides you with more of a ability to define a conceptual layer that might be quite different from the underlying schema.

Hope this helps,

Scott

# LINQ samples

Thursday, August 09, 2007 4:03 PM by Daniel Moth

LINQ samples

# MSDN events - more about LINQ, Silverlight and WCF

Sunday, August 12, 2007 8:33 PM by Contagious Curiosity

Did you attend one my events in August to September 2007 and want more information about the topics covered?

# MSDN Blog Postings &raquo; 2007 &raquo; August &raquo; 12

Sunday, August 12, 2007 9:10 PM by MSDN Blog Postings » 2007 » August » 12

Pingback from  MSDN Blog Postings  &raquo; 2007 &raquo; August &raquo; 12

# re: LINQ to SQL Debug Visualizer

Monday, August 13, 2007 7:17 AM by Herbjörn Wilhelmsen

Hi Scott,

You write that:

"Developers can use LINQ with any data source, and built-in libraries are included with .NET 3.5 that enable LINQ support against Objects, XML, and Databases. "

Mike Taulty writes in his blog that:

"For me, the top 3 things to know about LINQ to Entities would be;

1 It will not ship with Visual Studio 2008 and .NET Framework V3.5. It comes "later". "

Am I missing out on something here or do You write different things about LINQ? If You write different things, whats the situation really like?

A link to Mikes blog: mtaulty.com/.../9558.aspx

Thanks

# re: LINQ to SQL Debug Visualizer

Monday, August 13, 2007 10:29 AM by ScottGu

Hi Herbjörn,

>>>>>> "Developers can use LINQ with any data source, and built-in libraries are included with .NET 3.5 that enable LINQ support against Objects, XML, and Databases. " "For me, the top 3 things to know about LINQ to Entities would be: 1 It will not ship with Visual Studio 2008 and .NET Framework V3.5. It comes "later". Am I missing out on something here or do You write different things about LINQ? If You write different things, whats the situation really like?

LINQ to Entities does not ship directly in .NET 3.5 - but LINQ to SQL does.  When I said there was built-in support for LINQ to work against a database I was referring to LINQ to SQL support.

Hope this helps,

Scott

# Resources for MSDN Events - LINQ, WCF, Silverlight

Monday, August 13, 2007 12:54 PM by Veni, Vidi, Velcro...

Technorati tags: Resources , MSDN events , Portland MSDN Event , WCF , LINQ , Silverlight Thanks for

# re: LINQ to SQL Debug Visualizer

Wednesday, August 15, 2007 9:27 AM by Ken

Thursday, August 02, 2007 11:06 AM by ScottGu

Hi Ken,

>>>>>>> Can you give us an update on the compatability with vb.net.

We've reprod the problem here internally, and someone is working on it now.  I'll let you know once there is an update or a potential fix.

Scott--can you provide an update on this. Thanks  Ken

# Linq Resources

Wednesday, August 15, 2007 5:05 PM by Demystifying The Code

I presented Linq at the .NET User Group in Phoenix last night and mentioned some great linq resources.

# MSDN Blog Postings &raquo; Linq Resources

Wednesday, August 15, 2007 6:38 PM by MSDN Blog Postings » Linq Resources

Pingback from  MSDN Blog Postings  &raquo; Linq Resources

# re: LINQ to SQL Debug Visualizer

Thursday, August 16, 2007 8:45 AM by Ken

Can you provide an update regarding the fix for vb.net users.

Thanks

Ken

# re: LINQ to SQL Debug Visualizer

Thursday, August 16, 2007 10:59 AM by ScottGu

Hi Ken,

>>>>>> Can you provide an update regarding the fix for vb.net users.

Sorry for the delay on this.  It turns out this was a bug in VS 2008 Beta2 with how debug visualizers are loaded.  The good news is that this will be fixed for the final release though.

Sorry for the delay!

Scott

# LINQ - IQueryable, Mathematical Methods, and .Take (Top N) &laquo; Ramblings of the Sleepy&#8230;

Pingback from  LINQ - IQueryable, Mathematical Methods, and .Take (Top N) &laquo; Ramblings of the Sleepy&#8230;

# On the road with LINQ, WCF and Silverlight

Tuesday, August 21, 2007 10:41 AM by Noticias externas

…With a boulder on my shoulder feelin&#39; kinda older I tripped the merry-go-round With this very unpleasing

# DLINQ – Advanced topics – Debug mode – part 6

Thursday, August 23, 2007 5:50 PM by Wortzel's blog

DLINQ is a great ORM engine with a lot of advantages. When I learned this tool I asked myself how I can

# On the road with LINQ, WCF and Silverlight

Saturday, September 08, 2007 6:53 AM by BenkoBlog

…With a boulder on my shoulder feelin' kinda older I tripped the merry-go-round With this very unpleasing

# Wie sehe ich welche SQL Befehle eine Linq to SQL Abfrage erzeugt?

Tuesday, September 11, 2007 5:53 AM by

Mit Linq ist es sehr einfach komplexe Abfragen auf eine Liste von Objekten anzuwenden. Um einmal hinter

# MSDN Blog Postings &raquo; Wie sehe ich welche SQL Befehle eine Linq to SQL Abfrage erzeugt?

Pingback from  MSDN Blog Postings  &raquo; Wie sehe ich welche SQL Befehle eine Linq to SQL Abfrage erzeugt?

# re: LINQ to SQL Debug Visualizer

Saturday, September 15, 2007 4:07 AM by Marcel

Hi,

Does the visualizer not work with VB? Yeah I know I need to switch to C but this project is needed for a client in VB.

# 10 Things I Learned From the September MSDN Event in Atlanta at Die, AJAX!

Pingback from  10 Things I Learned From the September MSDN Event in Atlanta at Die, AJAX!

# It's AATT! Hot time in Miami last week! Looking for more tools to show...

Tuesday, September 25, 2007 7:59 PM by Russ' Tool Shed - Russ Fustino's WebLog

The crowd loved it! The debut of “ It’s All About The Tools – Episode 1” took place in Miami at the Miami

# 101 LINQ Beispiele und weitere Links

Tuesday, October 09, 2007 4:47 AM by Jürgen Gutsch

Vor einer Weile hatte ich hier einen Beitrag zu den LINQ to SQL Tutorials von Scott Guthrie (1) veröffentlicht.

# Scott Guthrie Discusses how to debug LINQ

Friday, December 14, 2007 7:33 AM by Learn MS .NET

Scott Guthrie Discusses how to debug LINQ

# Linq to Sql Query Visualizer

Saturday, December 22, 2007 10:09 AM by Rob's Blog

Linq to Sql Query Visualizer

# Visualizer For LINQ Debuging

Saturday, December 22, 2007 4:50 PM by Nati Dobkin

Scott Guthrie wrote a very nice visualizer for LINQ to SQL for easier debugging. Take a look on it and

# [.net][LINQ] LINQ to SQL のデバッグに。LINQ to SQL Debug Visualizer

Saturday, December 22, 2007 7:49 PM by 学び、そして考える

Sorry,this entry is written only Japanese. weblogs.asp.net/.../linq-to-sql-debug-visualizer.aspx より。 Visual Studio で LINQ to SQL をデバッグすると のように変数の値をパラパラと展開して表示してくれます。これだけでも十分かも

# VS 2008 对 LINQ to SQL 辅助工具

Saturday, January 19, 2008 6:06 AM by 自由、创新、研究、探索……

当你在项目中使用LINQ to SQL的时候, 有一个事情是必须要非常注意的, 那就是要关心一下LINQ to SQL帮你生成的SQL语句, 尤其在你还不是非常熟悉LINQ to SQL的语法, API的时候, 这点是非常重要的。

# LINQ to SQL可视化调试工具

Friday, January 25, 2008 1:30 AM by 曹振华

本来说是在VisualStudio2008Beta2中集成LINQto

# sachabarber.net &raquo; Nice LINQ Debugger Visualizers

Sunday, February 17, 2008 7:31 AM by sachabarber.net » Nice LINQ Debugger Visualizers

Pingback from  sachabarber.net  &raquo; Nice LINQ Debugger Visualizers

# LINQ to SQL Visualizer isn't in the transaction it is visualizing

Friday, February 29, 2008 2:06 AM by Rob's Blog

LINQ to SQL Visualizer isn't in the transaction it is visualizing

# Linq to SQL Debug Visualizer

Friday, February 29, 2008 8:29 AM by Miguel Madeira

On debug mode it is nice to see the generated sql query, but what about if we can execute the query against

# HowTo: LINQ to SQL debuggen | Code-Inside Blog

Wednesday, March 19, 2008 2:35 PM by HowTo: LINQ to SQL debuggen | Code-Inside Blog

Pingback from  HowTo: LINQ to SQL debuggen | Code-Inside Blog

# HowTo: LINQ to SQL debugging | Code-Inside Blog International

Pingback from  HowTo: LINQ to SQL debugging | Code-Inside Blog International

# Un debug visualizer per LINQ-to-SQL

Monday, April 28, 2008 4:52 AM by Around and About .NET World

Un debug visualizer per LINQ-to-SQL

# LINQ to SQL Debug Visualizer

Thursday, June 26, 2008 12:35 AM by Jonas Stawski

LINQ to SQL Debug Visualizer

# Episode 10: LINQ | Herding Code

Wednesday, July 23, 2008 7:01 PM by Episode 10: LINQ | Herding Code

Pingback from  Episode 10: LINQ | Herding Code

# LINQ to SQL Debug Visualizer

Monday, October 13, 2008 7:15 AM by CCook's Blog

LINQ to SQL Debug Visualizer

# 10 Tips to Improve your LINQ to SQL Application Performance

Tuesday, November 11, 2008 12:06 AM by 吴明浩

Heythere,backagain.InmyfirstpostaboutLINQItriedtoprovideabrief(okay,bitdetailed)in...

# Logging your Sql with LINQ Update Commands. Simple Logging to your Visual Studio 2008 Debugger Output Console | PeterKellner.net

Pingback from  Logging your Sql with LINQ Update Commands.  Simple Logging to your Visual Studio 2008 Debugger Output Console | PeterKellner.net

# Visual Studio 2008 LINQ to SQL Visualizer

Thursday, December 18, 2008 11:39 PM by Mike Reagan's Blog

Visual Studio 2008 LINQ to SQL Visualizer

# [Debug] Linq To Sql - .Net and MOSS News

Wednesday, December 24, 2008 5:52 PM by [Debug] Linq To Sql - .Net and MOSS News

Pingback from  [Debug] Linq To Sql - .Net and MOSS News

# LINQ Resources &laquo; Vakul Kumar More

Friday, January 16, 2009 11:17 PM by LINQ Resources « Vakul Kumar More

Pingback from  LINQ Resources &laquo; Vakul Kumar More

# 【LINQ-SQL Debug】 一个实用工具

Wednesday, February 11, 2009 4:12 AM by Wencui

LINQ-SQL开发时比较实用的一个tool,LINQ-SQL Debug Visualizer。它可以帮助我们调试LINQ query所生成的扩展方法,以及转换的SQL脚本等,比Visual Studio自带的Debug工具要强大一些,能反馈出更多的信息。

# 在Linq to Sql中管理并发更新时的冲突(1):预备知识

Monday, March 02, 2009 9:51 PM by Jeffrey Zhao

无论与目前的ORM框架相比有没有优势,Linq to Sql在语言和平台的级别上为我们提供了一种新的操作对象和数据的方式,在一定程度上为我们解决了Object != Data的问题。在实际应用中,对于数据库的操作往往有着天生的并发性,因此在更新数据时可能会产生冲突。有些时候,如果没有合理的解决冲突问题,轻则让用户摸不着头脑,重则让系统数据处于一种不一致的状态。Linq to Sql自然考虑到了这一点,本系列讨论的内容,就是在使用Linq to Sql时,如何管理并发更新时产生的冲突。 本文为这个系列的第一篇

# L???y d??? li???u d??ng Stored Procedure (LINQ to SQL ph???n 6) &laquo; ????o H???i Nam

Pingback from  L???y d??? li???u d??ng Stored Procedure (LINQ to SQL ph???n 6) &laquo; ????o H???i Nam

# L???y d??? li???u d??ng Stored Procedure (LINQ to SQL ph???n 6) &laquo; ????o H???i Nam

Pingback from  L???y d??? li???u d??ng Stored Procedure (LINQ to SQL ph???n 6) &laquo; ????o H???i Nam

# LINQ to SQL Debug Visualizer &laquo; WebJagger&#8217;s Blog

Tuesday, June 02, 2009 8:54 AM by LINQ to SQL Debug Visualizer « WebJagger’s Blog

Pingback from  LINQ to SQL Debug Visualizer &laquo; WebJagger&#8217;s Blog

# LINQ to SQL: Debugger Visualizer Error: No quotes for string values

Friday, June 26, 2009 7:02 AM by Bad design is the father of invention

Recently when I was using LINQ to SQL (which I happen to love so much) and using the LINQ to SQL debug

# ScottGu&#8217;s Linq to SQL Debug Visualizer &laquo; Blog Bustin&#039; .NET Beats

Pingback from  ScottGu&#8217;s Linq to SQL Debug Visualizer &laquo; Blog Bustin&#039; .NET Beats

# S??? d???ng LINQ to SQL Part 6 | IT-C?? ????n

Sunday, July 19, 2009 12:03 PM by S??? d???ng LINQ to SQL Part 6 | IT-C?? ????n

Pingback from  S??? d???ng LINQ to SQL Part 6 | IT-C?? ????n

# Designing A Data Access Layer in LINQ to SQL

Tuesday, August 25, 2009 12:50 PM by 汗水房

这篇帖子里讲了事务处理方面的东西,开阔了我的思路。但是对于具体的层次架构的东西(例如如何具体的编写DAL代码)没有陈述。而在代码中,BPL(业务层)和DAL的分工并不明确,BPL只是简单的将DAL...

# Praktische Tools f

Friday, September 18, 2009 12:25 PM by Christian

Praktische Tools f

# Praktische Tools für das Monitoring von LINQ to SQL Abfragen

Friday, September 18, 2009 1:32 PM by SharePoint Blogs in German

Oft ist es schwierig das Ergebnis von LINQ to SQL-Abfragen zu debuggen oder zu monitoren. Hierbei helfen