SQLite.Net-PCL (InsertOrReplace) vulnerability

foreach (var tour in Tours)
            {
                await DbInstance.InsertOrReplaceAsync(tour.Guide);
                await DbInstance.InsertOrReplaceAsync(tour.Client);
            }

      

This block takes 6 seconds to complete !?

I only have 10 tours in the Tours list and the database schema is very simple. What is the problem?

EDIT (SOLUTION):

To speed it up, wrap multiple transactions like this:

await DbInstance.RunInTransactionAsync(connection =>
        {

           **YOUR FOR LOOP**
           //example
           connection.InsertAsync(tour.Guide);
        });

      

+3


source to share





All Articles