Quantcast
Channel: patterns & practices: Project Silk
Viewing all articles
Browse latest Browse all 93

New Post: How do you enable database Seeding?

$
0
0

I am fairly new to C#, MVC, etc., but I'm so glad Project Silk is available for learning!

I used the Silk code as a guide for a new project, so my project is almost exactly the same. I am using the same repository initializer code and also using the DropCreateIfModelChangesSqlCeInitializer.

My problem is that I absolutely cannot get any Seed data to fill in the database! The database creates, as expected, and I can view it, and I can add data to it just fine. But no matter if I delete the .sdf database file and let Entity recreate it or if I change to the DropCreateAlwaysSqlCeInitializer, it never uses the Seed() method to add sample data. I copied over the code to Seed the Countries, so that's in the DbContextSeedData.cs file. And I can see in the DropCreateIfModelChangesSqlCeInitializer.cs file that it is calling this.Seed(context); but it is absolutely not seeding the database.

Can anyone help point me in the right direction here please? What I missing to cause the Seed() method to happen?

(if I didn't provide some necessary information, please let me know! Sorry if I did.)


Viewing all articles
Browse latest Browse all 93

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>