This post is part of a series called “Windows Azure for the ASP.NET Developer”, so if you've been considering migrating your ASP.NET Web Forms or MVC app to Windows Azure or SQL Azure, take some time to review the posts in this series. Here you will find answers to questions like "Why Move My ASP.NET Development To The Cloud?" and "What Are The Differences Between Windows Azure & Windows Server?" that frequently arise.
ASP.NET Business applications are most often forms-over-data that provide basic CRUD operations plus business logic. For those looking to port CRUD apps, you can move your code, the data, or both, over the Windows Azure platform. Naturally, if you are porting your app to Windows Azure, you will need to consider these different approaches in data storage and retrieval.
Approaches to working with data on Windows Azure
- BLOB (Binary Large OBject) storage: BLOB Storage is the simplest way to store large amounts of unstructured text or binary data such as video, audio and images.
- Table storage: Table Storage is used by applications requiring storing large amounts of data storage that need additional structure. While a table stores structured data, it does not provide any way to represent relationships between the data, sometimes called a NoSQL database. You can use SQL Azure for relational database service on Windows Azure.
- Queue: Queues are used for reliable, persistent messaging between applications. You can use Queues to transfer messages between applications or services in Windows Azure.
- Windows Azure Drive: Windows Azure Drive allows applications to mount a Blob formatted as a single volume NTFS VHD. You can move your VHDs between private and public clouds using Windows Azure Drive.
Of course, you can choose to host your app in the cloud and keep your data on premise, or vice versa. Lastly, hybrid solutions are a great way to both offload some hardware and management costs while migrating to a full cloud solution. The Windows Azure & SQL Azure suite of products has something for everyone.
Since most applications are brownfield development (i.e., in maintenance mode), hybrid solutions are key. Hybrid Azure solutions can have any combination of data and/or software and/or services, in the cloud and/or on premise. Because the architecture is so flexible, you will likely have data in multiple locations that require management and synchronization services. Fortunately, SQL Azure Data Sync provides data synchronization and transfer services in an easy to use UI, so there is little need to spend lots of time on complex SQL statements, though you can use them if you already a set of stored procedures or queries that you regularly run for maintenance.
ASP.NET developers accessing objects in Windows Azure Blob storage have two options for their data management code, a REST API and a Managed Library, samples of both shown below.
REST API GET
Managed Library via C#
For a complete list of BLOB operations in Windows Azure, see "Storing and Accessing Data in Windows Azure".
What to do with your existing data: SQL Azure or SQL Server
For those ASP.NET developers who have existing SQL Server databases, fear not, you have choices. You can use ADO.NET to access SQL Azure, just as you would when developing against SQL Server in any .NET language. If you want broader access to your data with less administration SQL Azure is just as friendly and familiar for ASP.NET developers (and the IT Pros they work with) as SQL Server, as it offers an online management portal that anyone can use. The SQL Azure landing page is a great place to start familiarizing yourself as you get started with SQL Azure.
As you might expect, SQL Azure is an RDBMS much like SQL Server, and it can function entirely as a replacement to SQL Server, although there could be some limitations, depending on your individual scenario. You can expect the wide range of SQL features that are familiar such as sqlcmd for command line access to DDL & DML commands, ASP.NET data binding tools and code, and support for transactions.
The easiest migration path for most databases is to use the SQL Azure Migration Wizard to move your SQL Server databases directly to SQL Azure. The SQL Azure Migration Wizard offers a number of options for migrating data to the cloud, so you can create a full cloud, or hybrid, solution, and with all the available options in Windows Azure Platform, you can drive the migration path exactly as you want.
If you are using ASP.NET MVC you can use Entity Framework to access SQL Azure, SQL Server, and Windows Azure, and your stored procedures will remain the same if you port them to SQL Azure from SQL Server. Those developers working on ASP.NET Web Forms will continue to enjoy accessing data through the familiar SQLDatasource, ObjectDataSource, and other drag and drop controls.
ASP.NET developers also have to migrate ASP.NET Membership databases, and while the process is smooth overall, there can be some gotchas.
Getting started with Windows Azure & SQL Azure data access is easy for ASP.NET developers. The Windows Azure Platform offers many management and storage options for your data, old or new. If you are migrating your on premise apps to Windows Azure, in whole or part, see Migrating Applications to Windows Azure for more details.