entity framework - EF6 Beta1 - db.Database.CreateIfNotExists(); doesn't create the database anymore after enabling the migration -
db.database.createifnotexists(); doesn't create database anymore , return true after enabling migration. don't see mentioned in release node well. bug?
note both automaticmigrationsenabled = true or false not working after "enable-migrations" in nuget console.
public void testmethod1() { //using (var db = new hive.models.hivedbcontext()) { using (var db = new testdbcontext()) { var returnvalue = db.database.createifnotexists(); console.writeline(returnvalue); } } public class testdbcontext : dbcontext { } internal sealed class configuration : dbmigrationsconfiguration<unittestproject1.testdbcontext> { public configuration() { automaticmigrationsenabled = true; } protected override void seed(unittestproject1.testdbcontext context) { // method called after migrating latest version. // can use dbset<t>.addorupdate() helper extension method // avoid creating duplicate seed data. e.g. // // context.people.addorupdate( // p => p.fullname, // new person { fullname = "andrew peters" }, // new person { fullname = "brice lambson" }, // new person { fullname = "rowan miller" } // ); // } }
ef team responded me it's new changes in ef. please refer thread. https://entityframework.codeplex.com/discussions/450998
Comments
Post a Comment