I have a SQL Server table like this:
Id (int, primary key)
UserId (int)
SomeDate (Date)
JsonData (nvarchar)
In C# I have a collection resembling the type
List<(int UserId, DateTime SomeDate)>
How do I find all database entries matching the two fields from my C# collection? I would like to make one database call and not iterate list and search for them one by one.
For example if the C# collection has 2 entries:
(1, '2020-01-02'), (5, '2020-01-01')
I would like to find any matching database entries. Something like (not real code)
context.DatabaseTable
.Where(e => (e.UserId == 1 && e.SomeDate == '2020-01-02') ||
(e.UserId == 5 && e.SomeDate == '2020-01-01') ||
... as many conditions as collection has elements...)