Rehosted Workflow - Working with large sets of data RRS feed

  • Question

  • I have created rehosted workflow. In the rehosted workflow i use flowchart and custom activities. 

    One of the custom activites needs to switch between a large set of EAN numbers (potential up to 2.000.000). I have customized the flowswitch designer using WorkflowItemPresenter and created a custom class that derives from Codeactivity. 

    The custom switch actually doesnt switch on the EAN numbers, but on alias' that group the EAN numbers.

    A you can see from the image this works. And when i run the workflow it works too (if you send an object in the workflow that has the metadata, sender_enpoint wich, value is one of the EAN numbers). So yeah! But... The data you see is just loaded in the property as dummy data, like this:

      public ObservableCollection<MetaDataValue> AliasList
                    if (this.aliasList == null)
                        this.aliasList = new ObservableCollection<MetaDataValue>();
                        AliasList.CollectionChanged += aliasList_CollectionChanged;
                        #region testData
                        Random random = new Random();
                        ArrayList aliases = new ArrayList { "ILS", "OUH", "FynBus", "Apovision","SEB Bank","AS2007"};
                        for (int i = 0; i < 4000; i++)
                            int randomEAN = 579800;
                            int randomEAN2 = random.Next(2200000, 2599999);
                            int alias = random.Next(aliases.Count);
                            this.aliasList.Add(new MetaDataValue(randomEAN.ToString() + randomEAN2.ToString(), aliases[alias].ToString()));
                        Debug.WriteLine("Test data has been created");
                    return this.aliasList;

    My issue is that i would like to load the data from a DB and not save any of the data to the XAML for this property. One reason is that the XAML cannot handle large lists. If i populate my list with say 25000 items, then 25000 items will be loaded into the XAML and then when i try to save the workflow, i get a deadlock error and everything gets very slow. Another reason is that i would like to reuse the same list of EAN numbers, instead of create a new activity with the same EAN numbers every time. 

    Finally to my question :)

    How do I make sure that the data for the property i is not saved in XAML?

    In advance thx :)

    Monday, January 6, 2014 12:07 PM


All replies

  • Hi,

    I think you can try storing data from ObservableCollection into database and then load the data from db when need to use. For more information, you can refer here

    #Using the WPF ObservableCollection with EF Entities


    #store data into database


    Hope it can help you.

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.

    • Marked as answer by Rasck Tuesday, January 7, 2014 9:02 AM
    Tuesday, January 7, 2014 2:37 AM
  • I created another class that did not derive from Codeactivity to handle the large collection. This solved my issue, because now it is not saved to the XAML.

    My only issue now is that the class has been separated into two classes, and should have been in only one class, from an object oriented point of view.

    Tuesday, January 7, 2014 9:05 AM