문제

이 방법을 사용하여 테이블에서 모든 레코드를 삭제하려고합니다.

new Delete<Contact>().Execute();

이 진술은 a와 함께 실패합니다 NullReferenceException 안에 BuildDeleteStatement 라인의 방법 :

sb.Append(query.FromTables[0].QualifiedName);

FromTables에는 하나의 항목이 있지만 NULL로 설정됩니다. 나는 또한 이것을 시도했지만 작동하지 않습니다.

var provider = ProviderFactory.GetProvider("MonitorData");
new Delete<Contact>(provider).Execute();

내가 뭘 잘못하고 있죠?

도움이 되었습니까?

해결책

Repo Deletemany 메소드 로이 작업을 수행 할 수 있습니다.

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

내가 사용하고있는 람다는 모든 레코드를 선택하도록하기위한 것입니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top