title: LINQ to Entity : truncate table fails because of foreign key constraint
body: <p>In my database, I have a parent table and a child table with foreign key pointing to the parent.. at some point I have to clear all rows from both tables.</p>
  
  <p>I used the following code in Entity Framework:</p>
  
  <pre><code>using (MuseumDBEntities db = new MuseumDBEntities())
  {
     db.Database.ExecuteSqlCommand("truncate table childTable");
     db.Database.ExecuteSqlCommand("truncate table parentTable");
  }
  </code></pre>
  
  <p>I get an exception at the second truncate because of foreign key, although I am clearing child table first.</p>
  
  <p>What should I do? Is there another way to delete all rows of both tables?</p>
  
  <p>I don't know if a foreach loop over all rows is practical.</p>