-
Notifications
You must be signed in to change notification settings - Fork 54
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Hi
After upgrading to version 4.0.0 (AutoMapper 10) we received the following error:
The binary operator Equal is not defined for the types 'System.DateTime' and 'System.Nullable`1DateTime
Example map:
Expression = x => (firstReleaseDate == null || x.StartDate >= firstReleaseDate) &&
(lastReleaseDate == null || x.StartDate <= lastReleaseDate)
Where firstReleaseDate and lastReleaseDate are DateTime? and x.StartDate is DateTime
"Weird" cast map that solved the issue:
Expression = x => ((DateTime?)firstReleaseDate == null || (DateTime?)x.StartDate >= (DateTime?)firstReleaseDate) &&
((DateTime?)lastReleaseDate == null || (DateTime?)x.StartDate <= (DateTime?)lastReleaseDate)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working