22

XPO is the object relational mapper of choice at my company. Any thoughts on the pros and cons?


I was just looking for general feeling and anecdotes about the product. We are not switching to XPO. We are just getting rid of hard coded sql strings living in the app and moving completely to ORM for all data access.

NullUserException
  • 83,810
  • 28
  • 209
  • 234
Ben McNiel
  • 8,661
  • 10
  • 36
  • 38
  • Any ideas on how XPO is handling a simple custom SQL command with (join, ...) or how is working with store procedures? – bmustata Nov 04 '10 at 14:54
  • The whole DevExpress is just junk: full of bugs, slow, unintuitive. –  Nov 29 '19 at 15:39

9 Answers9

16

Others will probably pitch in with technical answers (e.g. the query syntax, use of caching, ease or otherwise of mapping to an existing database structure) -- but if you have an established ORM layer the answer is probably

"Why change"?

I've used XPO successfully for years in an established commercial product with several hundred users. I find that it's fast, flexible and does the job. I don't see any need to change at the moment, as our data volumes aren't particularly large and the foibles (caching, mostly) are things we can work around.

If I were starting afresh I'd definitely look at both NHibernate and the ADO.NET Entity Framework. In practice, though, all are good; I'd most likely look at the commercial situation for the project ahead of the technical questions.

For instance, NHibernate is open-source -- is there a viable community there to support the tool and to provide (if necessary) commercial support?

XPO comes from a tools vendor, are they likely to remain in business for the lifetime of the product?

ADO.NET Entity Framework comes from Microsoft, who are notorious for changing database technologies more often then Larry fills his fighter with jet fuel -- will this, too, fade away?

Jeremy McGee
  • 24,842
  • 10
  • 63
  • 95
11

I have found XPO very frustrating to work with. The main idea of an ORM is to abstract away the underlying data structure. But very quickly you'll notice that they have the default string length hardcoded to 60 chars, so you end up adding these ugly string.unlimited things around every string. So much for abstraction...

When modelling more complex object you have to use a lot of syntax that really has no place in your object model, like XPCollection. I wanted to store a class which had a dictionary of strings on the class, but sadly XPO was not able to automatically store this into the database.

So while it works ok for simple types, it very quickly breaks down when you want to store more complex things. That combined with their mediocre support really leaves a LOT to be desired.

Anders Rune Jensen
  • 3,758
  • 2
  • 42
  • 53
  • 4
    I used them for years at my last job, though not for xpo, and always found their support to be outstanding. Filed bugs all the time, or feature requests, and they were all responded to very quickly. The bugs were fixed fast, and they had no problem giving me a link to a pre-release nightly that contained the fixes. All my questions about how to use it were also answered just as fast, often with sample code. I made a big effort to submit quality issues, so maybe that is why. think only one issue got flagged as a duplicate in all those years. Great company to work with, IMO. – Andrew Aug 19 '11 at 11:59
  • 3
    By default, string properties are mapped to a column of size 100. In any way, you can easily change the default size via the static SizeAttribute.DefaultStringMappingFieldSize property (it needs to be done only once). In addition, you can control the size of individual properties by marking them with the SizeAtrribute, e.g. [Size(255)] in C#. Further details can be found at http://documentation.devexpress.com/#XPO/clsDevExpressXpoSizeAttributetopic Finally, you can even specify the database type of a column that a property is mapped to via the DBTypeAttribute, e.g [DbType("smalldatetime")] – Dennis Garavsky Aug 21 '11 at 13:56
  • As for storing custom complex types, I doubt that other ORMs have buil-in support for this. Out-of-the-box XPO is capable to persist commonn and most-used types and *provides the capability* to store *any custom type*, via the mechanism of Value Converters. For instance, ImageValueConverter and UtcDateTimeConverter are examples of such value converters. Implementing a custom value converter is easy, because you have to implement only two methods. Further details can be found at http://documentation.devexpress.com/#XPO/clsDevExpressXpoMetadataValueConvertertopic – Dennis Garavsky Aug 21 '11 at 14:06
  • 2
    XPO is terrible: we have lots of problems with memory leaks and the order of the objects isn't to be relied on. Stay away from this ORM and use something more established rather than relying on a third party company that may not be here tomorrow or next year. – Thomas Amar May 17 '13 at 06:39
5

I've been working with it for 6-7 months now and the seller for me was the fact that all of their UI components work relatively seamlessly with XPO - and their UI components are top notch.

Some might note that their forums are poorly monitored and have little useful traffic - this is true. The secret is to fill out tickets though. They respond quickly, and accurately to all of their support tickets.

