I am returning two lists from the database using LINQ to SQL compiled query.
While looping the first list I remove duplicates from the second list as I dont want to process already existing objects again.
eg.
//oldCustomers is a List<Customer> returned by my Compiled Linq to SQL Statmenet that I have added a .ToList() at the end to
//Same goes for newCustomers
for (Customer oC in oldCustomers)
{
//Do some processing
newCustomers.Remove(newCusomters.Find(nC=> nC.CustomerID == oC.CusomterID));
}
for (Cusomter nC in newCustomers)
{
//Do some processing
}
DataContext.SubmitChanges()
I expect this to only save the changes that have been made to the customers in my processing and not Remove or Delete any of my customers from the database.
Correct?
I have tried it and it works fine - but I am trying to know if there is any rare case it might actually get removed