diTii.com Digital News Hub

Sign up with your email address to be the first to know about latest news and more.

I agree to have my personal information transfered to MailChimp (more information)


Writing BLOBs from SQL Azure to Windows Azure Storage

“Imagine that our company mandates images of their products to be stored in database along with other product data like title, price, and description. One way to serve those images up on a web page is to retrieve them from database & stream them to browser. However, a better idea might be to read them from database on first request, and write them to Windows Azure Storage where they’re served up on every request. You would get data integrity of keeping your images with your other product data in SQL Azure and performance benefit of streaming a static file from Azure Storage. This’s especially beneficial if we can take advantage of Windows Azure Content Delivery Network.

Following code sample implements this scenario using Adventure Works database, which stores product thumbnails as varbinary(max), and is designed to do these things:Run from Azure platform. Serve images from a request to an ASP.NET page using a product id in query string. Reads image from Products table in Adventure Works database and writes thumbnail image to Azure Storage if it doesn’t already exist Redirects browser to Azure Storage to serve the image. Uses streaming so that whole images isn’t loaded into memory space,” explains Microsoft.

More Info: Code

Share This Story, Choose Your Platform!