I'm using a IEnumerable which I have saved in the cache. I need a copy of this list and transform the contents. This copy is temporary and is not saved.
Currently I am using IClonable on MyObject to create a new list. This works but causes EF to take a second trip to the database, thus its very slow. How can I clone this list without EF going to the database? The data is already in memory in the cache.
Alternatively; is there a better way to copy the list from cache so I can temporarily use it?
Using EF5, .Net 4.5.
This is what I use to clone. Note that residualList is in the cache. But this line still causes EF to get everything from the database.
var clonedList = residualList.Select(x => (Product) x.Clone()).ToList();