Skip to content

Instantly share code, notes, and snippets.

@johnw86
Created May 11, 2012 10:07
Show Gist options
  • Save johnw86/2658732 to your computer and use it in GitHub Desktop.
Save johnw86/2658732 to your computer and use it in GitHub Desktop.
Entity Framework connections for both SQL CE and SQL
//Sql CE - Database name will be set based on the DbContext inherited class
//If no App_Data folder exists you need to create it
Database.DefaultConnectionFactory = new SqlCeConnectionFactory("System.Data.SqlServerCe.4.0");
//Uses default conn string but setting a connection string in config with the name of the context will override conn string
Database.DefaultConnectionFactory = new SqlConnectionFactory();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment