Subsonic 更新多行而不是 1 行?
Subsonic 3.0 正在更新多行,而不仅仅是它应该
DB Table is defined as follows -
Col1 int NOT NULL
Col2 Text NOT NULL
Col3 INT NOT NULL
ColX NTEXT
COLY NTEXT
Primary Key = Col1 + Col2 + Col3
....
选择的行,如下所示
myTable a = myTable.SingleOrDefault( x => x.Col1 = 1 && x.Col2 = 'abc' && x.Col3 = 9 );
if ( a == null )
{
// not relevant in this case !
}
.... some code
a.ColX = myString1;
a.Update();
@ 此时 Col1 = 1 的所有行都设置为 myString1
env - db 是 sql 2008 R2 Express、.net 3.5、c#
Subsonic 3.0 is updating multiple rows instead of just the one it's supposed to
DB Table is defined as follows -
Col1 int NOT NULL
Col2 Text NOT NULL
Col3 INT NOT NULL
ColX NTEXT
COLY NTEXT
Primary Key = Col1 + Col2 + Col3
....
the select expr is as follows
myTable a = myTable.SingleOrDefault( x => x.Col1 = 1 && x.Col2 = 'abc' && x.Col3 = 9 );
if ( a == null )
{
// not relevant in this case !
}
.... some code
a.ColX = myString1;
a.Update();
@ this point all the rows where Col1 = 1 are set to myString1
env - db is sql 2008 R2 Express, .net 3.5, c#
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
SubSonic 似乎不支持复合主键 - 您必须创建一个代理键才能执行您想要的操作。
另请参阅:SubSonic 3 和多个 PK 列
SubSonic does not appear to support composite primary keys - you'll have to create a surrogate key to do what you want.
See also: SubSonic 3 and multiple PK columns