In my simplified example i have an object with following properties:
- Name (string)
- BirthDateTimeStamp (datetime)
I need to ba able to build dynamic queries in the following way
var predicate = "Name = @0";
var values = new object[]{"Ed"};
myIQueryableDataSource.Where(predicate, values)
This work good. Now i want to compare my datetime
var predicate = "BirthDateTimeStamp >= @0";
var values = new object[]{someDateTime};
This works good also. But what i actually want to do when comparing the datetimes and this issue shows itself better when doing the equals is comparing just on date.
var predicate = "BirthDateTimeStamp.Date >= @0";
This is not possible since the Date property is not recognized by EF to SQL server
var predicate = "System.Data.Entity.DbFunctions.TruncateTime(BirthDateTimeStamp) >= @0";
This is also not working since i can only access my object properties in the predicate.
How can i solve this in this way so the predicate stays in the string format. This code is just a part of a big existing parser for my queries and connat be completely rewritten.