As I sit and struggle my mind through various options for O/R mapping, I wonder what the rest of you are doing. I am (sometimes) developer on
NetTiers (http://www.nettiers.com) which is building up quite a good framework for O/R mapping along with tons of other features.
However, it does have a decent amount of overhead, requiring several of the application blocks and its own DLL. Its perfect for medium to large projects, but now I'm looking into techniques for something more lightweight.
I've started looking at nHibernate and will probably do a test run with that this afternoon - but again, it requires its own DLL I believe, and the XML mapping files seem cumbersome to me.
I'm also noodling over my own solution which will have just enough features to get me by and use reflection and attributes to manage the O/R relationships. My concept is to autodiscover the object mappings by class, interface and property names but let
the developer override those defaults with attributes as needed. (i.e. if you want the Username field to map to the User_Name field, you can specify an override.) While it might require a DLL too, I want to keep it as lightweight as possible and will roll
my own database code, or will incorporate very small parts of the Data Application Block.
Anders is right. This is bunk that after all these years of "advancement" we still have to go through major hoops just to move between the Object and Relational mindsets. (Though, I'm not entirely convinced that Linq is the solution either...)
What methods / software is everyone else using? I've been googling this stuff now for several weeks trying to see different aspects of it, but maybe there's some magic you know about that I haven't found yet
I use something called
dOOdads. Very lightweight and easy to use. Supports several databases (Microsoft SQL, Oracle, Firebird, Access, PostgreSQL, VistaDB, SQLite, and MySQL). It is free too (as is the tool that generates your business objects - which also supports NHibernate,
Gentle.NET and DAAB).
Thanks, I'll check it out, though from first glance it just looks like another CodeSmith / NetTiers... And I'm looking for something even simpler. (not neccessarily simpler in usage, but in implementation - if that makes any sense. )
They do have a active forum, and the developers respond quite quickly. Templates are very easy to do and your can create your own UI (which you can't do with CodeSmith). I've been using them (MyGeneration and dOOdads) for over a year with no problems.
How about no O/R mapping at all? No O/R mapping solution can get even close to how fast
db4o is when storing and retrieving objects. You're right... nHibernate, and their bloody mapping files are cumbersome. So that's why I elect to use db4o.... I just avoid all that hasstle and use a native
We use a custom mapping/reflection layer, but watch out for performance. Reflection can slow things down considerably, so you may want to cache metadata as much as possible.
We use a custom system because we have to support multiple database types simultaneously (e.g. May link to one database in Oracle, and one in SQLServer). I haven't yet found an O/R mapper that can do this.
If it's a small system, I wouldn't bother with O/R and I would just go with as much stored procedure/ADO.NET as I needed. If the project grows then it may be worth investing time in a mapping layer.
Eric Falsken wrote:
How about no O/R mapping at all?
Oh, I heartily concur there, and have on occasion checked out Intersystem's Cache but never used it in a real project. How does DB40 handle load? What about using it in an enterprise scenario such as a web farm with multiple web servers banging away on several
databases at once?
What types of projects are you using it on?
Then there's the issue of convincing my CLIENTS thats its ok - when they barely understand objects as it is....
I know little about SQL 2005 still - I don't suppose they've moved anything OO into there yet? When is MS going to finally realize that thats the solution (or better yet, a hybrid solution) and put it into the core product?
well npersist seems to be back in the game even better than ever now
We use Gentle.NET. It is relatively simple, but you do have to tag your objects (or use a generator, but I find I always wind up hand-coding anyway because I don't like the generated objects). It has good performance and some nice features like an easy
way to build object queries, etc.
Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.