Sql Azure Archives - Digital Tool Factory blog Sql Azure Archives - Digital Tool Factory blog

The Digital Tool Factory Blog

How to create a Sql Azure database with Entity Framework codefirst

'King Cloud' photo (c) 2007, Karen Ka Ying Wong - license: http://creativecommons.org/licenses/by-sa/2.0/I’ve lately begun to use Windows Azure, and I thought I would start blogging about it as well.

Sql Azure database with entity framework codefirst – the song remains the same

As I am deeply committed to using ASP.net MVC 3 with Entity Framework CodeFirst, I thought at first moving to Azure might be a problem, as Sql Azure is marketed as a cousin to Sql Server, and not the real thing.  Happily that seems not to be the case.

I searched for a guide on how to use Entity Framework Codefirst with Sql Azure and couldn’t find one – so I just up and tried it and it worked quite well.  It works just like the regular Codefirst method, only you must specify the proper sql azure database in the web.Debug.config and the web.Release.config files.  Furthermore, that database must not already exist.  The Windows Azure admin screens strongly guide you in the direction of creating an initial database, but I’ve found if you just delete your default database it will create one for you.

So, in sum, you just treat Sql Azure the same as you would any other Sql Server database.  I’m not sure why Microsoft is marketing it as something radically different, but so far I have not discovered any meaningful differences between the two systems.


03
May 12


Written By Steve French

 




Copyright 2011 Digital Tool Factory. All Rights Reserved. Powered by raw technical talent. And in this case, WordPress.