I’m using Entity Framework but I’ve cached some application wide entities, so now they’re List rather than entities.
Two of the objects I’ve cached are Products and Stores – a Product has a store. In a table they are linked by StoreId, but since I’m using EF the Product can also include the Store entity.
I don’t cache them together simply because they are also used independently. What I would like to do is join them at some point, so I might subselect the Product object then want to populate Stores by joining the Stores object.
Is the most efficient way of joining 2 lists using linq – if so whats the most efficient syntax, or is there’s a better way converting lists back to entities.
This is a bit misleading as this isn’t what your trying to do. You pull down a list of Products/Stores which are entities – no need to convert them (even if your storing them in a list).
If I understand you correctly what you want to do is basically map each
Productto it’s appropriateStorefrom the cached entities (to save going back to the DB by accessing theStoreproperty on theProductentity). I am pretty sure all you need to do is map this across, so something like: