Developing for SQL Azure offline

2019-05-24 03:38发布

问题:

This is probably a stupid question, but I'd like to start moving a couple of web apps over to azure. I'm not doing anything particularly difficult in them and have solved all of my development concerns (deployment is another can of worms) so far except for one thing. How do I work on these projects without connecting to azure? That is, I frequently work in places with wifi that is flat out horrid or non-existent. How do I set things up so I can still work against a database if I cannot connect to SQL Azure in the cloud? Currently I'm not using azure table storage or anything, just plain old SQL, although I have a few pieces that I think would benefit from table storage or blob storage. What's the best way to make disconnected development painless?

回答1:

The Azure SDK includes local versions of the various services so you can work offline from the start. SQL Azure is essentially SQL Server with some limitations, so you can program against a local version of SQL Server Express.

You only need a connection when you have to deploy your application to Azure.

If you check the "Getting Started" tutorial, you'll see that development is done against localhost. The site is deployed to Azure only when you select "Publish Web Site".

An even better tutorial is "Deploy a Secure ASP.NET MVC app with Membership, OAuth, and SQL Database to a Windows Azure Web Site" which includes publishing a database to Azure.

In the "Create a Data Deployment Script" section, the tutorial uses the instance of SQL Server Express installed on the local machine.

I think it needs repeating, SQL Azure is NOT a special database that has to be installed locally. It is actually SQL Server which means you can right the exact same code and use the same tools for SQL Server and SQL Azure.

You can simply use SQL Server Express to create programs that work with SQL Azure