Getting Error while running first time. DB Created successfully but not the data

Mar 15, 2012 at 12:46 PM

Where in the code do you run the 


I get the below error. My DB was created successfully though.
Introducing FOREIGN KEY constraint 'Dinner Country' on table 'Dinners' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints.Could not create constraint. See previous errors.
Mar 15, 2012 at 1:23 PM

never had this error, and nobody else had, try dropping the database, and repeat the instructions from readme.txt

Mar 15, 2012 at 1:35 PM

I tried that , but same error. 


The error is "The database creation succeeded, but the creation of the database objects did not."  

Mar 15, 2012 at 2:06 PM

have you changed anything in the code, or have you replaced some dll to newer version perhaps? , what sql server version do you have?

also I'm not calling anywhere in code System.Data.Entity.Database.SetInitializer 

Mar 15, 2012 at 2:18 PM

I havent changed any code. I am using Sqlserver 2008R2 express. 

Mar 15, 2012 at 4:22 PM

try creating a sample mvc application and use EF Code First there, see if that works 

Sep 25, 2013 at 11:20 PM
Edited Sep 26, 2013 at 10:25 AM
I just came across the same error message while trying to make the application generate the Database from the Model automatically.

If you tell the DbContext not to Cascade on delete to the Country table (because the Country table links to other tables) then this solves the problem.

I added the following to the Db : DbContext class - OnModelCreating method: