ThreadAbortException

November 2007 Entries

Visual Studio 2008 and .NET 3.5 Released

Well, just within couple of days after I posted the .NET 3.5 and Visual Studio 2008 Beta 2 Download Links, .NET 3.5 and Visual Studio 2008 became RTM.  What does this mean?  You now have the released version out which you can download and start using for serious application development.  Before I post the download links, I want to mention that there are a few steps you would want to ensure before installing the RTM Version.

1.  Uninstall Visual Studio 2008 Beta 2 or any earlier version manually

2.  Uninstall ASP.NET "Futures" July 2007 or May 2007 CTP

3.  Optionally you could run the .NET 3.5 Beta clean up utility by Aaron Stebner

4.  Reboot your system to make sure that it cleans up any unwanted references.

There is a detailed list of things you would want to do before installing the RTM and Scott Gu has an excellent post on the same.

You can then install Visual Studio 2008 or install only the .NET 3.5 in case you just want to install the framework.  You can download .NET 3.5 and Visual Studio 2008 Express Edition from here

My subsequent posts would cover on the immediate question many of you would have.. Whats is in for me or what is new in Visual Studio 2008 and .NET 3.5. 

Cheers !!!

Enterprise Web Applications using ASP.NET 2.0

Well, most of the web developers today develop Enterprise Web Applications.  While the challenge lies on different parameters like designing the different layers, transferring data between the different layers etc., let us examine how Visual Studio 2005 and ASP.NET 2.0 help you create Enterprise Web Applications quite easily.

Designing your Data Layer

The first step in designing your application would obviously be designing your database and I would leave that part entirely at your discretion.  Once you have your database ready, say you designed a SQL Server 2005 database, the next thing that you would want to do is designing your Data Access Layer.  Now we immediately jump into using different modeling tools and design nice use cases / activity diagrams, class diagrams etc.,  While Visual Studio 2005 Team System allows you design Class Diagrams, etc., and export them for documentation, I again leave this part if you are using an external design tool.  In most of the application scenarios, I have found Visual Studio and Visio mostly sufficient.

Designing the Data Access Layer using Visual Studio 2005 - Data Set Template

Start Visual Studio 2005 - Select File - New Website and chose a location and specify a name for your website, say EntWebApp.

This would create a basic ASP.NET Website with a Default.aspx page, Web.Config file etc.,  The next thing to do is to select - Add - New Item - DataSet and provide a name say CustomersDAL. 

It would prompt you to save the file in the App_Code folder.  The App_Code folder is new in ASP.NET 2.0 which allows you to place class files which are compiled dynamically at run time as well as be accessible across the application.

Once you click "yes", it creates a CustomerDAL.xsd file with a visual interface to design the Data Access Layer.  Using Server Explorer (View - Server Explorer), connect to the Database server node and navigate to your particular database say "NorthWind" Database.

There after, you can drag and drop the tables and start configuring them.  The Data Set designer provides you all the relational information as well as exposes the Table fields as properties for each Table embedded into a Table Adapter.

Say you designed your Customers Table as CustomersDALTableAdapter.   It prompts you to configure your connection string and you can configure the connection string that can be stored in the web.config file.  Once you complete this step, you can chose the table and also specify the columns to be returned.  You could do this in different ways.  You can either chose SQL queries, or Create New / Use Existing Stored Procedures in the Database.  Once you do that, you have your first DataAccess Method (Query) ready.  You can add multiple methods to it by clicking on "Add Query" and configure as many retrieval jobs you would want to accomplish.  You could also drag and drop more tables from the server explorer and configure them.

Designing your Business Class Methods (Middle Tier Components)

Once we are done with our Data Access Layer, we need to start designign your middle tier components.  We have different approaches today in designing our middle tier components.  We create a Business Layer and probably a Business Facade layer or simply go with a Business Layer.  In this case, we will have a Business Layer which is designed as a C# class file.  We could also use VB.NET to accomplish this, as well as use a Class Library Project to add more business methods.  But for the sake of simplicity I am going to have one class file.

Right Click the Website root, select -  Add New Item - select Class template and create a CustomersBL.cs file.  Note that this file would act as our business layer. 

So far, we haven't written any line of code and so pretty much easy.  In this business layer, we want to write a couple of methods which would help in a. implementing our business logic if any and use the CustomersDAL that we created using Table Adapter Configuration Wizard.

In the CustomersBL.cs file, we would write the following code snippet

public DataTable GetCustomers()

{

CustomersDALTableAdapters.CustomersTableAdapter customersDB =

new CustomersDALTableAdapters.CustomersTableAdapter();

// Implement any business logic here

return customersDB.GetData();

}

public DataTable GetCustomerByCustomerID(string customerID)

{

CustomersDALTableAdapters.CustomersTableAdapter customersDB =

new CustomersDALTableAdapters.CustomersTableAdapter();

// Implement any business logic here

return customersDB.GetDataBy(customerID);

}

Note that I have left the commented portion for any business logic you would want to implement.  If we examine the above code snippet, we could figure out that we have programmatic access to the Table Adapter we created and it provides you the typed flexibility to call methods defined in your DAL Layer.

Once we are done with the above, we just need to build the website once to check for any errors / issues. 

Designing your UI Layer

Now we come to the part of designing the UI Layer.  We already have the Default.aspx page which is created when we created the website.  We could use the same page or add a new webform as appropriate and then add a GridView control from Toolbox - Data section.  Switch to Design mode if you are in source view.  This allows you to configure the GridView's databinding properties.

Once you hover over the GridView in design mode, you get the smart tag option to chose and configure the GridView properties.  Select "Chose Data Source' - "New DataSource" and in the prompted list, select "ObjectDataSource".  The next UI would provide you with a list of Business Objects and a checkbox named "Show only Data Components".  Uncheck the checkbox so that it also shows the Business Layer Class we created.

You can select the CustomersBL that we created and the next screen allows you to "Choose your Method".  Select the GetCustomers that we had written in the Business Layer.  Once you click "Finish" you can format the GridView by selecting the Auto Format and selecting a scheme.  Also you could enable Paging, Sorting and Selection from the same wizard.  With that we are good to run the page and once you run the page you would be able to find that the Customers Records are displayed in a paged manner.

Next you would want to link the GridView to a Details View control to have a master-detailed view of the records.  To do that add a new Details View control to the page.  Configure it to use a new Object DataSource and repeat the steps as we did for the GridView, except that in the "Choose your method" screen you must choose GetCustomerByCustomerID since we would try to retrive a particular Customer Record.

You would be prompted with an additional screen to chose the input parameter settings since this method requires an input parameter.  You can chose the parameter source and in our case it is "Control" and the ControlID is "GridView1".  Also we need to specify a default value 0.

We need to do one additional step.  Select GridView properties and specify "CustomerID" in the DataKeyNames property for the GridView.

When we run the page, we initially see only the GridView neatly paged and showing the first set of records.  Upon clicking on "Select" we would be able to see the DetailsView of the selected record.  (In case you don't see the "Select" option, you might have missed "Enable Selection" in the GridView configuration)

This page now provides a kind of Master-Detailed View of the Customers Record and it retrieves data from Database using TableAdapter, Business Layer and Object DataSource which makes it a three tier architecture and thereby an Enterprise Web Application Architecture.

Cheers !!!

ASP.NET Developer Webcast Series

We are delivering an ASP.NET Developer Webcast Series next week.  Last quarter we delivered a similar web developer webcast series where we covered some of the new things that are coming up in Visual Studio 2008 for Web Developers, ASP.NET "Futures", ASP.NET 2.0 Deployment Tips and Tricks as well as AJAX Enabling ASP.NET 2.0 Applications.  You can view all of these recorded webcasts at our On Demand Page  Click on the ASP.NET link under the "By Series" section in the left and you would find all of the above webcasts.

Coming back here, ASP.NET Developer Webcast Series is something we have put to gether to help ASP.NET Developers an insight into some of the existing features as well as a preview of the upcoming features.  For example, we have the Enterprise Applications using ASP.NET 2.0 Session which focusses on current version of ASP.NET (when I am posting this, it is actually previous since ASP.NET 3.5 and Visual Studio 2008 just got released) whereas the ASP.NET 3.5 session offers a preview of the upcoming version (read spoiler in the above line).

Similarly, there is an ASP.NET Best Practices session, Silverlight Session as well as IIS 7 Session which are important for web developers.

You can register for the webcasts at http://www.microsoft.com/india/webcasts/   They are all conveniently placed post lunch and you can view them from the comfort of your work place as always in the case of webcasts.

Looking forward to seeing you all and do write to me if you need something specifically to be covered.

Cheers !!!

.NET 3.5 Beta 2, Visual Studio 2008 Beta 2 and ASP.NET 3.5 Beta Download Links


During my sessions and webcasts, I make it a point that I provide the download URLs so that developers can go back and install the same and try out the features that we demoed.

Many times people make a note of the same but forget to download due to lack to time, missing the links etc.,  As much as we internally find it hard to get the exact links, I am sure it would be worse externally for you folks to get a list of items to be downloaded and the corresponding links unless you spend a lot of time.  While I want to help a little bit with this exercise with regard to Visual Studio 2008 and Web Development, there are a whole bunch of things other than these and I would recommend you visit http://msdn.microsoft.com (wait !! did you notice that if you are from India, it takes you to an India specific page?) for the latest links.

Okay, with the above introduction, herebelow are the latest download links for all the happening technologies / updates.

Visual Studio 2005 Service Pack 1

Visual Studio 2008 Beta 2

Microsoft Silverlight 1.0

Microsoft Silverlight 1.0 SDK

Microsoft Silverlight 1.1 Alpha Refresh

Microsoft Expression Blend

Microsoft ASP.NET AJAX

AJAX Control Toolkit

Microsoft ASP.NET "Futures"

Well, the above would help you get started with developing Rich Interactive Applications using AJAX, Silverlight with ASP.NET 2.0.

The ASP.NET "Futures" is a preview release of the features that are under consideration for the upcoming versions of ASP.NET (Read my earlier posts on this topic)

While ASP.NET 2.0, AJAX and Silverlight have go live licenses and can be used for your real world applications as well as get them deployed, ASP.NET "Futures" is a developer preview release and is not production ready.

Cheers !!!

p.s. Kindly update me if there are any links I am missing so that I could update this post.

MSDN Security Summit 2007

At Microsoft, we give the highest priority to Security and always make it as a core tenet of our products and technologies.  Here again we are up with an MSDN Event for Developers, Senior Developers, Architects etc., on Security of different Applications be them Desktop Applications, Web Applications etc.,

The Security Summit 2007 is an aim to address some of the key ideas we had in implementing security in our products and technologies and how you can use them effectively to write secure code and create safer applications.

It is a 4 city tour at Mumbai, Pune, Kolkatta and Chennai and if you are around in any of these cities you must not miss this chance since it would be an excellent opportunity not only for us to bring awareness but also hear from you on how you feel our products are secured.

For FREE registration, visit http://www.microsoft.com/india/security/ss-dev.aspx chose your city and register for this event.

I am planning to be around at couple of cities and if you happen to attend the sessions, I would love to hear from you your experiences in using Microsoft Technologies.

Cheers !!!