U2U Blog

for developers and other creative minds

AZURE Roadshow at HOWEST - demos

Last week, I did a presentation on Windows Azure at HOWEST, University College West Flanders. As promised, my hands-on-labs of this session.

1. A file archive application to upload/download files into a database in the cloud.  This application consists out of a webpage (UploadFile.aspx) to upload files into a SQL Azure database, and a REST service to dowload your files as a stream. You can dowload the sources at : CodeArchiveService.zip

To get you up and running in the develoment fabric, first create a local database in SQL Server and add a table called CodeArchive. Modify the config files to point to your database.

CREATE TABLE [dbo].[ZipArchive](
[CodeName] [varchar](200) PRIMARY KEY CLUSTERED  NOT NULL,
[CodeBlob] [varbinary](max) NULL)
 

Next, to deploy into the cloud: create a database in SQL Azure, create a login and grant access to your database and create a table called CodeArchive (same as above). Now, change the config files to point to this database.

-- On the master database:
CREATE LOGIN <login> WITH password='<password>'

-- On your database:
CREATE USER <user> FROM LOGIN <login>
EXEC sp_addrolemember 'db_owner', '<user>'
 



2. A photo browser application :

  • Contains a synchronous Upload.aspx (storage right into SQL Azure) and an asynchronous UploadAsync.aspx (blob storage to store the image temporarily + queued messaging to send a message to a background workerrole)
  • Contains a workerrole for thumbnailing the image and saving both the image and the thumbnail  in SQL Azure
  • Contains a Silverlight photo browser app which talks to a WCF service to retrieve it's data (no rocket science here to be focused on Azure stuff as much as possible)

You can dowload the sources at : PhotoBookService.zip

Tables needed (both locally and in SQL Azure):

CREATE TABLE [Photo](
    [PhotoID] [int] IDENTITY(1,1) NOT NULL PRIMARY KEY CLUSTERED,
    [ThumbNailPhoto] [varbinary](max) NULL,
    [LargePhoto] [varbinary](max) NULL)
 

CREATE TABLE [Comment](
    [PhotoID] [int] NOT NULL,
    [CommentID] [int] IDENTITY(1,1) NOT NULL,
    [Comments] [varchar](1000) NULL,
 CONSTRAINT [PK_Comment_PhotoID_CommentID] PRIMARY KEY CLUSTERED 
(
    [PhotoID] ASC,
    [CommentID] ASC
))

ALTER TABLE [dbo].[Comment]  WITH CHECK ADD  CONSTRAINT [FK_Photo_Comment] FOREIGN KEY([PhotoID])
REFERENCES [dbo].[Photo] ([PhotoID])

ALTER TABLE [dbo].[Comment] CHECK CONSTRAINT [FK_Photo_Comment]

Comments (4) -

Loading