Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qwiq.Linq does not support Convert #199

Open
pelavall opened this issue Apr 27, 2018 · 1 comment
Open

Qwiq.Linq does not support Convert #199

pelavall opened this issue Apr 27, 2018 · 1 comment
Assignees
Milestone

Comments

@pelavall
Copy link
Contributor

pelavall commented Apr 27, 2018

Qwiq.Linq does not support Convert this prevents being able to use queries which have a DateTime value in the IWorkItem.Fields.

Example:

var now = DateTime.UtcNow();
_workItems.Where(wi => (DateTime)wi["Changed Date"] < now).ToList()

This code will fail due to not supporting the conversion of object to DateTime. There does not seem to be work arounds for this in all cases. In some cases .ToString can be used, but in this particular case, strings do not support >. Other case mapping can be used to ensure a correctly typed property exists when querying.

@MattKotsenas
Copy link
Contributor

MattKotsenas commented Apr 30, 2018

As a workaround, use the as operator for now:

var now = DateTime.UtcNow();
_workItems.Where(wi => (wi["Changed Date"] as DateTime?) < now).ToList()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants