Friday, 24 October 2008

ORM with Developer Express Persistent Objects (XPO)

I've been using ORMs for a long while now and love the speed and flexibility they can bring to the development process. For projects in  work we use an ORM that we wrote ourselves.  As I'm now doing some projects outside of my day job, I have been looking around at the available ORM offerings for a few months now.  I'm now pretty likely to be using Express Persistent Objects (XPO) from Developer Express - a developer tool vendor with an excellent reputation and strong background.

I've been evaluating their UI controls for a while now and I have been generally very impressed with both their products and their excellent support.  XPO comes from this background and has the main features that I want:

  • Support for the Compact Framework.
  • A LINQ provider.
  • Generation of schema from object definitions (you can also generate objects from an existing schema).
  • Wide support for a variety of databases (including my target database, VistaDB). 
  • Easy data binding of objects to controls (as you'd expect from DevExpress!).

It does have a few quirks that I'm a little unsure about at the moment.  The main ones for me now are:
  • All associations with multiplicity greater than one have to be two-way.
  • The automatic schema generation mechanism will not widen string fields in existing schemas. 
I also get the feeling from reading their forums that XPO gets a "little less love" than some of their other products.  I think that it may be seen as either largely functionally complete, or that it now plays a supporting role to their application framework, XAF.

However, these are only small niggles and the product is seems to be well constructed, uses best practices, has good support from a much respected tool vendor and is realistically priced.  If you are coming to ORM from a data-driven background, then you will probably even be comfortable with having to always having to have have two sides to an association!  It is worth noting that XPO takes care of the other end of the relationship for you - if I add an order to a customer, then the order's customer is automatically set...neat and sweet!

If you are looking for an easy to use commercial ORM that is reasonably priced, then I would recommend you take a look.   If you are not looking for a non-commercial ORM, or want to learn about the world of object-relational mapping, then head off to NHibernate.

Edit: Just thought it worth noting that the "small niggles" about XPO are in the context of my current project, which has a relatively simple object model - one for which I would happily manually write the data access code.  I would not be comfortable recommending XPO for complex object models at this stage.

6 comments:

Anonymous said...

Thanks for your article.

I've been happily using XPO for many months, but want to be aware of what else is out there.

Have you used NHibernate for a complete project? If not, do you know of anyone who has used both XPO and NHibernate extensively and can comment on the relative merits of each product?

Thanks in advance,

Adam Leffert

Sean Kearon said...

@Adam

There are a lot of decent ORMs out there these days and you should be sure that you are happy with the one you choose. They each have their own quirks, and so being happy means that the ORM you choose makes your development easier and more reliable with less work. At the end of the day, that is what an ORM is all about for me.

I have not used NHibernate for a live project, but I have the greatest of respect for it and the community that use it. The only reason I am not adopting it is that it replaces your collections with it's own at runtime. I extensively use change notifications in my collections to configure business rules and this interferes.

The only blog that I follow that distills both XPO and NHibernate experience is Rinat Abdullin's and I suggest you take a look at his NHibernate and XPO posts. You can find it here: http://rabdullin.com/.

darichkid said...

Sean Kearon

This is a good LINQ provider for VistaDB.
https://www.kellermansoftware.com/p-47-net-data-access-layer.aspx

Sean Kearon said...

@Avasa

Thanks for that, it looks interesting. I've stopped using both XPO and VistaDB since this post, but it's useful to know about.

Unknown said...

I currently use EntitySpaces and VistaDB. EntitySpaces is no longer around and I'm considering switching to XPO and potentially off of VistaDB to MYSQL. My question is why do you no longer use VistaDB? Also, do you like XPO?

Sean Kearon said...

@Unknown

I stopped using VistaDB a couple of years ago now. It was a good DB for my use cases and worked well with XPO at the time.

I did experience a file size bloating issue during schema upgrades which generated a number of support issues. This is the primary reason why I moved away from VistaDB and XPO. I could not say precisely what was the cause of the problem.

I found XPO to be good, but I prefer to use Entity Framework (code first) these days when working against an RDB.

For an embedded RDB I prefer SQL Server CE 4. However, I also use RavenDB and have found it to be excellent in an embedded scenarios, including on lower powered devices such as netbooks. However, it's a document database and has a different approach to data modelling.

HTH!