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 Co开发者_如何转开发l1 = 1 are set to myString1
env - db is sql 2008 R2 Express, .net 3.5, c#
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
精彩评论