Introducing GraphDiff for Entity Framework Code First - Allowing automated updates of a graph of detached entities

No Comments

Looking for a complete solution for automatically updating a graph of entities using the Entity Framework? Read On! So today I'm finally going to post something that we have actually been using live on our production code for quite some time, and the good news is that it is working…

Group or Order by sub type using LINQ to Entities

No Comments

It's a little hard to see how to group by a sub type in Linq to Entities. Since the discriminating field (when using table per hierarchy inheritance) or table name (when using table per type inheritance) is of course not exposed past the ORM layer. This essentially leaves us with…

Entity Framework ToList() in nested type (LINQ to Entities does not recognize the method)

No Comments

Update: The issue is described here: http://entityframework.codeplex.com/workitem/808 I've made a fork of EF source which solves this issue @ http://entityframework.codeplex.com/SourceControl/network/forks/brentmckendrick/Issue808/changeset/b18e48b3e51f however more work could be done to enhance the code by allowing for ToArray and ToDictionary…

ASP.NET MVC 3 DropDownListFor strange behaviour for determining selected option

No Comments

So a strange behaviour in the implementation of the HtmlHelper.DropDownListFor extension method was recently brought to my attention where the order of 'looking for' the selected value of the list seemed incorrect. I would assume that the selected value would always be the selected value from the strongly typed…

ASP.NET MVC JQuery EventAggregator (Decoupled Event Handling)

No Comments

The concept of Event Aggregation was first introduced to me as I read through the PRISM toolkit (Composite Application Guidance) from the Microsoft Patterns and Practises team. It allows you to modularise your code and reduce dependencies between modules, I love it. An example of how it benefits web applications…

Generic Repository: Fake IDbSet implementation update (Find Method & Identity key)

No Comments

UPDATE (again) Just a quick one: see https://github.com/refactorthis/GraphDiff/blob/master/EFDetachedUpdate/DetachedUpdate/DbContextExtensions.cs on line 209 for a replacement GetKeyProperties method which allows for convention and fluent API mapped keys (You no longer need to annotate your model with KeyAttribute) UPDATE: Thanks to Eli Weinstock-Herman…