Hello team,
using Xamarin forms XAML with C# code
I need the best method to store the data in SQL lite. Please find the below table structure.
Table:
C#
public class tblItemList
{
[Collation("NOCASE")]
public string parent { get; set; }
[Collation("NOCASE")]
public string child { get; set; }
}I need to store above 1 lack records, and I have a record list in the table class. Currently, I have for loop storing the table data. It is taking more time to save.
code:
C#
List itemlist = JsonConvert.DeserializeObject>(DecryptString(result));
foreach (tblItemList item in itemlist)
{
var ddd = await App.Database.SaveItemAsync(item);
}Table creating method:
C#
public DBworker(string dbPath)
{
database = new SQLiteAsyncConnection(dbPath);
database.CreateTableAsync().Wait();
}Inserting method:
C#
public Task SaveItemAsync(tblItemList itemList)
{
// Save a new note.
return database.InsertAsync(itemList);
}In saving above 1 lack records, it will take 30 min’s, so I need to store in quick method, please suggest any best method for storing data in SQL lite db.


Mario ScheerenRank #1,371 · 1.2K reputationPosted Jul 15, 2021, 5:29 AM EDT