简体   繁体   English

如何使用c#删除Parse中的所有对象(行)

[英]How to delete all objects (rows) in Parse using c#

Basically, I want to clear a table (or class as Parse names it) and then repopulate it with new values.基本上,我想清除一个表(或 Parse 命名的类),然后用新值重新填充它。 Repopulation is not a issue, I cannot figure out how to delete all objects in the class.重新填充不是问题,我不知道如何删除类中的所有对象。
I am coding in c#.我在 C# 中编码。
Edit: I have tried to accomplish this by编辑:我试图通过

ParseObject question = new ParseObject("questions");  
await question.DeleteAsync();  
await question.SaveAsync();

I have also tried to grasp the query, but to no avail.我也试图掌握查询,但无济于事。 I (think I) can run the query, but then I dont know how to perform the delete operation on the data.我(认为我)可以运行查询,但是我不知道如何对数据执行删除操作。

ParseQuery<ParseObject> query = new ParseQuery<ParseObject>();  
await query.FindAsync();  

Solved:解决了:

IEnumerable<ParseObject> query = await ParseObject.GetQuery(q_parse_table_name).WhereEqualTo(q_parse_column_qSet, qSetNo).FindAsync();
foreach (ParseObject po in query)
 await po.DeleteAsync();

Well the documentation is not very good but I can give the algorithmic steps that you can try.好吧,文档不是很好,但我可以提供您可以尝试的算法步骤。 First, get all the objects using the query.首先,使用查询获取所有对象。 Once you have got the objects, you can use the destroy method to delete all the data.获得对象后,您可以使用 destroy 方法删除所有数据。 Finally execute save method.最后执行save方法。 Let me know if this works.让我知道这个是否奏效。

Edit: Try await myObject.DeleteAsync();编辑:尝试await myObject.DeleteAsync(); on the object.在对象上。

You may use您可以使用

public void Dispose() 
{ 
Finalize(); 
System.GC.SuppressFinalize(this); 
} 


}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM