Wrox Programmer Forums
|
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
 
Old May 21st, 2008, 08:13 PM
Authorized User
 
Join Date: Mar 2008
Posts: 62
Thanks: 1
Thanked 3 Times in 3 Posts
Send a message via Yahoo to kalel_4444
Default SqlArticlesProvider vs SqlStoreProvider ?

I know I'm prematurely asking, I really didn't do much digging on why, but I was hoping that someone might have a quick response to this question. This dilemma arose when building all the SPROC's for my data schema and got to needing a "GetEntities" SPROC which includes paging and sorting...

Can anyone tell me why in the SqlArticleProvider Marco put the function of GetArticles() in a SPROC, but in SqlStoreProvider, the GetProducts() (the query) is within the method?

From first look, both GetArticles() & GetProducts() seem quite similar, they get all data fields and include params for pageIndex and pageSize, the only difference I see is that GetProducts() includes a sortExpression. Is that the reason? Though it can be passed on to a SPROC too..

Is there a specific reason for this, or is it just meant to break up the rhythm and show variations of what can be done?


Thank you all,
Ronnie

 
Old May 21st, 2008, 09:46 PM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

You pretty much guessed it -- it is exactly because of the sortExpression. The query needs to support sorting on various fields, such as UnitPrice, Title, etc.

You mention that the sortExpression "can be passed on to a SPROC too", but this isn't really the case, as the ORDER BY clause doesn't support the use of parameters. That's the specific reason behind doing it with a String.Format() instead.
 
Old May 22nd, 2008, 12:57 AM
Authorized User
 
Join Date: Mar 2008
Posts: 62
Thanks: 1
Thanked 3 Times in 3 Posts
Send a message via Yahoo to kalel_4444
Default

Thanks for the quick response Lee. As for passing to the SPROC, I was sure it was possible because I've done it before. BUT, I just dug through my SQL projects and reviewed the SPROC that included a sortExpression... It was dynamic, and now I remember why I had to put it in a dynamic query... Exactly because of your response.

While sticking with SPROC's for my queries as much as possible, and since I'm using ASP 3.5 in this project, I'll use LINQ for these type of queries (NO dynamic SPROC's ).

Thanks again,
Ronnie







Similar Threads
Thread Thread Starter Forum Replies Last Post
DB access denied, but only SqlStoreProvider.cs ewelling BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 13 November 9th, 2007 01:36 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.