Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/271.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用2个表删除连接和位置_C#_Subsonic_Subsonic3_Delete Record - Fatal编程技术网

C# 使用2个表删除连接和位置

C# 使用2个表删除连接和位置,c#,subsonic,subsonic3,delete-record,C#,Subsonic,Subsonic3,Delete Record,我有两张桌子 POST (idpost, user, text) COMMENT (idcomment, idpost, text) 我想删除所有带有用户“usertest”的帖子评论 如何在亚音速3中实现这一点 我试过类似的方法,但是,当然,它不起作用 COMMENT.Delete(x => x.POST.where(y => y.user == "usertest")); 我不是亚音速程序员,但StackOverflow中还有一篇关于删除表中所有记录的文章: 这似乎是一个很

我有两张桌子

POST (idpost, user, text)
COMMENT (idcomment, idpost, text)
我想删除所有带有用户“usertest”的帖子评论

如何在亚音速3中实现这一点

我试过类似的方法,但是,当然,它不起作用

COMMENT.Delete(x => x.POST.where(y => y.user == "usertest"));

我不是亚音速程序员,但StackOverflow中还有一篇关于删除表中所有记录的文章:


这似乎是一个很好的起点,但这只是一个猜测。

我不是亚音速程序员,但StackOverflow中还有一篇关于删除表中所有记录的文章:


这似乎是一个很好的起点,但这只是一个猜测。

您应该能够做到以下几点:

IQueryable<Person> query = from comments in Comment.All()
                           join posts in Post.All()
                             on posts.idpost equals comment.idpost
                           select comments;

Comment.GetRepo().Delete(query.ToList());
IQueryable query=来自Comment.All()中的注释
在Post.All()中加入Post
在posts.idpost上等于comment.idpost
选择评论;
Comment.GetRepo().Delete(query.ToList());

您应该能够执行以下操作:

IQueryable<Person> query = from comments in Comment.All()
                           join posts in Post.All()
                             on posts.idpost equals comment.idpost
                           select comments;

Comment.GetRepo().Delete(query.ToList());
IQueryable query=来自Comment.All()中的注释
在Post.All()中加入Post
在posts.idpost上等于comment.idpost
选择评论;
Comment.GetRepo().Delete(query.ToList());