Hi I’m using the Beta 1 version of this nuGet package, the database is allready created and I need to know if there is a way to populate my tables through migrations. Thanxs
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
The intro post shows how to seed data
http://blogs.msdn.com/b/adonet/archive/2011/11/29/code-first-migrations-beta-1-no-magic-walkthrough.aspx
Seed data:
Override the Seed method in this class to add seed data.
– The Seed method will be called after migrating to the latest version.
– You can use the DbContext.AddOrUpdate() helper extension method to avoid creating
duplicate seed data. E.g.
myContext.AddOrUpdate(c => c.FullName,
new Customer { FullName = "Andrew Peters", CustomerNumber = 123 },
);
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0