This is a migrated thread and some comments may be shown as answers.

Lazy loading in RIA Services

1 Answer 72 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Doxxer
Top achievements
Rank 1
Doxxer asked on 23 Aug 2012, 12:47 PM
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.

1 Answer, 1 is accepted

Sort by
0
PetarP
Telerik team
answered on 28 Aug 2012, 08:54 AM
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!
Tags
General Discussions
Asked by
Doxxer
Top achievements
Rank 1
Answers by
PetarP
Telerik team
Share this question
or