For integration testing I need to wipe all data information in a database. I'm using Entity Framework 4 What's the most efficient way? Would be nice if I don't need to specify table or class names every time I add a new class to the model.
Thanks!
Most efficient way to delete database data is to drop all tables and recreate all tables.
This may not be the fastest, but it is the simplest. It even clears your connection pool:
using (var context = new DataContext())
{
context.Database.Delete();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With