Linq to SQL, Repository, IList and Persist All
- by Dr. Zim
This discusses a repository which returns IList that also uses Linq to SQL as a DAL.
Once you do a .ToList(), IQueryable object is gone once you exit the Repository. This means that I need to send the objects back in to the Repo methods .Create(Model model), .Update(Model model), and .Delete(int ID).
Assuming that is correct, how do you do the PersistAll()? For example, if you did the following, how would you code that in the repository?
Changed a single string property in the object
Called .Update(object);
Changed a different string property in the object
Called .Update(object);
Called .PersistAll(), which would update the database with both changed strings.
How would you associate the objects in the Repository parameters with the objects in the Linq to Sql data context, especially over multiple calls?
I am sure this is a standard thing. Links to examples on the web would be great!