Visual Studio .NET Server Explorer

Discover the power and convenience that this RAD tool can provide.

Ken McNamee

October 30, 2009

4 Min Read
ITPro Today logo in a gray background | ITPro Today

ToolKit

Languages: N/A

ASP.NET Versions: 1.0 | 1.1

 

Visual Studio .NET Server Explorer

Discover the power and convenience that this RAD toolcan provide.

 

By Ken McNamee

 

As one of the most useful tools inVisual Studio .NET, the Server Explorer provides an enormous amount ofinformation, design-time convenience, and run-time functionality. In fact, theServer Explorer is actually several tools in one. At its simplest level, itallows you to explore entities such as Event Log entries and database objects.The next level allows you to manage the server by starting and stopping WindowsServices, creating database objects, and even changing data. The most advancedlevel of the Server Explorer provides the developer with programmatic access tosome of the objects such as Event Logs, Performance Counters, Message Queues,Windows Services, and database tables, views, and stored procedures.

 

Any description of the ServerExplorer has to begin with its database management and programmingcapabilities, which can duplicate the features of SQL Server Enterprise Managerand Query Analyzer - almost. Server Explorer allows you to graphically createdatabases, tables, views, and stored procedures completely from within VisualStudio .NET. You can also edit and delete existing database objects. However,these management features pale in comparison to the power and convenience ofits other features. For example, you can drag and drop a table from the ServerExplorer onto a Web Form design surface and a slew of ADO.NET objects and codeis created for you to enable programming against that table. A SqlConnectionand SqlDataAdapter object are inserted into the code and SQL statements aregenerated for selecting, inserting, updating, and deleting from that table.

 

Drag a stored procedure onto a WebForm and a SqlCommand object is generated along with all the ADO.NET codenecessary to call the stored procedure. This feature can be a real timesaversince typing in the code for possibly dozens of SqlParameter objects can be atedious and - more importantly - error-prone task.

 

Like Enterprise Manager and QueryAnalyzer, Server Explorer also allows you to retrieve all the data from a tableand display it in an editable grid. You can also generate a "create script" forany of the database objects and even create a database diagram. However, one ofthe most convenient aspects of these features is that almost all the windowsthat are generated appear as normal Visual Studio .NET tabbed windows. Thismakes it very easy to integrate the features of the tool with the rest of yourdevelopment and switch between code-behind for a Web Form, a stored procedurecreation script, and a table design window without having to switch developmentenvironments.

 


Figure 1. The Visual Studio .NETServer Explorer allows developers to view Event Logs, manage Windows Servicesand SQL Server databases, and even drag resources such as Performance Countersand database tables onto Web Forms.

 

Counters, Queues,and Logs

SQL Server database objects aren'tthe only items that can be dragged off the Server Explorer and dropped onto aWeb Form. Performance counters, message queues, and event logs can also bedragged and dropped to create PerformanceCounter, MessageQueue, and EvenLogobjects - respectively - in your code-behind. These objects can then beprogrammed against to add some professional touches to your code with a minimalamount of effort. Message queues in particular can be used to significantlyincrease the scalability of your Web applications. Dragging and dropping aspecific public or private message queue onto your Web form automaticallyinserts all the necessary initialization code and property assignments so thatyou can worry less about the plumbing and more about your logic.

 

I've grown to depend on the conveniencethat the Server Explorer provides. It may not always create the most efficientcode, especially for database operations. However, what it does provide isalways at least a good place to start. Many times I will drag a table onto aform just to get some of the SQL statements that it generates - even if I haveno intention of using the object (which I then delete).

 

There is also no better place toexplore the myriad performance counters at your disposal. If you've ever beenfrustrated by the System Monitor administrative tool just to see whatperformance counters were available, you'll be pleasantly surprised by the treeview interface in the Server Explorer. Depending on what you have installed onyour system, you may also see other options in the Server Explorer such asCrystal Services, which allows you to drag and drop Crystal Reports objectsonto your forms for programmatic access.

 

The Server Explorer is one of thebest examples of the rapid application development features in Visual Studio.NET. It is easy to use, provides a significant amount of functionality, andrequires almost no learning curve to get started. You may find that you have nouse for most of its features, but I bet you'll get hooked on at least one andfind yourself using it over and over again.

 

KenMcNamee is a Senior Software Developer with Vertigo Software, Inc., aleading provider of software development and consulting services on theMicrosoft platform. Prior to this he led a team of developers inre-architecting the Home Shopping Network's e-commerce site, HSN.com, to 100%ASP.NET with C#. Readers can contact him at [email protected].

 

 

 

Read more about:

Microsoft
Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like