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:
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:
List<tblItemList> itemlist = JsonConvert.DeserializeObject<List<tblItemList>>(DecryptString(result)); foreach (tblItemList item in itemlist) { var ddd = await App.Database.SaveItemAsync(item); }
Table creating method:
public DBworker(string dbPath) { database = new SQLiteAsyncConnection(dbPath); database.CreateTableAsync<tblItemList>().Wait(); }
Inserting method:
public Task<int> 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.