Activerecord 如何使用亚音速3删除表中的所有记录

Activerecord 如何使用亚音速3删除表中的所有记录,activerecord,subsonic,subsonic3,delete-record,Activerecord,Subsonic,Subsonic3,Delete Record,我尝试使用以下方法从表中删除所有记录: new Delete<Contact>().Execute(); 因为,尽管FromTables有一个条目,但它被设置为null。我也试过了,但也不起作用: var provider = ProviderFactory.GetProvider("MonitorData"); new Delete<Contact>(provider).Execute(); var provider=ProviderFactory.GetProvi

我尝试使用以下方法从表中删除所有记录:

new Delete<Contact>().Execute();
因为,尽管FromTables有一个条目,但它被设置为null。我也试过了,但也不起作用:

var provider = ProviderFactory.GetProvider("MonitorData");
new Delete<Contact>(provider).Execute();
var provider=ProviderFactory.GetProvider(“MonitorData”);
新建删除(提供程序).Execute();

我做错了什么?

您可以使用回购删除多个方法:

SubSonicRepository<Contact> repo = new SubSonicRepository<Contact>(new YourDB());
repo.DeleteMany(contact => true);
SubSonicRepository repo=new SubSonicRepository(new YourDB());
repo.DeleteMany(contact=>true);
我使用的lambda只是为了确保选中所有记录

SubSonicRepository<Contact> repo = new SubSonicRepository<Contact>(new YourDB());
repo.DeleteMany(contact => true);