LINQ Query Workaround for Comparing Dates (EF, LINQ2SQL,CodeFirst)

image.png

  I seem to always get this error all the time (kind of like I never learn).     Or, for you search engines reading: LINQ to Entities does not recognize the method 'System.DateTime Subtract(System.TimeSpan)' method, and this method cannot be translated into a store expression.   The solution is very straight forward.  Just pull out the Subtract and compare the dates directly like this:   DateTime compareDateTime = DateTime.UtcNow.Subtract(new TimeSpan(0, 0, 15, 0));// now get failures with last run more than 15 minutes agovar usersFailedLasttime =db.PushChannels.Where(a => a.RequestPushNotification.HasValue && a.RequestPushNotification.Value && … Continue Reading

LINQ To SQL Performance Getting Huge Improvement in EF5, Microsoft Does Listen!

image.png

  The Original Problem Back in 2009, I discovered what I considered a fatal flaw in performance using LINQ2SQL with LINQ queries.  I published 2 very popular articles on this as well as discussed it with many of my peers and Microsoft.  At the time, I was told in no uncertain terms by Microsoft that this was an inherent problem and for many reasons I did not agree with, they would not be addressing the issue.  Well, now, more than 2 years later, Microsoft has addressed this exact issue in Entity Framework Version 5 and will be providing the exact fix that is needed! http://peterkellner.net/2009/06/08/linq2sql-uncompiled-verses-compiled-iis-performance-aspnet/ … Continue Reading

Microsoft To Add Auto-Compiled LINQ Queries to Entity Framework V.Next!

image.png

  In May of 2009 I discovered some significant performance problems that I blogged about.  In summary, I had tracked it down to the issue of LINQ2SQ having to create a full expression tree on every instantiation of a LINQ2SQL query.  I’m not a compiler write kind of guy but do respect the complexity of that and doing things like building expression trees, but still this really sucked.  Using the compile syntax in LINQ2SQL is very awkward, and IMHO takes all the fun out of using LINQ2SQL.  If you don’t remember my post, here is the graph showing the evil happening.   So, what is a Microsoft MVP to do?  I complained to everyone at Microsoft I knew.  I made this my mission for about a … Continue Reading

Is There A Need For End-To-End ExtJS to Microsoft Server (MVC-C#, LOB) 4 Day Class? (Poll Enclosed)

Over the past couple years, the focus of the web development I’ve been doing involves building highly flexible, highly scalable and straight forward web sites to implement and maintain Line of Business (LOB) applications.  As you can probably tell from my posts, I’m very “practical” focused, and at the same time have a desire to build awesome web applications. The technology pairing I’ve chosen is Microsoft’s .Net platform with MVC on the server, and ExtJS on the client.  Though it’s possible to still use ExtJS with standard html/aspx pages, I’ve found the best combination is to use 100% JavaScript on the client (ExtJS) and have all the server side technology be 100% service based.  I’ve used LINQ2SQL … Continue Reading

Follow

Get every new post delivered to your Inbox

Join other followers: