Wednesday, July 27, 2011

Today I found a nice utility method for working with DateTime values in Entity Framework LINQ queries. I wanted a list of Events which fell between a date range, but my query needed to ignore the time portion of the DateTime values. My first attempt was this:

But when I ran the code, I got an exception because I was using the .Date property of DateTime - basically EF did not know what to do here to convert this into a query. So after some research I found EntityFunctions.TruncateTime. This worked like a charm:

A couple of years ago, I blogged about my findings after analysing the memory usage of RSS Bandit using VMMap. I found that numerous .NET assemblies were appearing twice in the virtual memory region of RSS Bandit and that this behaviour was a known issue to Microsoft. Well if you have a look at the Microsoft Connect page for this issue, you’ll spot that as of .NET 4.0 this issue has been resolved. I’m yet to perform any analysis myself on .NET 4.0 applications, to check if duplication of assemblies has been eradicated, but still, it’s nice to see that this has been resolved.

There is a ton of information available on that page, well worth a look.

Remember, there is a roadmap page for ASP NET MVC 4 which illustrates what the team are officially planning for the next release. If you would like to suggest a feature/improvement, then visit the ASP NET user voice page.