one db call per child (noob question)

one db call per child (noob question)

Old forum URL: forums.lhotka.net/forums/t/3884.aspx


arnie1000 posted on Monday, November 12, 2007

Hi

I am trying to learning CSLA, it's a bit hard without real basic examples (can't call PTracker basic).

I understand the recommended approach for fetching two result sets in one stored procedure. I am wondering if it's a good idea to fetch each object on it's own without children, then use deferred/lazy loading to fetch children only when requested. I know it takes more db calls but for small datasets that's not a problem for me. The advantages seem to be easier code (generation) and it also makes the great-grand-child-parent problem disappear because each level takes care of it's own data fetching?

Hoping for some feedback... BTW I am using CSLA 2.0 just locally.
Thanks
Arnie

Maqster replied on Tuesday, November 13, 2007

Hi Arnie,

I have used the lazy load approach in a web application with great performance.

For some implementation tips look at this thread http://forums.lhotka.net/forums/thread/19011.aspx

Best regards
Maqster

arnie1000 replied on Tuesday, November 13, 2007

Thanks!

rsbaker0 replied on Thursday, November 15, 2007

We've had good experience with lazy loading.

Stored procedures in general, and multiple-result sets from one stored procedure especially, will affect your ability to support multiple back-end databases. This may not be a consideration if SQL Server is your only target database, but if you want to support multiple DB's, you either need to put all your data retrieval code in your DAL, or you need separate stored procedure source for each database you plan to support. (Some DB's don't support stored procedures at all).

Copyright (c) Marimer LLC