I have heard that using contain
method degrades Entity Framework query performance.
My class file:
public partial class VendorInCategory
{
public int Id { get; set; }
public int CategoryId { get; set; }
public int VendorId { get; set; }
public virtual CategoryMaster CategoryMaster { get; set; }
public virtual UserDetails UserDetails { get; set; }
}
This is my query:
List<int> categoryIds = new List<int>();
for (int i = 0; i < Items.Count(); i++)
{
categoryIds.Add(Convert.ToInt32(Items.ElementAt(i)));
}
var data = context.VendorInCategory
.Where(x => ((categoryIds).Contains(x.CategoryMaster.Id))
{
-------------------
}
Can anybody tell how do I compare this list without using contain
keyword???