A look on Database [SQL Azure] option of new Windows Azure portal

Windows Azure Development portal has been moved to new Silverlight based portal. It has all new look and many new features.

SQL Azure can be explored by selecting Database option from the left panel.


New SQL Azure portal is having very nice Silverlight based user interactive UI and many more operations can be performed through the UI. There is new database manager and it allows us to perform operations at table and row level.

Now we can perform many more operations through Database option of new Windows azure portal.

1. Create a database

2. Create/ delete a table

3. Create/edit/delete rows of table.

4. Create/edit stored procedure

5. Create/edit views

6. Create / execute queries etc. . . .

Let us have a walkthrough on various operations we can perform on Database option of new Windows Azure portal.

To create new Database, select Data base server and from Database section, select Create option.


You will get the below popup, select subscription and server from drop down


Give name of the Database, select Edition and maximum size of the database.


Once database got created, select Manage option from top to open Data Base Manager.


Accept given term and conditions and click Ok.


After Ok, you will get popup asking password to connect to database. Provide password and click on Connect .


After successful connection , you will get a cube providing all the information about the database you connected.


You can perform all the database operations from the top ribbon. You have option to create new query, new table, new view, and new stored procedure


If we want to create new table, click on New Table option from ribbon. We are creating a table with name Blogger. We are giving there columns ID, Name and Technology. From drop down we can select data type for the columns .


Then click on save button at top,


You can navigate between Data Base and Table tab. You can create and delete column from here also. Once you click on save button, you can see table listed at left panel.


At top you can see you have option to navigate either design or data view of table. Click on Data tab to navigate to Data view.

Click on Row to add a Row in the table.


After adding two rows, you can see table as below. You can add and delete rows from top button also.


Now to execute query, select Data Base tab at top and execute query as below,


When you click Execute button at top, you will get output as below,


In this way , you can perform almost all the basic operations from new SQL Azure Data Base Manager.

Windows Azure for Developers Task 10: Creating Storage Account in new Silverlight based Windows Azure Portal

1. Login to Windows Azure Development portal.

2. After login at left panel you can see number of storage and service account in your subscription.


3. Select subscription and storage account option to create new Storage Account. At top left, you will get New Storage Account option. To create new storage account click on new Storage Account.


4. Provide all the required information,


a. Choose subscription.

b. Give unique name URL. It must be combination of only lower letters and numbers.

c. Choose a region, and click on Create.

5. Now you can see storage account has been created.


6. Click on storage account and at right side panel you can see properties.


In properties window we can see URL for BLOB, Queue and Table access. We will have to use these URL to access table, queue or blob.

7. To view the Primary key and Secondary key click on View Button.


In this way , we can create a Storage Account in new Silverlight based Azure Portal.

Windows Azure for Developers Task 9: Hosting WCF Service Role in Windows Azure Hosted Service

In Previous Article We saw How to work with WCF Service Web Role

I am going to extend previous article to publish in hosted service.

Hosting WCF Service Role in hosted service is exactly the same as we host  ASP.Net Web Role.

1. Login to Azure Development portal.

2. Create a new hosted service. If you want you can upgrade any existing hosted service to host WCF Service role also.

Read here, Creating Hosted Service in Windows Azure

3. To upgrade the hosted service ; browse locally


4. Right click on Azure project and select Publish.

5. Now while upgrading hosted service, select browse locally option and navigate to folder containing the files.

6. Once publishing done, you can navigate to the URL. On navigation you may get below error in browser


Do not be panic and append Service1.svc with URL and you will get WCF Service Web Role up and running


7. We can consume service exactly in same way , we consume normal WCF Service.

Windows Azure for Developers Task 8: Working with WCF Service Web Role

WCF Service Role enables us to create WCF service and host in Windows Azure. In this article, we will create a WCF Service Role and host on local development fabric and consume in a console application. In second part of this article we will move WCF Service to Azure portal.


To start with,

1. Create a New Project

2. Navigate to cloud tab

3. Create Windows Azure Project
4. Select WCF Service Role from given options.




If you give a look in solution explorer, you will find in WCF Service Role project contains exactly the same structure and files as of when you create a normal WCF Service Application. It contains ,


1. IService1.cs (Service Contract )
2. Service1.svc.cs ( Service definition file )
3. Web.config ( configuration for EndPoints)


We can modify these files accordingly for our purpose in exactly the same way; we do in usual WCF Service Application.


Let us modify Service Contract as below,



using System.ServiceModel;

namespace WCFServiceWebRole1
 public interface IService1

 string GetData(int value);



And service definition would be,



namespace WCFServiceWebRole1

 public class Service1 : IService1
 public string GetData(int value)
 return string.Format("You entered: {0}", value);




Leave default configuration in Web.Config


Make sure you have set Windows Azure project as Startup project and run the application. In browser you will get below error message.




Ignore this message and append service.svc with URL, so now URL would be Service.svc is name of the service definition.
After appending you will get usual WCF Service message in browser.




To test this WCF Service role in a console client,


1. Create a console application project
2. Add Service Reference by providing URL




Now we will make a normal service call,



using System;
using ConsoleApplication14.ServiceReference1;

namespace ConsoleApplication14
 class Program
 static void Main(string[] args)
 Service1Client proxy = new Service1Client();
 var result = proxy.GetData(99);



Now when you run you may or may not get below exception.




To solve above exception, we have to edit App.Config file. We need to change


clip_image009 to localhost. Because it might be the case console application is not able to resolve . we need to change to localhost.


Now on running we will get below output




One behavior need to be noticed here is that sometime you may get time out exception after changing to localhost also. In my further articles, I will drill down this unwanted behavior.

Type casting with is and as operator in C#

I have been seeing many developers are casting between two types using is operator. As we know, we do have as operator also for type casting.

For purpose of this article, we are going to use below two classes,


Very first let us try to understand, how is operator works?


So , if we are running below code , we will get output as true because ofccouse p is a Player.


Now let us modify code a bit and check whether p is compatible to Math class or not? Since p is instance of class Player and Player class does not have Math class in hierarchy tree, so output we will get false.


If we compare an object against null, we will get always an output as false.

Normally we use is operator like below,


In above snippet, C# checks type compatibility twice and it costs the performance. So to simplify above code and improve performance C# gives us as operator to compare.


as operator find type compatibility, If an object is not compatible with given type then as operator returns null.