Note that there are some explanatory texts on larger screens.

plurals
  1. PODevExpress eXpressApp Framework (XAF) and eXpress Persistent Objects (XPO): how do I speed up the loading time of associations?
    text
    copied!<p>I am having a problem with the speed of accessing an association property with a large number of records.</p> <p>I have an XAF app with a parent class called <code>MyParent</code>.</p> <p>There are 230 records in <code>MyParent</code>.</p> <p><code>MyParent</code> has a child class called <code>MyChild</code>.</p> <p>There are 49,000 records in <code>MyChild</code>.</p> <p>I have an association defined between <code>MyParent</code> and <code>MyChild</code> in the standard way:</p> <p>In <code>MyChild</code>:</p> <pre><code>// MyChild (many) and MyParent (one) [Association("MyChild-MyParent")] public MyParent MyParent; </code></pre> <p>And in <code>MyParent</code>:</p> <pre><code>[Association("MyChild-MyParent", typeof(MyChild))] public XPCollection&lt;MyCHild&gt; MyCHildren { get { return GetCollection&lt;MyCHild&gt;("MyCHildren"); } } </code></pre> <p>There's a specific <code>MyParent</code> record called <code>MyParent1</code>.</p> <p>For <code>MyParent1</code>, there are 630 <code>MyChild</code> records.</p> <p>I have a DetailView for a class called <code>MyUI</code>.</p> <p>The user chooses an item in one drop-down in the <code>MyUI</code> DetailView, and my code has to fill another drop-down with <code>MyChild</code> objects.</p> <p>The user chooses <code>MyParent1</code> in the first drop-down.</p> <p>I created a property in <code>MyUI</code> to return the collection of <code>MyChild</code> objects for the selected value in the first drop-down.</p> <p>Here is the code for the property:</p> <pre><code>[NonPersistent] public XPCollection&lt;MyChild&gt; DisplayedValues { get { Session theSession; MyParent theParentValue; XPCollection&lt;MyCHild&gt; theChildren; theParentValue = this.DropDownOne; // get the parent value if theValue == null) { // if none return null; // return null } theChildren = theParentValue.MyChildren; // get the child values for the parent return theChildren; // return it } </code></pre> <p>I marked the <code>DisplayedValues</code> property as <code>NonPersistent</code> because it is only needed for the UI of the DetailVIew. I don't think that persisting it will speed up the creation of the collection the first time, and after it's used to fill the drop-down, I don't need it, so I don't want to spend time storing it.</p> <p>The problem is that it takes 45 seconds to call <code>theParentValue = this.DropDownOne</code>.</p> <p>Specs:</p> <ul> <li>Vista Business</li> <li>8 GB of RAM</li> <li>2.33 GHz E6550 processor</li> <li>SQL Server Express 2005</li> </ul> <p>This is too long for users to wait for one of many drop-downs in the DetailView.</p> <p>I took the time to sketch out the business case because I have two questions:</p> <ol> <li><p>How can I make the associated values load faster?</p></li> <li><p>Is there another (simple) way to program the drop-downs and DetailView that runs much faster?</p></li> </ol> <p>Yes, you can say that 630 is too many items to display in a drop-down, but this code is taking so long I suspect that the speed is proportional to the 49,000 and not to the 630. 100 items in the drop-down would not be too many for my app.</p> <p>I need quite a few of these drop-downs in my app, so it's not appropriate to force the user to enter more complicated filtering criteria for each one. The user needs to pick one value and see the related values.</p> <p>I would understand if finding a large number of records was slow, but finding a few hundred shouldn't take that long.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload