Generate SQL Server Express database from Entity Framework 4 model

Posted by Cranialsurge on Stack Overflow See other posts from Stack Overflow or by Cranialsurge
Published on 2010-12-25T04:41:10Z Indexed on 2010/12/25 4:54 UTC
Read the original article Hit count: 326

I am able to auto-generate a SQL Server CE 4.0 *.sdf file using code-first generation as explained by Scott Guthrie here. The connection string for the same is as follows:

<add name="NerdDinners" providerName="System.Data.SqlServerCe.4.0" 
connectionString="data  source=|DataDirectory|NerdDinner.sdf"/>

However if I try to generate an mdf instead using the following connection string, it fails to do so with the following error - "The provider did not return a ProviderManifestToken string.".

<add name="NerdDinners" providerName="System.Data.SqlClient" connectionString="data 
source=|DataDirectory|NerdDinner.mdf"/>

Even directly hooking into a SQLEXPRESS instance using the following connection string fails

<add name="NerdDinners" providerName="System.Data.SqlClient" connectionString="Data 
 Source=.\SQLEXPRESS;Initial Catalog=NerdDinner;Integrated Security=True"/>

Does EF 4 only support SQL CE 4.0 for database creation from a model for now or am I doing something wrong here?

© Stack Overflow or respective owner

Related posts about sql-server

Related posts about entity-framework-4