Category Archives: Code

Entity Framework v4, End to End Application Strategy (Part 3, Changes to Data Layer)

Initially in my service layer, I was doing all of my serialization with the Json.NET library, for 2 primary reasons Control over how dates get formatting (I don’t like the \/Date(123)\/ MS AJAX style) The ability to serialize object graphs that contain cycles (by telling Json.NET to ignore them) Unfortunately, this started causing me too [...]
Posted in Code | Tagged , , , , , , | 4 Comments

Entity Framework v4, End to End Application Strategy (Part 2, Data Layer)

In part 1, I talked about what the whole app stack will look like. To recap the stack: SQL Server ↑ Data Layer — EFv4 ↑ (Auto generated AutoMapper configs between entities and DTOs) DTOs (Auto generated with T4 templates, based on the edmx) ↑ Service Layer (WCF REST, based on a template) ↑ (Json.NET [...]
Posted in Code | Tagged , , , , , | 4 Comments

Entity Framework v4, End to End Application Strategy (Part 1, Intro)

Sorry I haven’t posted in so long. Been very busy with new projects at work and a bit of side work. Ok, so I think I am finally moving on from NHibernate, at least for new development. Obviously I’m not going to do anything rash like completely rewrite the data layer of large and complex [...]
Posted in Code | Tagged , , , , , , | 1 Comment

The Entity Framework (v1 and v4) Deal Breaker: TPT Inheritance

CodeProject 9/10/2010 Update #3: It appears that MS has deleted the bug on Microsoft Connect. Here is a cached version indexed from Google where you can see it has 34 upvotes, and 22 users saying they can reproduce. I blogged about this in January 2010, and the bug was opened on 3/17/2010. MS didn’t respond [...]
Posted in Code | Tagged , , , , , , | 17 Comments

Eager fetch multiple child collections in 1 round trip with NHibernate

Oren Eini (Ayende), due to some of the comments on his various blog posts regarding EF vs NH that compare some of the different features, has finally put up a post demonstrating how to load a larger object graph in a single trip to the database. So far, all of the examples have been how [...]
Posted in Code | Tagged , , , , , | 10 Comments

More EF4 vs NH Discussion

There’s a post on InfoQ following up the the Entity Framework 4 vs NHibernate (EF4 vs NH) discussion that Ayende started. I posted some of my findings regarding loading of large or complex object graphs in the comments. I have done more research in that vein (it turns out you CAN load a whole object [...]
Posted in Code | Tagged , , , , , | Leave a comment

Eager Loading with Entity Framework and NHibernate

At CB Richard Ellis, Rich Alger and I wrote and maintain an internal ordering system that uses NHibernate. It was our first experience with NHibernate, but it was a huge success. Much of our initial focus was to just get things working, not to optimize it, since NHibernate has a bit of a steep learning [...]
Posted in Code | Tagged , , , | 3 Comments

Making Entity Framework (v1) work, Part 1: DataContext lifetime management

EFv1 is sorely lacking in many areas. That doesn’t seem to stop people from using it, however. If EFv2 weren’t on the way (March 2010), I’d probably still be using NHibernate for everything. However, EFv2 (actually named v4 to “align” it with the .NET version number, or as a marketing ploy to make it seem [...]
Posted in Code | Tagged , , , , | 1 Comment

Simple jQuery show/hide + fadeIn/fadeOut Example

Ok, so I know this is jQuery 101, but a friend was asking me for a specific example of how I did some of the UI in a large commercial side project that I was demoing for him. The UI has a large list of yes/no questions, each one corresponding to a details form if [...]
Posted in Code | Tagged , , | 1 Comment

TimeSpan or DateTime to Friendly Duration Text (e.g. “3 days ago”)

Data should be displayed to end users in a way that requires the least amount of effort on their part. With dates, do the math for your users ahead of time. Explicit dates may be exact, but relative “duration text” is easier to understand, and it’s usually good enough. Makes users think hard Easy to [...]
Posted in Code | Tagged , , , , | 3 Comments