Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8522181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:02:40+00:00 2026-06-11T07:02:40+00:00

I don’t know whether it’s my mistake or a bug in Devexpres XPO? (Version

  • 0

I don’t know whether it’s my mistake or a bug in Devexpres XPO? (Version 12.1.5)

take a look at the following sample:

static void Main(string[] args)
    {
        var dxs = Session.DefaultSession;
        var sw = new Stopwatch();

        using (var uow = dxs.BeginNestedUnitOfWork())
        {
            var dbp = new DBParent(uow) { TitleXX = "Morgan" };

            // add 1000 child to the parent table
            for (var i = 0; i < 1000; i++)
            {
                var dbc = new DBChild(uow)
                              {
                                  Name = string.Format("Child {0}", i),
                                  Parent = dbp
                              };
            }

            var count = uow.GetObjectsToSave();
            // count = 1001
            sw.Start();
            uow.CommitChanges();
            sw.Stop();
            Console.WriteLine("Time:" +sw.Elapsed);
            // Takes about 7 sec
        }


        using (var uow = dxs.BeginNestedUnitOfWork())
        {
            var dbp = new XPCollection<DBParent>(uow).First();
            dbp.TitleXX = "Another title";
            dbp.Save();

            var count = uow.GetObjectsToSave();
            // count = 1
            sw.Reset();
            sw.Start();
            uow.CommitChanges();
            sw.Stop();
            Console.WriteLine("Time:" + sw.Elapsed); // Takes about 4 sec ????
        }
        Console.ReadLine();
    }
}

and here are my objects :

public class DBParent : XPObject
{
    public DBParent(){}
    public DBParent(Session session) : base(session) { }

    private string _TitleXX;
    public string TitleXX
    {
        get { return _TitleXX; }
        set { SetPropertyValue("TitleXX", ref _TitleXX, value); }
    }

    [Association("a1"), Aggregated]
    public XPCollection<DBChild> Childs
    {
        get
        {
            return GetCollection<DBChild>("Childs");                
        }
    }      
}


public class DBChild : XPObject
{
    public DBChild(){}
    public DBChild(Session session): base(session){}

    private string _Name;       
    public string Name
    {
        get { return _Name; }
        set { SetPropertyValue("Name", ref _Name, value); }
    }

    private DBParent _Parent;
    [Association("a1")]
    public DBParent Parent
    {
        get { return _Parent; }
        set { SetPropertyValue("Parent", ref _Parent, value); }
    }       
}

as you can see , saving 1001 ( 1000 child + 1 parent ) takes 7 seconds , and in the next block updating 1 parent object is taking 4 seconds. i have tested against MS Access and MS SQL 2008 and MSSQL-Compact , but all have the same result. any advices are appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T07:02:42+00:00Added an answer on June 11, 2026 at 7:02 am

    This seems like a reasonable length of time for 1001 discrete Inserts. The objects are held in memory until you call CommitChanges at which point they are written to the database. I haven’t profiled the SQL that XPO generates, but I wouldn’t be surprised if each insert took place inside its own implicit transaction.

    EDIT

    I’ve compiled your code with the tracing suggested by Filip, and the second NestedUnitOfWork is actually updating all of the children, even though there’s no work to do (this is in version 12.1.7). I’m not sure if this is by design, but it does seem like a bug to me.

    To avoid updating the children unnecessarily, you can just instantiate a plain UnitOfWork:

    using (var uow = new UnitOfWork())
    {
        //...
    }
    

    This will only update the parent object. But be careful: you will still need a NestedUnitOfWork for updates that will affect the child objects.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Don't know a whole lot about streams. Why does the first version work using
Don't know if it's I'm doing it wrong or if there's a bug (I
Don't know whether I'm having a "thick day" - but I just wondered what
don't know if the title describes anything about what I'm trying to say but
don't know what happened in my jcrop selection. I think I pressed some keys
Don't really know how to formulate the title, but it should be pretty obvious
Don't know how to google for such, but is there a way to query
Don't know why but font is not displaying.Please help. CSS(in css folder): style.css: @font-face
Don't ask me why but I need to do the following: string ClassName =
I don't know why, but this code worked for me a month ago... maybe

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.