public class OrderItem
{
public int OrderID { get; set; }
public int ProductionID { get; set; }
}
public class InventoryItem
{
public int InventoryItemID{ get; set; }
public int OrderID { get; set; }
public int ProductionID { get; set; }
public bool Created { get; set; }
public bool Deleted { get; set; }
}
Using these example objects,
I have a local list of orderItems and want to query inventory items where OrderID and ProductionID matches on both properties any of my list of Order Items
I tried linq query below but I am getting an error
Query I am trying:
var results = await db.InventoryItems.Where(d =>
listOfOrderItems.Any(o => o.OrderID == d.OrderID && !d.DeleteFlag && d.ProductionId == o.ProductionItemId))
.Select(t => t.InventoryItemID).ToListAsync();
Exception thrown: 'System.NotSupportedException' in EntityFramework.SqlServer.dll
EDIT i am being referred to this question:Using Linq to Sql asynchronously with new async/await
But my question is not about async await, it is about the matching 2 properties using the .any on my list