The most efficient way to delete database data in Entity Framework 4?

To test integration, I need to erase all information about the data in the database. I am using Entity Framework 4 What is the most efficient way? It would be nice if I did not need to specify the names of tables or classes every time I add a new class to the model.

Thank!

+3
source share
2 answers

The most efficient way to delete database data is to delete all tables and recreate all tables.

+2
source

It may not be the fastest, but the easiest. It even cleans the connection pool:

using (var context = new DataContext())
{
    context.Database.Delete();
}
+2
source

Source: https://habr.com/ru/post/1795154/


All Articles