This project has moved. For the latest updates, please go here.

ORM Framework

Nov 4, 2009 at 5:47 PM

What were the design considerations for choosing Vici.CoolStorage over other ORM frameworks, particularly NHibernate?  I've used Java Hibernate in the past, and while I've had no experience with its .NET counterpart, it seems like Hibernate has a strong presence in the market and is well-supported.  It seems like carefully choosing the ORM framework would be an important consideration.

Nov 4, 2009 at 8:04 PM

Thank you for your input.

I have reviewed several other ORM frameworks including Castle.ActiveRecord (based on NHibernate), Subsonic and Vici.CoolStorage. The main reason for chosing Vici.CoolStorage was the ease of use for the developer. However, after having become more familiar with ORM frameworks and Vici.CoolStorage I acknowledge that it has some disadvantages. To summarize my experience so far:

  • Vici.CoolStorage advantages: very easy to set up (no need to use configuration files or session object), seems to work faster than NHibernate, lightweight, easy to debug the source code, very permissive licence, good support for transactions
  • Vici.CoolStorage disadvantages: Requires each class to inherit from CSObject<T>, requires table columns to be mapped to public abstract fields, problems with many-to-many relations
  • NHibernate advantages: More customizable ( classes don't need to inherit from any special base class), wider support and large developer community, better separation of the database and application logic
  • NHibernate disadvantages: more difficult to set up (extensive configuration file), requires writing of xml mapping files (error prone), slower than Vici.CoolStorage when dealing with one-to-many relationships, requires to maintain a special NHibernate.Session object.

In any case, the plan is to have the ORM framework fully encapsulated within the database abstraction layer. This way, switching the ORM framework won't affect the rest of the application.

If you have any experience with Hibernate (especially working with relations / associations and using the Session) I would really appreciate your help. It's possible that the performance / speed issue I had encountered was due to bad coding or incorrect understanding of NHibernate.

Jiri

Nov 5, 2009 at 12:48 AM

I've not had a great deal of experience setting up Hibernate mappings, mostly just modifying/using what had been previously setup by others.  In my limited experience setting up Hibernate, I actually used Java 5 annotations, so I didn't really have to mess with the XML.

In searching around just now for similar automated mappings, I came across Fluent NHibernate (http://fluentnhibernate.org/ ). From its Wiki: 

Fluent NHibernate offers an alternative to NHibernate's standard XML mapping files. Rather than writing XML documents (.hbm.xml files), Fluent NHibernate lets you write mappings in strongly typed C# code. This allows for easy refactoring, improved readability and more concise code.

Fluent NHibernate also has several other tools, including: Auto mappings - where mappings are inferred from the design of your entities

I'm not really advocating for this since I've not personally dealt with it, but it might be another thing to consider. 

In briefly looking at CoolStorage it does appear very easy to start using, and might be well-suited for the needs of this project.