I'm working with Linq to perform a series of SQL queries on a database. When we call SubmitChanges()
it automatically determines whether it should update or insert a record. However sometimes this automatic method isn't that helpfull.
For example, I've had issues with composite primary/foreign keys on a table and when Linq should have performed an Update
, it most exclusively went out performing Insert
statment, which was of course blocked by the database when a specific key composition already existed causing a headache and waste of time...
Therefore I was wondering if is there a way to force an Update
over an "usually Linq self-determined" Insert
statement. Kinda like there is .Attach()
InsertOnSubmit()
is there a counter part to Update?
Note: As anyone noticed Linq to Sql takes Delete requests in last place regardless of you called them before or after another insert or update statement, is there any way within Linq to change this?
Thank you for you time.