 |
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
|
|
|
|

March 25th, 2008, 10:50 AM
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
Enjoy! Please let me know if you have any questions / problems!
-Doug
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========
|

March 28th, 2008, 11:22 AM
|
Registered User
|
|
Join Date: May 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
quote:Originally posted by jimibt
doug - any chance of seeing a version 1.01 of the pdf with this stuff (LinqDataSource, pagin, editting etc) included just to see how all the component pieces fit together (that way all of the beerhouse functionailty using linq would be showcased).
fingers xx'd - :-0
jimi
http://www.originaltalent.com
|
It seems to me that this blox is a departure from the original target audience of the book.
Consider Scott Guthrie's quote on the cover of the original book: "I'd definitely recommend this book to anyone who understands the basics of how ASP.NET works, already, and is looking for a good book to take them to the next level and really start to build applications with it."
Partial examples that lack paging, sorting, etc. are very disappointing.
Basic information on upgrading to .NET 3.5 and Linq is generally available. What I need at this point is a single-source COMPREHENSIVE example of converting TheBeerHouse to the .NET Framework 3.5.
Please consider this post to be my vote for version 1.01 of the blox.
|

March 28th, 2008, 11:33 AM
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
Noted.
I would like to point out that I made it very clear in my Abstract that the intent of the article was to demonstrate how a user would go about replacing the exsisting DAL in TBH with a LINQ solution. It was not intended to demonstrate paging, sorting, or what have you because Wrox has a set limit on how long Blox Articles can be.
Anyway, as I said previously I wouldn't object to writing another Blox that focused on paging, sorting, and so forth but currently that is not in the cards as I am wrapped up on another Wrox Project.
Thanks for reading the article!
-Doug
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========
|

April 2nd, 2008, 08:16 PM
|
Authorized User
|
|
Join Date: Mar 2008
Posts: 62
Thanks: 1
Thanked 3 Times in 3 Posts
|
|
Doug,
I've been working through each chapter, first creating it identically in vs2005/asp.net 2.0 then again in vs2008/asp.net 3.5 with some customization.
I just finished the News & Articles section as is in vs2005 and I'm about to not only re-create this in asp.net 3.5 but add some customization:
- Bind the Articles to other tables (ie: Restaurants_Table)
- Add to the tbh_comments table so that each person that adds a comment & rating, her rating will not only be added to a single count in the tbh_Articles.TotalRating field, but rating info shown for each comment separately, and also the ability to rate across 4 different criterias (fields).
Though doing this is not any great task (changing/adding to the tables, SP, DAL, & BLL). I would like to know you're opinion, based on your experience with this Blox.
Would you first do all the customization in 2.0, than convert to 3.5, than do customization? OR Customize and convert to 3.5 at the same time?
Thanks in advance,
Ronnie
|

April 3rd, 2008, 07:48 AM
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
Hi Ronnie,
You should be ok with first doing everything in 2.0 and then "converting" the app to 3.5. I use the term converting here very loosely because, unlike the deviation that exists between the 1.x and 2.0 version's of the framework, 3.5 runs on top of the 2.0 core.
One item in particular that is not converted when you open a 2.0 website up in VS2K8 is the web.config. As I point out in my Blox article, by default, VS2K8 does not automatically add the compiler directives necessary for your application to target the 3.5 compiler. What will happen if you don't add this directive is that when you attempt to use some of the new 3.5 features (LINQ for example) you will get a very cryptic compiler error when you try to build your application.
Personally, if I were in your ****s, I would just do the customization in VS2K8 but if you choose to do it in VS2K5 you should not run into any major hurdles when you attempt to convert.
-Doug
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========
|

April 7th, 2008, 11:31 AM
|
 |
Wrox Author
|
|
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
|
|
Quote:
quote:Originally posted by dparsons
Yes that is possible though you would probably want to use a LinqDataSource to achieve this (as a bonus you could also set your gridview up to use paging, editing, etc with this control)
http://msdn2.microsoft.com/en-us/lib...atasource.aspx
-Doug
|
Just an observation... it seems to me giving up the ObjectDataSource for LinqDataSource probably isn't the best move. As far as I can tell, LinqDataSource appears to be the merely the LINQ "equivalent" of SqlDataSource -- usable for trivial apps and quick prototyping, but nothing you'd want to use in production code. While it leverages the power of Linq, it still retains the drawback of embedding data access work in the presentation layer, which is what we're trying to avoid.
Seems to me better to use LINQ to retrieve and update the objects, but to continue using ObjectDataSource as the go-between between the UI and the underlying layers.
You can still set up GridViews to do paging, sorting, etc. with ObjectDataSource as always. Or better yet, ditch the GridView and use the new ListView and DataPager controls.
|

April 21st, 2008, 05:01 AM
|
Friend of Wrox
|
|
Join Date: Mar 2007
Posts: 488
Thanks: 2
Thanked 11 Times in 10 Posts
|
|
hi, still haven't looked to much more closely at the article (just got back mid-week last week), but did find this little nugget which may be of use to peeps on a LINQ bender:
http://www.singingeels.com/Articles/...ion_Trees.aspx
still keeping a respectful distance from LINQ until i can fully see the etitiies picture etc, etc..
jimi
http://www.originaltalent.com
|

April 23rd, 2008, 05:25 PM
|
Authorized User
|
|
Join Date: Mar 2008
Posts: 62
Thanks: 1
Thanked 3 Times in 3 Posts
|
|
To anyone that has this BLOX and has worked through it, at least to page 17:
I just finished working through the book and I just started working on this BLOX and encountered an error.
I initially built the book in VS2008, ASP3.5, and SQL2005. So there wasn't really any changes required to the Web.config, but I checked it against the BLOX anyways (all good).
I worked through to page 17(right before Scalar Functions), rebuilt and ran it, and got this error and many more like it:
CS1502: The best overloaded method match for 'MB.TheBeerHouse.BLL.Articles.Article.GetArticleLi stFromArticleDetailsList(System.Collections.Generi c.List<tbh_Article>)' has some invalid arguments
List<ArticleDetails> recordset = SiteProvider.Articles.GetArticles(categoryID, GetPageIndex(startRowIndex, maximumRows), maximumRows);
--Erorr--> articles = GetArticleListFromArticleDetailsList(recordset);
BaseArticle.CacheData(key, articles);
So I tried converting the above and the other methods from using "SiteProvider" class to "<tbh_Article>", since I only had one method converted to this point, but it brought up a bunch of other errors and questions, so I stepped back to this point. Did I misread the BLOX somewhere?
Also, unless I'm further mistaken, the BLOX syntax says to change (top of pg. 17):
return new Article(record.ID..., Shouldn't it be return new Article(record.ArticleID....
because in LINQ the relationship is to ArticleID in the Article table, ID was created/used by the SiteProvider, correct ?
Any direction on this is appreciated.
Thank you,
Ronnie
|

April 23rd, 2008, 05:56 PM
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
Hi Ronnie,
First the easy question. Yes the code in the article varies from the code that is actually in the code download so your observation is correct: return new Article(record.ID should, in fact, be return new Article(record.ArticleID
I will create an Errata Thread after I get done posting this to keep the other readers informed.
Next about your code. Based upon your code the invalid argument error is being generated because you are trying to pass a List of type ArticleDetails into the method and not a List of type tbh_Articles. Change this code:
Code:
List<ArticleDetails> recordset = SiteProvider.Articles.GetArticles(categoryID, GetPageIndex(startRowIndex, maximumRows), maximumRows);
articles = GetArticleListFromArticleDetailsList(recordset);
BaseArticle.CacheData(key, articles);
to
Code:
TBHDataContext context = new TBHDataContext();
List<tbh_Article> recordset =
context.tbh_Articles_GetArticles(GetPageIndex
(startRowIndex, maximumRows), maximumRows).ToList();
articles = GetArticleListFromArticleDetailsList(recordset);
BaseArticle.CacheData(key, articles);
As you work through this Blox you will totally remove all of the calls to SiteProvider (as far as articles are concerned) since it is through this class that you actually hit the methods that make calls to the database which you are now facilitating through LINQ and the TBH.dbml class.
If I have misunderstood you are was not completely clear on something please send me a personal message and I will help to resolve your problem.
Thanks and I hope you are enjoying the Blox thus far!
-Doug
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========
|

April 26th, 2008, 04:47 PM
|
Authorized User
|
|
Join Date: Mar 2008
Posts: 62
Thanks: 1
Thanked 3 Times in 3 Posts
|
|
Hello,
I'm trying to test various query options to retrieve the data for the GetArticleByID (int ArticleID) method, unfortunately unsuccessfully.
Working/Blox example:
TBHDataContext context = new TBHDataContext();
IQueryable<tbh_Article> art = from a in context.tbh_Articles
where a.ArticleID == articleID
select a;
article = GetArticleFromArticleDetails(art.ToList()[0]);
BaseArticle.CacheData(key, article);
---------------------------------------------
Unsuccessful, using direct LINQ query. When trying to access ShowArticle.aspx, I get an error of
"Exception Details: System.ApplicationException: No article was found for the specified ID.":
TBHDataContext context = new TBHDataContext();
tbh_Article art = (from a in context.tbh_Articles
where a.ArticleID == articleID
select a).First();
BaseArticle.CacheData(key, article);
---------------------------------------------
I also tried to use the SPROC after adding tbh_Articles_GetArticleByID to the TBH.dbml with the same error as above:
TBHDataContext context = new TBHDataContext();
List<tbh_Article> recordset = context.tbh_Articles_GetArticleByID(articleID).ToL ist();
BaseArticle.CacheData(key, article);
As always any ideas are appreciated,
Ronnie
BTW: Doug, thanks for all the help and I'm really enjoying the Blox!
|
|
 |