A fascinating question emerged on twitter tonight and that i tought I'd publish it here.

Essentially, I'm wondering what you're using to persist data for your database as well as an estimation from the percent of the codebase that's data access code.

-- Edit --
Other interesting metrics (as noted within the comments) include the amount of business classes and also the overall size your codebase.

I simply checked out a task which i did a very long time before finding NHibernate. Rapidly searching at a few of the data access code demonstrated about 10 lines of code for persistence/hydration for each persistable property inside a class.

In a single project we did, we used LLBLGenPro as our OR/M. Consider we did not wish to litter our application with LLBL organizations, we planned individuals to the BO's before they hit the customer. Which means that mapping it well to LLBL organizations before striking the DB again. The DAL code wound up as being a very large part of our application. Not 50%, but substantial.

Inside a project I'm focusing on now I began with db40 wishing to reduce the DAL footprint. Also it was really small, however i went into issues with db40 and needed to abandon it. I switched to ADO.Internet for any couple of days simply to go working and was surprised about just how much freakin' ADO I needed to write just to obtain a simple repository working. Which was a headache, and so i finally elected for NHibernate.

My DAL code with NHibernate (2.) is most likely 5% or a smaller amount of my code base. That's such as the XML mapping files. I am talking about, the DAL footprint is really small , this type of pleasure to utilize. I'd issues with NHibernate 1.2 previously inside a distributed atmosphere where I desired to utilize detached objects, but NHibernate 2. appears to possess solved that problem. I understand it is the way I am doing DAL to any extent further, until something better arrives.

Oddly enough, my co-workers and that i were built with a similar conversation a few several weeks ago. But ours was focused less how much code our DAL paid for for, but the amount of our application was simply data querying/manipulation. We believed that most likely 90% in our application was only a matter of fetching the right subset of information and permitting customers to edit it.

We use nHibernate the majority of the occasions, also it being produced with a tool, dunno in the event that counts, we still finish up adding lots of code towards the nHibernate layer for each one of the organizations and it also does go onto be most from the code.

Even the DAL code increases while you include more functionality and much more organizations in your soul application. So pretty much i suppose around 20%-30% in our codebase consists of the DAL.