Plunging into .NET Development

Weblog Pieter Gheysens
Microsoft .NET Development - C# - Enterprise Library - Visual Studio 2005 Team System - Compuware DevPartner - ...
 


Monday, November 27

Delete Team System Project

Lately I created a number of Team System Projects on my laptop for experimenting some features of Team Foundation Server. It was about time to delete a few of them, but I could not immediately find how to do this exactly. I'm sure it's not possible from within Team Explorer. After googling a bit it appears that the deletion of Team Projects has to be done with the command line tool TFSDeleteProject.exe (:\program files\Microsoft Visual Studio 8\Common7\IDE). Specify the server and the project name and you will be asked for confirmation!
TFSDeleteProject /server:ServerName ProjectName
Warning: Deleting a team project cannot be undone. Are you sure you want to delete the team project (Y/N)? Y

Deleting from Build ...
Done
Deleting from Work Item Tracking ...
Done
Deleting from Version Control ...
Done
Deleting Report Server files ...
Done
Deleting SharePoint site ...
Done
Deleting from Team Foundation Core ...
Done

Next VISUG events

The VISUG announces 2 upcoming events before the end of the year :
  • Discussion on Enterprise Exception Handling and Logging
    December 11, 2006 : 18.30 - 20.00
    This is a session where you (yes, you!) can discuss exception handling and logging in enterprise applications. Bring your tips and tricks, problems and exception handling frustrations with you, and we’ll all learn about best practices together! No slides or preparation required! Don’t want to discuss? No problem, you’re not required to say anything, but we hope you will. To help with a smooth discussion, it will be lead by a panel of 3 to 4 people. If you’re interested to sit on this panel, you’re invited (First-come, First-served basis).


  • Visug Geek Dinner
    December 21, 2006 : 19.00 - ...
    Would you like to meet fellow developers, and have some discussions over dinner you would normally have at the family table? Then come to our geek dinner, where we can discuss everything (yes, even your latest gadget!) while becoming a bigger person. You don’t have to be a geek to attend a geek dinner, but don’t expect us to discuss the latest clothing fashion!
More information and how to subscribe on the VISUG website. Hope to see you all on one of our next events!

Saturday, November 25

System.Configuration.ConfigurationManager

System.Configuration.ConfigurationSettings.AppSettings is obsolete: This method is obsolete, it has been replaced by ConfigurationManager.AppSettings.
Ever had similar warnings at compile time? Ok, no problem you think : just replace ConfigurationSettings with ConfigurationManager and you're done. Not! The ConfigurationSettings class exists in the System.dll assembly while the new ConfigurationManager (.NET 2.0) class exists in the System.Configuration.dll assembly. So, you won't be able to find the ConfigurationManager class without adding a reference to the System.Configuration.dll in your project.

Sunday, November 19

TFS Source Control

Team Foundation Server (workgroup edition) is installed on my laptop (Windows Server 2003) and afterwards I installed the trial edition of Visual Studio Team System, but I could not add projects or solutions to the Team Foundation Source Control in my Visual Studio IDE. Connecting to my Team Foundation Database on the other hand (Team Explorer) was not a problem. Apparently the source control plug-in was set to None. I cannot remember that this was also the case with my previous installation of Team Foundation Server. Team Foundation Source Control was set as the default source control plug-in ...


Thursday, November 16

Windows Vista available for MSDN Subscribers

Monday, November 6

TechEd 2006 Europe - Barcelona

Arrived yesterday-evening at Barcelona for TechEd 2006. Registration this morning was flawless and the rest of the set-up (session rooms, wireless network, CommNet, ...) looks also very promising. The weather here is also very pleasant! I met already some Belgian geeks and there are certainly more to come! In less than an hour the pre-conferences kick off. I'm ready!

Saturday, November 4

Performance Analysis - what to profile?

What to do if you have performance problems in your application and you are not really sure what's causing all this trouble. Well, start using a profiling tool (like Compuware DevPartner) to pinpoint your performance issues on the exact line(s) of code.

For the applications I profiled so far, I was always interested in the exact duration of external calls (towards a database, towards another application, ...) from the profiled applications. It turns out that the default setting of DevPartner Studio 8.1 does not take into account the duration of an external call.



In the screenshot above (generated results with DevParnter Studio 8.1) you can see that the sleepFor3seconds method is executed 10 times (Count column), but it takes 0 seconds (Time column). That's not the information I'm looking for - the sleepFor3seconds method takes actually 30 seconds in total! Ok, the Sleep method is not the most appropriate example here, but imagine that it's replaced by a call to a database ... The default behavior of DevPartner 8.1 is that it excludes time spent in threads of other running applications. Luckily it's easy (but hard to find!) to include this external time as well. Go to your project in Visual Studio and hit F4 to display the Project Properties. There you can toggle the Exclude Others setting and that will give the desired results (see screenshot below).





So, be sure what to profile! Sometimes it can be interesting to profile only your own .NET code, but in applications that are dependent of other applications it might be very appropriate to measure also the duration of the external calls.

Wednesday, November 1

ASP.NET 2.0 GridView - Paging without DataSourceControl

How to enable paging for a GridView without DataSourceControl?
  • Drag and drop a GridView on your webpage
  • Set property AllowPaging on GridView to true
  • Implement OnPageIndexChanging event in your code
  • Store datasource in a session object
  • Use session object for databinding in OnPageIndexChanging event

    protected void Page_Load(object sender, EventArgs e)

    {

        if (!Page.IsPostBack)

        {

            //load data from Database

            //this may only occur once (not in postback)

            CountryDataset ds = this.findData();

 

            //Add datatable to session

            Session["CountryDataSet"] = ds.Country;

 

            //Bind datatable to gridView

            this.GridView1.DataSource = ds.Country;

            this.GridView1.DataBind();

        }

    }

 

    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)

    {

        //Load datatable from session

        this.GridView1.DataSource = (DataTable)Session["CountryDataSet"];

        //set new pageIndex

        this.GridView1.PageIndex = e.NewPageIndex;

        this.GridView1.DataBind();

    }

If you don't use the IsPostPack check, your data will be loaded each time from the database and so you won't need to store the datasource in a session object. But I prefer to store the data in memory to avoid extra database-calls. Another solution may be to store this data in a ViewState object instead of a session object : same results!