To sort out this problem we need attach the instance record again to the list in the context:
context.GetTable
just before we call the SubmitChanges. But this is not always possible. I got the following error when calling this:
An entity can only be attached as modified without original state if it declares a version member or does not have an update check policy.
The simple way of sorting this out was giving the ID field of the record the attribute of
IsVersion=true
This way Linq allows me to attach the existing instance and generate an UPDATE sql-statement.
See Also: http://www.west-wind.com/Weblog/posts/135659.aspx
No comments:
Post a Comment