亚音速3 - 这些方法有什么区别?

时间:2021-04-11 13:28:54

This method works fine:

这种方法很好:

Person p = new Person(3);
p.Name = "Bob";
p.Update();

However if I have an IQueryable foreign key collection the below fails

但是,如果我有一个IQueryable外键集合,则以下内容失败

var foreignItems = Person.Find(x => x.ID == 3)
foreach(Person p in foreignItems)
{
  p.Name = "Bob";
  p.Update(); /*THROWS EXCEPTION */
}

Exception is thrown in Repository Update as it executes a query from BuildUpdateQuery such as - UPDATE PERSON WHERE ID = {0} which is wrong syntax!

存储库更新中会抛出异常,因为它从BuildUpdateQuery执行查询,例如 - UPDATE PERSON WHERE ID = {0},这是错误的语法!

1 个解决方案

#1


This looks like a bug, you should report it to github (the new host for SubSonic source). In the meantime does calling p.Save() may work around the issue.

这看起来像一个bug,你应该将它报告给github(SubSonic源的新主机)。与此同时,调用p.Save()可以解决这个问题。

#1


This looks like a bug, you should report it to github (the new host for SubSonic source). In the meantime does calling p.Save() may work around the issue.

这看起来像一个bug,你应该将它报告给github(SubSonic源的新主机)。与此同时,调用p.Save()可以解决这个问题。