I am trying to save multiple objects at once in a ASP.NET project to Parse.com backend. I have tried to save it one by one but in some cases it returns me error in the middle of saving process. So some of my objects are being saved some are not. Here is the code I am using:
ParseObject gameScore
foreach (DataRow row in dataTable.Rows) //imagine here I am saving 1000 objects
{
gameScore = new ParseObject("SALON");
gameScore["NAME"] = "NAMETEMP";
await gameScore.SaveAsync();
}
Rather than make individual requests to save each object, try using the saveAll method which will batch them:
List<ParseObject> scores = new List<ParseObject>();
foreach (DataRow row in dataTable.Rows) //imagine here I am saving 1000 objects
{
gameScore = new ParseObject("SALON");
gameScore["NAME"] = "NAMETEMP";
scores.Add(gameScore);
}
await ParseObject.SaveAllAsync(scores);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With