I have a c# code in which I use a LINQ query to retrieve bunch of objects by comparing a specific property of string type with list of strings. The c# code is like as follow:
var list = new List<string>{.....}
var query = from record in context.Records.AsNoTracking()
where list.Contains(record.Name)
orderby record.Name
select new
{
...
};
var result = query.ToList();
My problem is that when the list is large the performance of this query is dramatically low in some case it takes several minutes to return the results.
I need to know what are the probable solutions to increase the performance of this query?