none
Code-First EF hosted SqlAzure (not creating tables)

    Question

  • I have a funny situation where if I take a simple EF "code-first" example (for instance, the one laid out in the Code-First Walkthrough [ http://blogs.msdn.com/b/adonet/archive/2010/07/14/ctp4codefirstwalkthrough.aspx ]) it works just fine against a locally running instance of SQL Express.

     

    However if I target it at my SqlAzure instance, it creates the DB, BUT it fails to create any of the tables.  Then (in the example) when it attempts to SaveChanges() it bombs saying dbo.People does not exist (which it doesn't).

     

    Is there some kind of configuration trick I'm missing when targeting SQL Azure?  I'm assuming this is a head-slapping newby question - so thanks [for your answers, and your patience!]

     


    Phil Cockfield
    Sunday, July 18, 2010 7:32 PM

Answers

  • Phil,

    In this CTP release we haven't addressed all the issues with regards to working with SQL Azure.  It is high on our list to get these issues worked out and we will certainly be making sure there is a good experience there before we release an RTM version, but for now you may not be able to use the full Code First experience with Azure.  Sorry about that.

    Thanks,
    Arthur

     

    Monday, July 19, 2010 4:56 PM

All replies

  • Phil,

    In this CTP release we haven't addressed all the issues with regards to working with SQL Azure.  It is high on our list to get these issues worked out and we will certainly be making sure there is a good experience there before we release an RTM version, but for now you may not be able to use the full Code First experience with Azure.  Sorry about that.

    Thanks,
    Arthur

     

    Monday, July 19, 2010 4:56 PM
  • OK, thanks Arthur.

    I know you can't give dates or anything like that, but was wondering the RTM of this something that you'll do out of band, or are we waiting a year to see this release?

    Thanks!


    Phil Cockfield
    Monday, July 19, 2010 5:52 PM
  • With regard to RTM, I probably couldn't tell you even if I did know, but actually I don't know--we're really still working on the best way to get this work out there.

    Thanks,
    Arthur

    Tuesday, July 20, 2010 3:25 PM
  • Cheers - thanks anyway Arthur.
    Phil Cockfield
    Tuesday, July 20, 2010 3:34 PM
  • Hi,

    Is there any good news. I want to use Code-First with Azure, is it a good idea/possibility?

    Thursday, February 03, 2011 2:49 AM
  • Hi,

    CTP5 does work against SQL Azure. There are a couple of things to be aware of if you want Code First to create the database:

    • The login needs access to the master database
    • Specify 'PersistSecurityInfo=True;' in your connection string so that EF is able to create a connection to master

    Obviously these aren't good things for your application to always have when it is running out in the wild, so I would only use such a connection string to allow Code First to create the database.

    ~Rowan

    Friday, February 04, 2011 9:48 PM