How can we easily persist objects entities ?
Different solutions :
- using object database instead of relational (example : free .NET object db db4o)
- using code generation (see MetaData Mapping with code generation from Martin Fowler)
- using O/R Mapping tools (see MetaData Mapping with reflection from Martin Fowler)
MetaData Mapping with code generation or with reflection (ORM) ? Let’s see the pros and cons : http://www.theserverside.net/news/thread.tss?thread_id=29071
>>> ABOUT O/R MAPPING
O/R mapping tools :
http://sharptoolbox.com/Category74089b0a-1105-4389-b1db-eedf27e20cfb.aspx
How to choose a O/R mapping tool ?
http://madgeek.com/articles/ormapping/fr/mapping.htm
>>> CODE GENERATION
MyGeneration (free) :
http://www.mygenerationsoftware.com
CodeSmith (from 99$) :
http://www.codesmithtools.com/
>>> AND…
Next approach : C-omega, the unified language between objects and SQL from Microsoft Research : http://research.microsoft.com/comega/
Currently, I use NHibernate and a NHibenate template of MyGeneration … the main advantage of NHibernate is the really simple business entity code used (no custom attributes, no inheritance,…just 2 specific properties). Unfortunately, I am actually disappointed by the performances on entity collections results. I hope a next version optimized for .NET 2.0 will soon arrived including generics, nullable types and reflection optimizations ! MyGeneration, the CS and XML code generator, is also simple and really efficient.
In a another way than O/R mapping, you can produce a part of a 5-layers architecture (data access, persistence, business logic, service, but not presentation !). So, I also tried NetTiers with CodeSmith, but I met 2 main problems :
- some bugs on the NetTiers v0.9.2…like “missing files” in VS.NET 2005 project generated.
- the generated business classes are really complete (maybe too!) and implement a lot of interface…too much code, in my opinion !
Good luck.