If you haven't seen Nhibernate yet, you should really check it out. There are a lot of free ORM tools out there, but this one seems to be the most liked, as far as I've read. I am implementing it in a new project at work and so far I am liking it. A lot.
What I like best is that my Base business object can implement all of the details in Saving, Updating, and deleting objects... all I have to do is make sure and create the xml mapping file and all is taken care of for me.
I do have some design concerns though, as I don't want my front-end coupled to NHibernate at all. The UI developer shouldn't even have to know the workings of the object persistance, he/she should just call
BusinessObject.Save() and let the Data Layer handle it.
So, following some advice on
TSS and
Code Project I decided to abstract the
nitty-gritty into a static class.
Ooh, did I just say static? That must be wrong... Static classes are not very reliable in a web application, as you don't control it's lifetime at all. So I have some basic code that generates the necessary configuration, loads my persistant classes into NHibernate, and builds the session factory, and this is all static. As far as the application goes, we won't be able to tell it isn't working because the static members will just be recreated once they are lost. I'm concerned about the performance hit that we will suffer because of this.
I also want to avoid tying it to the Application bag, because that introduces a coupling between the UI and the Class library.
I'm sort of stumped at this point, and I haven't read anything yet that gives me a better alternative. Can someone recommend a solution?