New Posts New Posts RSS Feed: Lazy Loading?
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Lazy Loading?

 Post Reply Post Reply
Author
mlens View Drop Down
Newbie
Newbie
Avatar

Joined: 19-Apr-2010
Location: Australia
Posts: 7
Post Options Post Options   Quote mlens Quote  Post ReplyReply Direct Link To This Post Topic: Lazy Loading?
    Posted: 20-Apr-2010 at 11:31pm
Hi There,

The issue has been resolved. It was nothing to do with DevForce, there was an oversight in the ViewModel.

Thanks
Marcus
Back to Top
mlens View Drop Down
Newbie
Newbie
Avatar

Joined: 19-Apr-2010
Location: Australia
Posts: 7
Post Options Post Options   Quote mlens Quote  Post ReplyReply Direct Link To This Post Posted: 20-Apr-2010 at 12:14am
Thanks for the response. Please see details below;


public class ProductList : ObservableCollection<Product>
    {
        public ProductList()
        {
             ((App)App.Current).Manager.ExecuteQueryAsync(((App)App.Current).Manager.Products, GotProducts, null);
        }

        private void GotProducts(EntityFetchedEventArgs args)
        {
            if (args.Error != null)
            {
                //WriteMessage(args.Error.Message);
            }
            else
            {
                foreach (Product product in args.Result)
                {
                    this.Add(product);
                }
            }
        }

      
    }

* Note : When each product is added the the collection in the foreach loop, the Product.Colors have no items, is this normal behaviour?

<data:DataGrid.Columns>
                                <!-- Product Combo -->
                                <data:DataGridTemplateColumn Header="Product/Style">
                                    <data:DataGridTemplateColumn.CellEditingTemplate>
                                        <DataTemplate>
                                            <ComboBox x:Name="cboProduct" ItemsSource="{StaticResource Products}" DisplayMemberPath="Description" SelectedItem="{Binding Source={StaticResource SalesOrderVM}, Path=SelectedProduct, Mode=TwoWay}"></ComboBox>
                                        </DataTemplate>
                                    </data:DataGridTemplateColumn.CellEditingTemplate>
                                </data:DataGridTemplateColumn>

Upon choosing a Product from the ComboBox, the colors collection has no items. Subsequent selection shows colors where appropriate. It's like the Async fetch takes a while to retrieve?

Please let me know if you require more information.

Regards
Marcus



Back to Top
davidklitzke View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 14-Jun-2007
Posts: 715
Post Options Post Options   Quote davidklitzke Quote  Post ReplyReply Direct Link To This Post Posted: 19-Apr-2010 at 3:49pm
If this were true "lazy loading", you would expect that the colors would appear on the first query.  The fact that the colors only appear on the second amd subsequent queries argues that the data is being accessed through the Entity Manager cache, not "lazy loading.
 
Do you have an example that you would like to show us?
Back to Top
mlens View Drop Down
Newbie
Newbie
Avatar

Joined: 19-Apr-2010
Location: Australia
Posts: 7
Post Options Post Options   Quote mlens Quote  Post ReplyReply Direct Link To This Post Posted: 19-Apr-2010 at 12:40am
Hi There,

Environment : SL3, VS2008, DevForce 5.2.6

We have a basic model that seems to be lazy loading a nested collection. In a nutshell we have a Product that has a collection of colors. We've setup a basic SL input form to allow customers the ability to choose a Product from a combobox. In turn, we filter another combo box with available colors for that product. Problem is, the first time you select a product the color collection has no items in it. The second and subsequent time(s) the colors appear fine.

Has anyone else experience this behaviour? It's appears as though the colors are lazily loaded?

Regards
Marcus
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down