Input data comes with a list of multiple (5) properties and I would like to fetch records from the DB where one row matches any row from the input list like so:
class MyClassDto
{
public string Value1 { get; set; }
public string Value2 { get; set; }
public string Value3 { get; set; }
public int Value4 { get; set; }
public int Value5 { get; set; }
}
DB entity also has those 5 values.
public IEnumerable<MyClassDb> GetData(IEnumerable<MyClassDto> data)
{
_context.MyClassDb.Where(x => data.Contains(x.Value1) && data.Contains(x.Value2) && ...
}
Would return data that contains any combination from the input data and not exactly a row that matches one input row 1 for 1.
I tried lookging at the examples given in Query where multiple columns have to match a value set simultaneously in EF Core but I'm unsure how to produce expressions while matching 5 values.
Also, whenever I try to build expressions something like in this example, however it always produces a stackoverflow exception.