TopReturnedObjects lead to error

StatusIDPriorityType
Open29347CriticalBug
ProfileReply
nickcoleClient

In Top n mode, after I add some objects from a action, the application crack when I click the grid.
how to slove it?

attached is my applaction.

Replies

UserDescriptionPosted On
Sasha (Xafari Support)Agent

Hello nickcole,

My apologies for the delay and thanks for the additional information!

You can solve this problem if you use the this.ObjectSpace property instead of the new oSpace.
Alternatively, you can add the line ObjectSpace.CommitChanges (); after oSpace.CommitChanges ();.

Feel free to contact us if you experience any further difficulties.
Best regards,
Sasha.

nickcole

I add the line ObjectSpace.CommitChanges (); after oSpace.CommitChanges ();.
But it does not work. the problem also exisits !

Sasha (Xafari Support)Agent

Hi,

I'am sorry, I did not notice all the nuances in your sample and and made false conclusions!
I see the problem and I am now working on it.

Thanks, Sasha.

Sasha (Xafari Support)Agent

Hello,

We can offer for your app solution following code:

private void simpleAction1_Execute(object sender, SimpleActionExecuteEventArgs e)
{
var listView = View as ListView;
if (listView == null) return;var oSpace = this.Application.CreateObjectSpace();for (int i = 0; i < 100; i++)
{
var domainObject1 = oSpace.CreateObject();
domainObject1.PersistentProperty = string.Format("{0}-{1}", DateTime.Now, i);
}oSpace.CommitChanges();
listView.CollectionSource.Reload();

//Refresh
View.ObjectSpace.Refresh();
}

Please, inform us if this solution does not suit you.

Best regards,
Sasha.