Writing about Entity Framework Relationships

Tuesday, July 15 2008

I have finally finished what has been, so far, the most difficult chapter of my book. It is a chapter about Relationships and Associations in the Entity Framework. Relationships as a first class citizen in an API is a pretty novel thing for me (and many) and judging from the percentage of questions in the forum about relationships, I think it's one of the most confusing and complicated pieces of the framework. Complexity is not a bad thing, and it certainly is a fascinating adventure. There are so many rules that exist in order to maintain the integrity of the relationships so that they can do their work. And many of the rules are far from intuitive.

I've been struggling to understand what's behind all of these rules so that don't have to be rules to be memorized but instead become logical ways for me to work with entities. Then the job was to try to digest that and explain it in a way that is comprehensible to others. It has meant a lot of research, digging through the forums relentlessly,  reading blogs and lots and lots and lots of experimenting. Because there's really not much else out there. Oh and of course bugging the hell out of Danny Simmons and some other saints on the EF team.

The scary part is that every time I opened up door of understanding, I discovered a host of new things that I realized needed explaining as well.

I finally had to let it go and "throw it over the wall" to the reviewers.

I feel like I deserve it to be all downhill from here, but somehow I just don't think it's going to work out that way!