title: How to increase database insert performance with Entity Framework
body: <p>I have my first project with Entity Framework and SQL Server Compact. </p>
  
  <p>The database has about 15 tables which all have foreign keys to other tables.
  I have to read thousands of XML files and import their data to the database. The database structure mirrors the XML file structure. There is a table hierarchy with up to 5 levels. So for each record in the "top" table I have to insert one or more in the underlying tables. </p>
  
  <p>I am using Entity Framework for inserting and it works fine, but the performance is very very poor :(. 
  I think the main problem is that for most records the ID has to be read back to be used for records in underlying tables. </p>
  
  <p>The other thing is that - if I know right - that Entity Framework inserts each record with a separate command.</p>
  
  <p>Is there a way to increase the performance dramatically?</p>
  
  <p>Thank you</p>