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

Question: Issue with DateTime Field #183

Closed
dixitsuneel opened this issue Jul 17, 2018 · 2 comments
Closed

Question: Issue with DateTime Field #183

dixitsuneel opened this issue Jul 17, 2018 · 2 comments
Assignees
Labels

Comments

@dixitsuneel
Copy link

dixitsuneel commented Jul 17, 2018

If the model contains a DateTime field

class Entity {
   public DateTime DateLastModified { get;set; }
}

If I apply a filter using queryable.Where("DateLastModified > '2018-07-17'") then with Ef Core 2.1 I am seeing that the query is translated to

where DateLastModified>'2018-07-17T00:00:00.0000000'

This leads to the sql query being failed.

It wasn't an issue with Ef Core 2.0 but I am seeing this issue with Ef Core 2.1.1

StefH added a commit that referenced this issue Jul 19, 2018
@StefH
Copy link
Collaborator

StefH commented Jul 19, 2018

Hello @dixitsuneel.

I did test this with EF 2.1.1 with real database en with in-memory database, and in both cases all works.

Note that you need \" instead '.

Example:

var carDateLastModified = context.Cars.Where(config, "DateLastModified > \"2018-01-16\"");

@StefH StefH self-assigned this Jul 19, 2018
@StefH StefH added the question label Jul 19, 2018
@StefH StefH changed the title Issue with DateTime Field Question: Issue with DateTime Field Jul 19, 2018
@StefH
Copy link
Collaborator

StefH commented Nov 6, 2018

@dixitsuneel Closing this issue, if you still have problems, comment here of create a new issue.

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

No branches or pull requests

2 participants