The actual result of var dt = new DateTime(1967, 08, 03);
is 8/3/1967 12:00:00 AM
The DataType
of the DateOfBirth
is Date
so we need to TruncateTime the time.
msdn: EntityFunctions.TruncateTime Method
public static Applicant Create()
{
var dt = new DateTime(1967, 08, 03);
var r = new CrudRepo<Applicant>(UowHelper.GetUow().Context);
return r.FirstOrDefault(a => a.DateOfBirth == EntityFunctions.TruncateTime(dt));
}
or remove the .Single() method
instead use the .FirstOrDefault() Method