February 29, 2012
, posted under
databasemssqlsqlEF4Entity FrameworkMVC4 Web APIMVC4I have been setting up a little web api with MVC4 and entity framework for a university project, everything was running fine on my local development machine, however when I created the database on my host (123-reg), via scripting the database (From SQL Management Studio) and removing commands 123-reg doesnt accept, my application would try and create the database, which my database account doesnt have permission to do. This was very strange behaviour as the database was in a compatible state, DbContext.Database.CompatableWithModel() returned true, but EF still thought that the database didnt exist, DbContext.Database.Exists() returned false. To fix this I found the following post on Stack Overflow http://stackoverflow.com/questions/4558377/entity-framework-4-ctp-5-code-first-development which said that the Database Intialiser needed to be set to null. After applying this change and updating my remote site everything worked as expected.
Read more...