Lazy loading in RIA Services

2 posts, 0 answers
  1. Doxxer
    Doxxer avatar
    5 posts
    Member since:
    Nov 2011

    Posted 23 Aug 2012 Link to this post

    Hi,

    I'm using Telerik ORM OpenAccess as DAL in Silverlight application and WCF RIA Services.
    I have [for example] simple schema: 3 tables in database: Category, subcategory and product. Each category has some subcategories, each subcategory has some goods. So, it's simple one-to-many relationships.

    I create Domain Model, after - Domain Service.

    I want to load from database ALL Category Entities WITH ALL Subcategories, but WITHOUT products, because some subcategories have lot of goods. Can I use lazy-loading in my scenario? It was Question1.

    Question2: The domain service doesn't generate any code for association in my Category-Subcategory. After reading this post (http://www.telerik.com/help/openaccess-orm/getting-started-root-quickstart-sl-wcfria-handle-relations.html) I've add [Include]  and [Association] attributes, after that i've seen my properties in generated code, BUT, SQL Server Profiler shows me a lot of query: "exec sp_execute 1,@p0=2", "exec sp_execute 1,@p0=3" e.t.c, like there is no Lazy-loading, it was eager Loading behaviour.
    So, question is "can I use lazy-loading in WCF RIA app?"

    Thank you and sorry for my english. I would appreciate a fast response.
  2. PetarP
    Admin
    PetarP avatar
    754 posts

    Posted 28 Aug 2012 Link to this post

    Hello Doxxer,

     You should be able to apply a fetchplan in your get method for the class in concern. The fetchpaln will have to include all the reference properties you would like to be fetched together with the main object thus reducing the number of queries that will be executed. Additional information regarding the fetch plans can be found in our online documentation.

    All the best,
    Petar
    the Telerik team
    Follow @OpenAccessORM Twitter channel to be the first one to get the latest updates on new releases, tips and tricks and sneak peeks at our product labs!
  3. DevCraft banner
Back to Top