Seems there´s still some issues you have to struggle with in Entity Framework even though the latest releases have made it actually possible to work with.

This time I got a problem whilst trying to retreive av bunch of items logged with the same timestamp. Entity framwork however fails the simple r => r.Timestamp == myClass.Timestamp comparison due to the fact that SQL saves the timestamp with less accuracy than .Net. This makes our timestamp in memory fail to compare with the rounded-off SQL timestamp (see here). This kinda sucks since you´d really think that the value (which i previous to this comparison pull from the database) would be equal to the one in the database but apparently .Net adds some extra time to this value.

Workaround then?

Change the datetime type in sql to datetime2(7). This will give you the accuracy .Net uses and resolve the issue.

Why not join the newsletter?

Why not join the newsletter?

If you're not a fan of facebook or twitter, sign up to the newsletter and I'll send you a quick update every so often with what's going on and new posts coming out.

You have Successfully Subscribed!