Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #21 (permalink)  
Old March 25th, 2008, 10:50 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

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
================================================== =========
  #22 (permalink)  
Old March 28th, 2008, 11:22 AM
Registered User
 
Join Date: May 2007
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.
  #23 (permalink)  
Old March 28th, 2008, 11:33 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

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
================================================== =========
  #24 (permalink)  
Old April 2nd, 2008, 08:16 PM
Authorized User
 
Join Date: Mar 2008
Location: New York, NY, USA.
Posts: 62
Thanks: 1
Thanked 3 Times in 3 Posts
Send a message via Yahoo to kalel_4444
Default

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


  #25 (permalink)  
Old April 3rd, 2008, 07:48 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

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
================================================== =========
  #26 (permalink)  
Old April 7th, 2008, 11:31 AM
Lee Dumond's Avatar
Wrox Author
Points: 4,942, Level: 29
Points: 4,942, Level: 29 Points: 4,942, Level: 29 Points: 4,942, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2008
Location: Decatur, IL, USA.
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

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.
  #27 (permalink)  
Old April 21st, 2008, 05:01 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Creetown, UK
Posts: 488
Thanks: 2
Thanked 10 Times in 9 Posts
Default

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
  #28 (permalink)  
Old April 23rd, 2008, 05:25 PM
Authorized User
 
Join Date: Mar 2008
Location: New York, NY, USA.
Posts: 62
Thanks: 1
Thanked 3 Times in 3 Posts
Send a message via Yahoo to kalel_4444
Default

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

  #29 (permalink)  
Old April 23rd, 2008, 05:56 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

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
================================================== =========
  #30 (permalink)  
Old April 26th, 2008, 04:47 PM
Authorized User
 
Join Date: Mar 2008
Location: New York, NY, USA.
Posts: 62
Thanks: 1
Thanked 3 Times in 3 Posts
Send a message via Yahoo to kalel_4444
Default

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!

 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
LINQ to SQL in TheBeerHouse zhoux BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 October 1st, 2008 07:37 AM
Technical Editor: LINQ and TheBeerHouse Wrox Blox jminatel BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 5 August 30th, 2008 12:11 AM
LINQ to SQL example for TBH - Wrox Blox Errata dparsons BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 April 26th, 2008 09:25 AM
LINQ in ASP.NET 3.5 Project Wrox Blox available jminatel ASP.NET 2.0 Professional 0 October 8th, 2007 09:29 PM
LINQ in ASP.NET 3.5 Project Wrox Blox available jminatel ASP.NET 3.5 Professionals 0 October 8th, 2007 09:26 PM



All times are GMT -4. The time now is 09:30 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.