Steven Evers
  • 16,649
  • 19
  • 79
  • 126
  • And their support center web site is up and down like a yoyo... – Rebecca Feb 18 '11 at 10:30
  • Yes, for now i'is better to use the **Support Center** (http://www.devexpress.com/Support/Center/) instead of the XPO forum (http://community.devexpress.com/forums/163.aspx), if you want to receive a quick and guaranteed help from DevExpress representatives. Fortunately, there'll be less confusion between the forums and Support Center when they are merged into one tool, ala StackOverflow. BTW, it's also possible to pass the feedback about XPO & XAF through the groups in social networks: http://community.devexpress.com/blogs/eaf/archive/2011/05/06/frameworks-fan-clubs-in-social-networks.aspx – Dennis Garavsky Aug 21 '11 at 14:16
4

XPO in overall is easy to work with. However, it can be a little pain when you plan to work with legacy database or try to introduce it into a brownfield app. Most painful obstacles I hit were:

  • all objects need to inherit from XPO related classes and/or use XPO related attributes. So, no POCO objects
  • no support for readonly persistent fields OOTB. It's possible, but you need to do a little hacking to stop XPO from updating field in DB
  • no support for pre filtering associations, which can cause excessive network load
  • Poor support for foreign composite keys. To be fair, no ORM handles composite keys nicely. They are considered to be "anti-ORM" pattern.
  • few small annoyances

As Dennis pointed out in comments, XPO was greatly improved since I wrote this answer originally. In particular, below things are no longer an issue:

  • no serialization, so XPO objects are hard to use in disconected win forms scenario, with data coming through web services. - XPO supports now various serialization scenarios and can be easily used with WCF.
  • you cannot do many-to-many relation mapping with your own interim table. Xpo wants specific name for such interim tables. - This is no longer a case
  • no support for enums in postgreSql provider - You just need to write really simple value converter and you are good.

Also, below issues will no longer be problem with next XPO release, coming later this year:

  • no support for keys of type long
  • no support for db schema in postrgeSql provider

All in all, XPO was greatly improved. Most painfull obstacles were removed. You can still hit problems while working with legacy DB. But in general XPO became quite convenient to use.

