Query sent to database are missing milliseconds in datetime
When doing a .Where on a table with a Datetime2 column datetimes are sent without milliseconds and does therefor not match the intended rows.
Steps to reproduce
var millisecondDate = new Datetime("2019-09-06 09:48:49.613");
ctx.exampleTable.Where(row => row.date == millisecondDate).First();
generates:

-- p__linq__1: '2019-09-06 09:48:49' (Type = DateTime2, IsNullable = false)
Further technical details
EF version: 6.4.4 Database Provider: EntityFramework.SqlServer Operating system: Windows 10 IDE: Visual Studio 2019 16.6.5
Found this answer which seems to be a working workaround: https://stackoverflow.com/questions/3567734/how-to-compare-date-with-milliseconds-with-linq
if this bug is from 2010 and still in EF I have no hope of this getting resolved?
Ran into this issue moving SQL Server database from Compatibility Level 100 to 150. The above solution compiled, but threw an exception that Date is not supported for EF 6.4.4. Resolved issue by creating a stored procedure with a datetime parameter. Imported into the EF model worked.
C# Code:
var list = context.usp_GetOrderTransactions(datePosted).ToList();
Stored Procedure:
CREATE PROCEDURE usp_GetOrderTransactions
@posted datetime
AS
BEGIN
SELECT *
FROM OrderTransaction
WHERE CreatedDateTime = @posted;
END
Stored Procedure simplified for demonstration purposes.
This issue has been closed because EF6 is no longer being actively developed. We are instead focusing on stability of the codebase, which means we will only make changes to address security issues. See the repo README for more information.