 |
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0  | This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

July 21st, 2009, 04:57 PM
|
Authorized User
|
|
Join Date: Jun 2009
Posts: 32
Thanks: 17
Thanked 0 Times in 0 Posts
|
|
I don't think Article.Body really uses lazy load pattern?!Is this just a typo?
Hello,
Sorry for having two active topics, but the following is driving me nuts:
Author said Article.Body property uses lazy load pattern, where Body field is retrieved only when Body property is accessed for the first time. I understand the concept of lazy load pattern, but for this pattern to work, certain stored procedures (which according to author (page 222) donât retrieve Body field) shouldnât retrieve Body field, but they do.
Is this just a typo and thus we can correct it by simply changing SELECT query ( in a stored procedure) to not retrieve Body field, or would other changes also be necessary for lazy load pattern to work with Body property?
thanx
|

August 1st, 2009, 06:06 PM
|
 |
Wrox Author
|
|
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
|
|
You are correct in noting that the lazy-load implementation is flawed.
This is because while the implementation does prevent the body of an article from being loaded into article lists, it does not prevent the body from being retrieved from the database, loaded into the reader, and carried across the wire, which is where the real performance bottleneck lies.
To correct this, you could simply prevent the body from being retrieved in any sproc that returns multiple articles. This might involve changing the application code in some places as well.
|
The Following User Says Thank You to Lee Dumond For This Useful Post:
|
|

August 10th, 2009, 05:36 PM
|
Authorized User
|
|
Join Date: Jun 2009
Posts: 32
Thanks: 17
Thanked 0 Times in 0 Posts
|
|
Quote:
Originally Posted by Lee Dumond
You are correct in noting that the lazy-load implementation is flawed.
This is because while the implementation does prevent the body of an article from being loaded into article lists, it does not prevent the body from being retrieved from the database, loaded into the reader, and carried across the wire, which is where the real performance bottleneck lies.
To correct this, you could simply prevent the body from being retrieved in any sproc that returns multiple articles. This might involve changing the application code in some places as well.
|
Uhm, are you sure about also needing to change some of application code? I thought preventing procedures from retrieving Body would suffice?
thanx
|

August 10th, 2009, 05:45 PM
|
 |
Wrox Author
|
|
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
|
|
Quote:
Originally Posted by carewithl
Uhm, are you sure about also needing to change some of application code?
|
Absolutely not sure.
I said you "might" have to, but I haven't really traced through the code closely enough to know. I'd say the best way to be sure is to try it.
|
The Following User Says Thank You to Lee Dumond For This Useful Post:
|
|

August 13th, 2009, 02:15 PM
|
Authorized User
|
|
Join Date: Jun 2009
Posts: 32
Thanks: 17
Thanked 0 Times in 0 Posts
|
|
thanx for helping me out
cheers
|

August 18th, 2009, 06:16 PM
|
Authorized User
|
|
Join Date: Aug 2009
Posts: 12
Thanks: 5
Thanked 0 Times in 0 Posts
|
|
My thought is that you would have to change the following stored procedures:
tbh_Articles_GetArticles, tbh_Articles_GetArticlesByCategory, tbh_Articles_GetPublishedArticles, tbh_Articles_GetPublishedArticlesByCategory.
At the same time there would be no purpose in overloading the GetArticleCollectionFromReader method in the ArticlesProvider class and call the GetArticleFromReader method using false as the second parameter.
However, even though it is true that the implementation does not really avoid retrieving the bodies from the database, it allows for article lists to have the body. I assume this could be useful if you want to implement a news section where you would need to edit several articles at the same time. Of course you could create specific stored procedures for those cases, and use the ones without the bodies for article listing purposes.
|
|
 |