AliRezaGoogle said:
Hi
Currently there are some good ORM tools like NHibernate and LLBGL.
Microsoft is working on it's own one ( I think it's name is
EntitySpace) but not released yet.
I want to know members idea about selecting one of these ORMs:
--Should we wait untill Microsoft release his own ORM? ( and maybe
after two or three years again releases another one and we have to
throw our experiences away and styart to learn new one?)
--Choosing current ORMs is nice? (Does for example NHibernate remain
with .NET forever with support? What about future release of .NET? Is
there any quaranty that future features of .NET remain compatible with
current ORM frameworks? )
I'm almost universally not happy with any of them to be honest... but
that's because I'm developing WCF web services and the only framework
that I've tried so far, which is built with n-tier in mind, was netTiers
- which I don't like because it's a code generation framework (meaning
it builds all your business objects for you and then rebuilds these
every time you make a changes to the databases... implying you can't
modify your business classes to support IMyInterface or anything like
that, making polymorphism often very difficult to use).
Otherwise I've used both DevExpress XPO and nHibernate. XPO is much
slicker in terms of generating and maintaining the underlying databases
and also has much better multi database support than nHibernate (which
chokes when doing simple stuff like using Guid fields with MS Access).
XPO also has a much more logical Attribute design since the nHibernate
attributes are basically a hack wrapper around an XML mapping document
(in fact, the attributes in nHibernate are simply used to generate an
XML document on the fly in memory, which is then used to generate the
object map). In XPO, as a consequence, you generally have to use far
fewer attributes (sometimes none, on a persistent class, other times
just one - for the class itself) and you don't have to worry about work
arounds to the inherently hacky nature of the attributes in nHibernate
(such as the fact that you have to give each attribute an "Order"
parameter to specify the order in which it should be processed -
attributes shouldn't have an order... they're meta data not logic).
Either of the above frameworks (nHibernate and XPO) are pretty good all
in all. But neither of them do n-tier at all well. Both of them depend
on the idea of "Sessions" and presume that you've got long lived
sessions that last the lifetime of the application and REQUIRE you to
save an object using the same session that it was loaded in (something
that will almost never be the case when doing n-tier). They also both
pretty much depend on the concept of lazy loading in order to decide
what needs to be loaded and what doesn't... something that doesn't work
at all when you're doing n-tier since the object and everything you need
to know about it needs to be streamed across to the client and the
session closed BEFORE you know what properties of the object the client
is interested in. Finally, both nHibernate and XPO require you define
the relationships between different classes if you want to create
queries joining those classes and ONLY let you join those classes in
your queries using the relationships that you defined using foreign
keys... so no ad-hoc query joins (not without resorting to writing your
own Views in the underlying database engine that you're using and
mapping these to a persistent nHibernate/XPO class).
All in all the move to an ORM has been a bit of a mixed blessing for me
in n-tier. I can see for plain vanilla desktop applications that none of
the above would really be issues and both of the above frameworks would
be huge time savers, but in n-tier you're going to spend about a month
working around their various issues before either of them are usable.
Best Regards,
James Crosswell
Microforge.net LLC
http://www.microforge.net