Showing posts from March, 2012

Cuckoo for POCO Puffs: Prequel

What exactly am I hoping to accomplish by moving to EF code-first or NHibernate? The short answer is that I'm looking to gain features that I'd otherwise have to implement while at the same time simplifying and reducing the amount the code we already have.  For the benefit of getting my own thoughts in order I want to articulate a slightly longer answer which will inventory the features and identify the potential areas of simplification and reduction. And that is what grieves me the most We have a substantial codebase which utilizes our own class-in-charge patterned persistence ‘framework’, the bulk of which still works by using the Enterprise Library and manually mapping ADO.NET structures (datarows, datareaders, commands) back and forth to the database. This approach first started in the .NET 1.1 era. The framework mainly consists of a few base classes that provide more of a template (for consistency) than anything else. This approach has lasted a long time and continues t

Cuckoo for POCO Puffs: Week 1

I completed converting my moderately complex sub-model (24 entities) from the database-first style to code-first style this week.  The results are pretty encouraging. I find your lack of faith disturbing The use of foreign key associations, POCO’s and the Fluent API vastly simplified the resulting code.  Not that I didn’t encounter my share of learning curve struggles.  The fluent api syntax for declaring relationships is a bit clumsy, and the difference between declaring properties as virtual or not and its resulting impact on lazy load behavior confused me on at least one occasion.  Notwithstanding those, the bulk of the effort was simply the brute typing involved in re-implementing all the class, repositories and relationships, as well as refactoring tests to use the new code. The EF 4.x POCO Entity Generator gave me a really good starting point, although it didn’t allow me to pick which tables, instead generating the whole database. All too easy What I found most compelling wi

Improving readership?

Just published my second article on . And, in case you missed the first .

RIF Notes #15

“If you don’t know why it works, it probably doesn’t. You just don’t know it yet.” – Steve McConnell Do you monitor negative events? - Not only monitoring errors, but watching for things that haven’t happened, like orders haven’t processed in a while. Build Mobile-Friendly HTML5 Forms with ASP.NET MVC 4 and jQuery Mobile Should All Web Traffic Be Encrypted? - This is a good question and would simplify quite a bit if we just ran our whole site under ssl. What are you in for? – Ayende talks about the tension between developers working on cool things and clients just wanting stuff done. Visual Studio 11 Beta in Context – “One ASP.NET” Dark Matter Developers: The Unseen 99% – About the silent majority of developer who aren’t blogging, tweeting, lecturing, just working. Windows 8 And Enterprise App Dev Strategy - Rocky’s take on what might be microsoft’s tablet strategy in the enterprise. “In reality, it might be less expensive for organizations to buy employees Windows 8 tabl

Cuckoo for POCO Puffs: Day 1

Now that we’re firmly on .NET 4.0, and EF 4.x has arrived I’ve begun revisiting our EF v1 style repository pattern looking to see if the new code-first and POCO support will help mitigate some of the frustration we’ve encountered with Entity Framework. The pain we’ve experienced over the past couple of years primarily falls into two buckets: The models (EDMX and designer files) can become large, unwieldy and idiosyncratic.  Refreshing it with underlying changes to the database can often result in cryptic errors, and source control merges of these files can be painful. Independent Association relationships are tricky and complicated when working in a disconnected mode.  Properly navigating these relationships often involves loading entities from two or more contexts, associating them together, and then getting them to properly persist as a complete graph when reattached to a new context. Models, Inc. Over the years we’ve mitigated some of the giant model problems (our primary datab