title: How to bulk insert into SQLITE database?
body: <p>I am developing UWP application. </p>
  
  <p>I have a database that should be initialized with about 20,000 records. The records, that are defined as follows:</p>
  
  <pre><code>private static readonly ObservableCollection&lt;TickRecord&gt; TickRecords = new ObservableCollection&lt;TickRecord&gt;();
  </code></pre>
  
  <p>I tried to insert the records one at a time like this:</p>
  
  <pre><code>private void CreateFakeTickRecords()
  {
  if ( Database.Database.CountTickRecords() &gt; 0 )
      {
      return;
      }
  
  foreach ( var tickRecord in TickRecords )
      {
      Database.Database.AddOrUpdateTickRecord( tickRecord );
      }
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>public static void AddOrUpdateTickRecord( TickRecord tickRecord )
  {
      // Create a new connection
      using ( var db = new SQLiteConnection( new SQLitePlatformWinRT(), DbPath ) )
      {
      if ( tickRecord.Id == 0 )
          {
          // New
          db.Insert( tickRecord );
          }
      else
          {
          // Update
          db.Update( tickRecord );
          }
      }
  }
  </code></pre>
  
  <p>This code works fine, however it is way too slow.</p>
  
  <p>I would like to modify it so I can do a "Bulk Insert".</p>
  
  <p>How do I do that?</p>
  
  <p>Thx</p>