I'm using Entity Framework and I have a query similar to this:
entitiesContainer.Entities.Where(e => inMemoryList.Contains(e.Field))
It works but I'm having performance issues. I spent some time profiling this and the performance degradation seems to be happening in the application and not in the database. Apparently this query gets compiled every time it is executed and I guess it is because of the way the Contains
is being translated.
Do you know how I can avoid the query getting compiled every time?
Thanks.