Reputation: 452
I want to seed my database with test data but it looks as if the DbInitializer class requires a DbContext class or a class derived from DbContext. So far I've learned ASP.NET through the tutorials which use EF. Now I'm moving to a different ORM (Dapper) but I still want to seed my database with test data. I tried googling "Seed database without using EF" and all the results are about using EF code first. Is there a different class or method that I can use for this?
Upvotes: 1
Views: 1269
Reputation: 62280
Dapper is just a wrapper around ADO.NET. It doesn't know anything about underlying tables, column types and relationships like EF. So, you cannot use DbInitializer for creating tables.
For seed, you could just execute a bunch of insert statements on application start using Dapper.
Upvotes: 5