HI,
Wit linq i populate a generic list in DAL. then in UI layer the user removes and updates items from the list. Is it possible for LINQ to keep track of the changes without having to write code to check which items have been removed and deleting them/adding new items and updating others etc. it seems that this is not possible when using datacontext which popluates the list and seperate datacontext which is responsible fo SubmitChanges. Any help appreciated.
thanks
Niall
If you are using
Linq.DataContextthen it does indeed keep track of changes for you.The function to reference is System.Data.Linq.DataContext.GetChangeSet. Although
GetChangeSetcan be called at any time it would be good to reference the Remarks section in the MSDN documentation.You can check / take action on submit…
Here is a quick example of how you can override
SubmitChangeson aDataContextand take actions at that point.The example shows that you can modify the data before final submit, you can also keep track and take special action when specific members are updated: