I have a problem with making a selection from my database and checking if multiple columns in row are equal to list of objects. I'm u linq and EF. I have a list of objects like this:
public class Offer
{
public string OrderID { get; set; }
public string OrderNumber { get; set; }
public string Domain { get; set; }
}
And this is how I'm trying to select from database
return oDB.Offers.Where(w => w.Status == WOStatus.Offer
//pOffers is a object of type List<Offer>
&& pOffers.Any(o => o.OrderID == w.OrderID &&
o.OrderNumber == w.OrderNumber && o.Domain == w.Domain)).
Select(w => new OffModels.Model { ID = w.ID, OrderID = w.OrderID,
OrderNumber = w.OrderNumber,
Description = w.Description, Visible = w.Visible,
Domain = w.Domain }).ToList();
When I try like this I got error
"Unable to process the type 'Offer[]', because it has no known mapping to the value layer." (System.NotSupportedException) A System.NotSupportedException was caught: "Unable to process the type 'Offer[]', because it has no known mapping to the value layer."
If I'm not wrong, it's because it can't be translate into SQL query. And one more thing, in this table Offers i have almost 5 million records. How to make it to work quickly?