title: Need help with ADO.NET Entity Framework UpdateException
body: <p>I have in my Database a Contact table and a Phone table, in the phone table there is column "ContactId" with a key that references the phone to the contact.</p>
  
  <p>In the key options in the server I set its delete option to 'Cascade'.</p>
  
  <p>Now when I attempt to delete a contact using the context:</p>
  
  <pre><code>Dim contact As Contact 'The contact I want to delete.
  Dim context As New Entities 'The ObjectContext.
  context.DeleteObject(contact)
  context.SaveChanges()
  </code></pre>
  
  <p>The above statement throws an UpdateException letting me know that the Contact still have Phone records whose ContactId col is set to its ID.</p>
  
  <p>Now I know that I can do it manually and delete first all the related phones then remove the contact, but I am looking for a more efficient way, I want all this should be done automatically.</p>
  
  <p>Any suggestions and practices are welcomed.</p>
  
  <p>Thanks.</p>