Przemaas
  • 841
  • 11
  • 23
  • The postgre qualms are edge cases considering all of the other - more common - DBs supported. 2 is wrong, inherit from XPCustomObject. 3 as well is only applicable if you are using generated fields. 4 is counter to the intent of an ORM. WRT 9, use a Jet provider instead, and serialize it yourself if you're using WCF/Web Services. Don't get me wrong, I'm no xpo evangelist; this is just a poor list. – Steven Evers Jul 23 '09 at 05:12
  • 2 is not wrong. If you inherit from XPCustomObject and put KeyAttribute on field of type Int64, you end up with exception. KeyAttribute works only with Int32 or Guid fields unfortunately. 3 is applicable to generated fields - agreed. This is exactly issue I refer to. There is no way to handle such fields now with XPO. WRT 4 - what do you mean by "counter to the intent of an ORM"? I need to reflect schema of my existing DB. I cannot rename tables to be consistent with "intent of ORM". I need ORM to be flexible enough to cover my legacy scenarios. – Przemaas Jul 23 '09 at 09:38
  • PostreSql issues are corner cases - agree. I hope Xpo providers for other DBs are bug free and allow to work with newest features of those DBs. You call my list poor, but all of these issues are real obstacles when you hit them while working with legacy DB and Xpo. – Przemaas Jul 23 '09 at 09:42
  • >> •all objects need to inherit from XPO related classes - no POCO objects << It is not true. You can mark your POCO with the PersistentAttribute and XPO will be able to persist it and perform other operations, as with regular persistent objects. However, you will still miss some XPO goodness when working with POCO (e.g. no associations support - you will have to implement them manually). – Dennis Garavsky Aug 21 '11 at 13:01
  • 1
    >> •no support for keys of type long << It is not a problem any longer: http://community.devexpress.com/blogs/xpo/archive/2011/07/28/xpo-11-2-sneak-peek-auto-generated-int64-keys.aspx – Dennis Garavsky Aug 21 '11 at 13:03
  • >> •no support for readonly persistent fields << It is not true. Use the Persistent and PersistentAlias attributes for that: http://documentation.devexpress.com/#XPO/CustomDocument2875 – Dennis Garavsky Aug 21 '11 at 13:06
  • >> •you cannot do many-to-many relation mapping with your own interim table. Xpo wants specific name for such interim tables. << In addition to automatic many-to-many relation (intermediate table is created and maintained by XPO) you can establish such a relation manually, via you own intermediate table and two one-to-many relations. – Dennis Garavsky Aug 21 '11 at 13:12
  • 1
    >> •no support for pre filtering associations << You can set filter (client side), but cannot specify a criterion (server side) for associated collections from within your business class. I recall that the second feature was also enabled in the beginning, but later we had to turn it off, because it often confused our users (e.g. they could not determine why a collection returns not all their objects even if no filter is applied in the UI). However, you can still set a required criterion in your binding code (i.e. outside the business class scope). – Dennis Garavsky Aug 21 '11 at 13:20
  • 1
    >> •no serialization, so XPO objects are hard to use in disconected win forms scenario, with data coming through web services << The situation has been greatly improved with latest XPO releases: http://community.devexpress.com/blogs/garyshort/archive/2010/11/01/xpo-n-tier-instance-field-level-security-and-much-more-in-xpo-coming-in-v2010-vol-2.aspx http://community.devexpress.com/blogs/xpo/archive/2011/05/17/xpo-11-1-sneak-peek-wcf-services-for-iobjectlayer.aspx – Dennis Garavsky Aug 21 '11 at 13:24
  • 1
    >> •many small annoyances << I hope you reported them in the Support Center. Thank you in advance! As any other software XPO can be improved and great customers feedback is a critical part of this process. You may be interested to know that XPO gets a lot of attention and new features/improvements come every release: http://www.devexpress.com/Products/NET/ORM/whatsnew.xml If you experience any further difficulties with XPO (or any other DevExpress products), feel free to report them via the Support Center to get quick assistance from our Support team: https://www.devexpress.com/sc – Dennis Garavsky Aug 21 '11 at 13:37
  • >> XPO is good for small, new projects. If you convert brownfield applications or want to do something bigger than few projects app, keep away from it. << I cannot agree with you. XPO is also good for large projects. At least I know that many our customers successfully built and delivered apps based on XPO & XAF (http://www.devexpress.com/Products/NET/Application_Framework/), a .NET application framework for fast building modern LOB applications. We also widely use XPO and XAF-based applications internally. For instance, our main website (www.devexpress.com) uses XPO for DB connectivity & BL. – Dennis Garavsky Aug 21 '11 at 13:43
  • Hi Dennis, It's true that XPO was greatly improved since I wrote this answer. Thank you for pointing this out. I will update my post properly – Przemaas Sep 12 '11 at 07:52
  • >>•no support for pre filtering associations, which can cause excessive network load Just wanted to note that it has also been addressed in 11.2: http://www.devexpress.com/issue=S38236 – Dennis Garavsky Nov 03 '11 at 19:32
2

XPO ver 10.2 now supports for both StoredProcedures and SqlQueries. See infomation here...

0

I second the fact the deleting complex objects with some collections take really, really long. So far the documentation or the forums were not able to help me with this.

Apart from that it is really simple to use and gets you going quickly.

It is also quite hard to figure out your memory usage, I had complex big objects in my design and working with them was a memory hog bigger than I had assumed.

Tomas Pajonk
  • 5,132
  • 8
  • 41
  • 51
0

This is all you need to do to start writing your domain objects (try do the same in other systems):

using System;
using DevExpress.Xpo;
using DevExpress.Data.Filtering;
using NUnit.Framework;

namespace XpoTdd {
    public class Person:XPObject {
        public Person(Session session) : base(session) { }
        public string FirstName { get; set; }
        public string LastName { get; set; }
        [Persistent]
        public string FullName { get { return FirstName + " " + LastName; } }
    }
    [TestFixture]
    public class PersonTests {
        [Test]
        public void TestPersistence() {
            const string connStr = "Integrated Security=SSPI;Pooling=false;Data Source=(local);Initial Catalog=XpoTddTest";
            UnitOfWork session1 = new UnitOfWork();
            session1.ConnectionString = connStr;
            Person me = new Person(session1);
            me.FirstName = "Roman";
            me.LastName = "Eremin";
            session1.CommitChanges();
            UnitOfWork session2 = new UnitOfWork();
            session2.ConnectionString = connStr;
            me = session2.FindObject<Person>(CriteriaOperator.Parse("FullName = 'Roman Eremin'"));
            Assert.AreEqual("Roman Eremin", me.FullName);
        }
    }
}
Roman Eremin
  • 1,431
  • 8
  • 10
0

The pros and cons compared to what? There are a lot of alternatives out there, the most popular being nHibernate, with the new kid 'ADO.NET Entity Framework' on the block.

Anyways, there are hundreds of answers depending on your situation and requirements.

Nicholas
  • 2,548
  • 1
  • 17
  • 18
0

I like the fact that you can just create classes, and xpo creates the tables and relationships for you - so you can start from a blank database.

One issue I don't like is when I want to delete a whole bunch of stuff, it will go through my collection and do a delete on each one. This takes ages, so for this kind of instance, I've had to write some custom sql (delete from table where blah). I'm no expert on XPO, but that's what I found.

Dave Arkell
  • 3,920
  • 2
  • 22
  • 27