LINQ and Related Topics

Pin DataTips in Visual Studio 2010

While debugging in Visual Studio 2010, I noticed that the DataTip now has a new feature. At the right hand side of the variable window, there is now a pin icon.

image

Clicking on this pin icon adds the DataTip to the code window allowing it to float over the existing text.

image

In addition to allowing you to drill into the variable’s values as you would in the watch, locals, or autos windows, You can also add comments which remain with the pinned DataTip.

image

When you stop debugging, the DataTip will disappear. However when you debug into this method again, it will re-appear as long as it is pinned. As a bonus, it will persist even after closing and re-opening Visual Studio.

While Visual Studio 2010 definitely has some rough edges, I continue to be amazed by some of the new UX features that the next version will bring.

Posted on 11/10/2009 10:00:00 PM - Comments(1)
Categories: VS 2010 VB Dev Center

LINQ tools on the Toolshed

This summer at the Jacksonville Code Camp, I had the pleasure of being part of the taping of Russ' Fustino’s Toolshed. Finally, the episode has  been posted on Channel9 for you to enjoy. Here’s the overview of the episode.

Toolshed: Episode 5 - Its All About The Tools TV Show

Episode 5 has killer content on Deep Zoom, Expression Web 3, a codeplex project on a Snippet Editor for Visual Studio, LINQ Tool Samples, LINQ Pad, Link To Twitter, Expression Blend 3 Importing Adobe assets, and an incredible codeplex project must see on a solid Silverlight website starter kit using best practices!  This is Russ's Tool Shed's best effort yet! Grab a beer and hope you enjoy this most educational, enlightening and entertaining instant classic video!

The LINQ Tools segment starts at 44:35 if you want to jump ahead.

Posted on 11/5/2009 10:04:00 PM - Comments(1)
Categories: LINQ Code Camp

Win 7 with Visual Studio 2010

I’ve been running Windows 7 since the initial public betas (February 2009) and have loved it. One of my favorite features is the ability to drag an application to the left or right side of the monitor and have it snap  to take up half the screen. Even better is using the Windows – Left Arrow and Windows – Right Arrow key combinations to dock the screens without using the mouse. This even works across multiple monitors. It’s a great addition for comparing documents, or in my case when translating code between C# and VB.

By chance, I was playing with Visual Studio Beta 2 tonight when I slipped while dragging a code window. I intended to do a split screen inside of Visual Studio 2010. Instead, I drug the window outside of Visual Studio. To my surprise, the window moved correctly. Pressing my luck, I pressed Windows-Left Arrow and I was amazed that I now had half of the screen with the newly moved code window and the left half with the rest of visual studio.

Here’s a sample screen shot demonstrating the result. In this case, the PostController from this site is in the left half and the ShowPosts view is on the right half.

image

I loved that Win 7 docking supported separate apps, but had no idea that the docking would work with parts of the same app. I have a feeling I’ll be using this feature often! Have you discovered other Win 7 secrets with Visual Studio, I’d love to hear them.

Posted on 10/22/2009 10:07:00 PM - Comments(0)
Categories: VS 2010

Setting DataContext Connection String in Data Tier

LINQ to SQL offers a quick mechanism to build a data tier in a n-Tier application. There’s a challenge when using the DBML designer in a Class Library. The designer stores the connection string in the Settings file. Although it appears that you can change it in the config file, any changes you make there will be ignored because they are actually retained in the generated Settings file.

While you could go into the DataContext’s .Designer file and change the location of the connection string, any changes you make there will be overwritten if you make changes to the DBML file. So what are you to do?

Remember, one of the nice features added to VB 9 and C# 3 was partial properties. With the DataContext, the code generators add a OnCreated method that is called as part of the context’s constructors. As a result, we can implement the partial method in a separate partial DataContext class that is not changed when the DBML is regenerated. Here’s a sample to do that for the context on this site (LinqBlogDataContext):


Imports System.Configuration

Public Class LinqBlogDataContext
  Private Sub OnCreated()
    MyBase.Connection.ConnectionString = _
      ConfigurationManager.ConnectionStrings("LinqBlogConnectionString") _
         .ConnectionString
    End Sub
End Class

When you do this, you can change the connection string in the app.config or web.config and it will be picked up in the business tier correctly. Realize that the design surface will still use the value in the settings in& the Class Library project instead of the config file.

Posted on 10/21/2009 8:02:00 PM - Comments(3)
Categories: LINQ VB Dev Center VB

VS 2010 Beta 2 supports Win 7 Jump Lists

One of the nice new features of Windows 7 is support for Jump Lists. These apply to applications that support the feature to allow you to quickly access application specific features, often including the MRU (Most Recently Used) lists. In Visual Studio Beta 1, this list showed the new files that you created. What it missed was perhaps the more important part. It didn’t include links to the most recently used Solution files, only the class (.vb/.cs) files.

With Beta 2 which was released to MSDN subscribers today, you can now directly access recent solutions from the task bar as you can see below (notice the new icon as well):

image

There are a bunch of enhancements and I’m sure you’ll be hearing more about them in the coming months.

Posted on 10/19/2009 10:39:00 PM - Comments(2)
Categories: