Welcome to MSDN Blogs Sign in | Join | Help

Wriju's BLOG

.NET and everything
LINQ to SQL : New method DataContext.GetCommand()

LINQ to SQL we can read the generated T_SQL query using DataContext.Log or SQLQueryVisualizer. But If you are working with WebProject the Log property not very much convenient as you have to use TextWriter to dump the generated T-SQL query.

 

In Orcas Beta 1 we had DataContext.GetQueryText which used to give us the generated T-SQL now we do not have this from Visual Studio 2008 Beta 2. I have mentioned about this change in one of my earlier Blog post. The implementation is here,

 

TextBox1.Text = db.GetCommand(query).CommandText;

 

Now this will give you the DataContext generated T-SQL query.

 

Namoskar!!!

Posted: Saturday, November 10, 2007 12:53 AM by wriju

Comments

Noticias externas said:

LINQ to SQL we can read the generated T_SQL query using DataContext.Log or SQLQueryVisualizer. But If

# November 9, 2007 8:48 PM

Charlie Calvert's Community Blog said:

Welcome to the thirty-sixth issue of Community Convergence. This is the big day, with Visual Studio 2008

# November 19, 2007 6:09 PM

Noticias externas said:

Welcome to the thirty-sixth issue of Community Convergence. This is the big day, with Visual Studio 2008

# November 19, 2007 6:16 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Page view tracker