Is the Entity Framework compatible with SQL Azure?

While I haven't done this myself I'm pretty sure that members on the EF team have, as has Kevin Hoffman .

Up vote 2 down vote favorite share g+ share fb share tw.

I cannot get the Entity Framework to work against SQL Azure. Is this just me or is it not intended to be compatible? (I have tried the original release of EF with VS2008 as well as the more recent VS2010 Beta 2 version) To check this I created the simplest scenario possible.

Add a single table to a local SQL Server 2008 instance. The table has two columns, a primary key of type integer and a string column. I add a single row to the table with values of (1, foobar).

I then added exactly the same setup to my SQL Azure database. Created a console application and generated an EF model from the local database. Run the application and all is good, the single row can be returned from a trivial query.

Update the connection string to connect to the SQL Azure and now it fails. It connects to the SQL Azure database without problems but the query fails on processing the result. I tracked the initial problem down using the exception information.

The conceptual model had the attribute Schema="dbo" set for the entity set of my single defined entity. I removed this attribute and now it fails with another error... "Invalid object name 'testModelStoreContainer. Test'.

" Where 'Test' is of course the name of the entity I have defined and so it looks like it's trying to create the entity from the returned result. But for some unknown reason cannot work out this trivial scenario. So either I am making a really fundamental error or SQL Azure is not compatible with the EF?

And that seems just crazy to me. I want to use the EF in my WebRole and then RIA Services to the Silverlight client end. Entity-framework sql-azure link|improve this question edited Apr 9 '10 at 5:36Roger Pate asked Dec 12 '09 at 10:23Phil Wright8,19123063 100% accept rate.

While I haven't done this myself I'm pretty sure that members on the EF team have, as has Kevin Hoffman. So it is probably just that you went astray with one step in your porting process. It sounds like you tried to update the EDMX (XML) by hand, from one that works against a local database.

If you do this most of the changes will be required in the StorageModel element in the EDMX (aka SSDL). But it sounds like you've been making changes in the ConceptualModel (aka CSDL) element. My guess is you simply need to replace all references to the dbo schema in the SSDL with whatever schema is the SQL Azure schema.

Hope this helps Alex.

To answer the main question - Yes, at least the Entity Framework v4 can be used with SQL Azure - I haven't honestly tried with the initial version (from the . Net Framework 3.5. SP 1). A little while back I did a complete project and blogged about the experience: sanderstechnology.com/?p=9961 Hopefully this might help a little bit!

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions