string rep = "Joe Shmoe"
ObjectSet<StoreData> storeData = edmContext.StoreData;
ObjectSet<CallData> callData = edmContext.CallData;
IEnumerable<string> repStoreData = storeData.Where(r => r.RepName == rep).Select(s => s.Location);
IEnumerable<CallData> repCallData = Here is where I want to filter down the callData collection down to just the records that have a location that is contained in the repStoreData collection
I’ve tried using some form of Join and Any but don’t really understand the arguments those are asking for.
This was my best attempt and it is a no go.
... = callData.Join(d => d.LOCATION.Any(repStoreData));
Well you don’t have to use a join. You could just use:
That’s assuming
d.LOCATIONis a single string.However, you probably don’t want to do that with your current declaration of
repStoreDataasIEnumerable<string>– LINQ won’t be able to turn that into a query to be executed at the database.If you’re able to declare
repStoreDataasIQueryable<string>, however, that would be more likely to work well. I don’t know whether that will work withObjectSet<T>, but I’d hope so.