I'm using EF CTP5 code-first with Sql CE 4.0. I am trying to perform a time-insensitive date comparison between two DateTime properties.
As linq to entites cannot parse the DateTime.Date property (which would have been nice) the solution is to use EntityFunctions.TruncateTime, however this doesn't appear to work with Sql CE 4.0.
I can manually compare the Year, Month and Day of the two dates, this works but makes the code a lot more verbose than it should be. Ideally I don't want to change my queries to use the long-hand version to make them work with both full sql server and sql ce 4.0.
Therefore does anyone have any clean and clever solutions to this? I think the solution will probably involve expression re-writing but I'm not quite sure where to start.
Any help is greatly appreciated,
Paul