If I select many rows from one table with one instance of DataContext. And then do I some changes in properties in the rows, can I submit changes to database only for one of the selected rows?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes you can.
First you need to isolate the entities you want to undo the changes. Then, you can use your DataContext class to Override those entities with the values from the Database.
EDIT:
You can track all the changed objects in the DataContext like this:
This code is only considering the Updates. You also might need to consider the changes in Inserts and Deletes. This is up to you.