My requirement is simple and very common. I did find many struggling to find answers to it but did not get any acceptable solution.
I am using EF 6.1 and want to query a table with a predicate which is being created dynamically something like "ABC > '1' && DEF = '2' && GHI = 3.." and so on. The issue is, I am also having DateTime as a data type. I tried searching for appropriate solutions, but provided solutions (mentioned below) doesn't work (ABC, DEF are name of the columns which is of DateTime type in DB).
repository.Where("ABC > DateTime.Parse(...
repository.Where("ABC > @1 && DEF < @2....", listDateTime.ToArray())
Thoughts?
Thanks.
UPDATE 1: Just to be clear, I do not know the count of DateTime parameters at compile time, I am using List
(listDateTime) as shown in example #2 above.
UPDATE 2: listDateTime is an object of List<DateTime>
which stores values of datetime parameters at run-time.
UPDATE 3: Question asked here inlines to what has been asked here. The only change is, I do not know the count of an array of DateTime parameters (@0, @1...) at compile time.