Using AutoMapper with DevExpress XPO

If you are using AutoMapper (a great tool btw) together with DevExpress XPO its posssible you run into this error

automapper needs to have a constructor with 0 args or only optional args

var autoMapperConfig = new MapperConfiguration(
  cfg => cfg.CreateMap<SourceObject, MyXpoObject>().
    ConstructUsing(x => new MyXpoObject(mySession)
  )
);

Sure, no rocket science but I had to search a while.