p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Professional ASP.NET MVC 2 (http://p2p.wrox.com/forumdisplay.php?f=588)
-   -   Errata on page 30 regarding DinnerRepository (http://p2p.wrox.com/showthread.php?t=82103)

Rushino January 2nd, 2011 10:03 PM

Errata on page 30 regarding DinnerRepository
 
Hello,

As i was writting code from page 30. Visual Studio give me an error on the bolded line in :

public void Delete(Dinner dinner) {
foreach (var rsvp in dinner.RSVPs) {
entities.RSVPs.DeleteObject(dinner.RSVPs);
}
entities.Dinners.DeleteObject(dinner);
}

i believe this should be entities.RSVPs.DeleteObject(rsvp); instead of
entities.RSVPs.DeleteObject(dinner.RSVPs);

Thanks.

Rushino January 2nd, 2011 10:47 PM

What the hell. I sent an email to Wrox regarding this errata and got answered this :

Thank you for contacting Wiley Technical Support. Information about the code on page 30 can be found at:

http://www.wiley.com/WileyCDA/WileyT...Cd-ERRATA.html

code snippet 1-3.txt
This code snippet is designed to illustrate the associated concepts and is not designed to be complied. There are no errors in it but it will not run.


Please let us know if you have any more questions.


There IS an error in this code... how this fellowing code is supposed to be logical and free of any errors ?

public void Delete(Dinner dinner) {
foreach (var rsvp in dinner.RSVPs) {
entities.RSVPs.DeleteObject(dinner.RSVPs);
}
entities.Dinners.DeleteObject(dinner);
}

You actually tell to delete the collection of RSVPs while looping through it.. furthermore.. deleteObject accept only an rsvp entity so it should be a single rsvp.

The logical way should be delete all RSVPs associated by the dinner and delete the dinner.

Anyone could reply telling that i am correct ?

Thanks.

flyinhawaiian January 3rd, 2011 11:22 AM

You are correct. Don't expect a whole lot of response from the publishers. I've handed them dozens of errata and have never got any response. They don't appear to be monitoring the forums either.

Rushino January 3rd, 2011 11:33 AM

This is sad, ive expected some support from them look like i was wrong. Thanks for the info.

ebmudder January 4th, 2011 11:46 AM

Thanks Rushino
 
Quote:

Originally Posted by Rushino (Post 267161)
This is sad, ive expected some support from them look like i was wrong. Thanks for the info.

Thanks for posting the solution, Rushino...I'm just a newbie working through the book, and the intellisense error in VS2010 was pushing me down the wrong path.

I thought this error had something to do with autogenerated namespaces creating conflicting entities...you saved me a lot of time!

Rushino January 4th, 2011 05:21 PM

Bah no problems dude. I am glad it helped you. Through, i am a bit frustrated to discover that many have trouble with this book also on amazon.com there lots of poeple saying they having trouble and all. Lots of errata and no support. This is really disappointing. So i decided to return the book to amazon.

ebmudder January 4th, 2011 05:30 PM

Quote:

Originally Posted by Rushino (Post 267195)
Bah no problems dude. I am glad it helped you. Through, i am a bit frustrated to discover that many have trouble with this book also on amazon.com there lots of poeple saying they having trouble and all. Lots of errata and no support. This is really disappointing. So i decided to return the book to amazon.

Sorry to hear that...I like the format of the book and want to work through it, so I hope I don't get hung up on too many typos :(

I already gave up on "Test-Drive ASP.NET MVC" because it was more out of date than this book. If we all went on ScottGu's blog and complained about the lack of support here, I'm sure he'd be proactive about it.

Rushino January 4th, 2011 06:19 PM

Quote:

Originally Posted by ebmudder (Post 267196)
Sorry to hear that...I like the format of the book and want to work through it, so I hope I don't get hung up on too many typos :(

I already gave up on "Test-Drive ASP.NET MVC" because it was more out of date than this book. If we all went on ScottGu's blog and complained about the lack of support here, I'm sure he'd be proactive about it.

Bah don't worry. It was a personnal choice. I know ScottGu is a guru in ASP.NET MVC and i wish i could keep the book but i really hate to hurt a wall in a book. Since he is a guru and well known dude in the domain this is quite a surprise to see a book with so many typos coming from him. I just didnt expected that.. furthermore... he rated 5 star some other book that i won't name here but this one seem to be liked by many so i will give it a try.

Thanks.

Olin January 24th, 2011 05:09 PM

Errata updated (finally)
 
In the past few weeks there have been a lot of additions to the Errata page, including this issue:

30 Error in Code
Code Snippet 1-3 in the DinnerRepository class, the Delete(Dinner dinner) method:

Code:

foreach(var rsvp in dinner.RSVPs){
entities.RSVPs.DeleteObject(dinner.RSVPs)
}

This does not work, and throws a compliation error. The error is also repeated in the Code Snippet1-3.txt download. The correct code should be:

Code:

foreach(RSVP rsvp in dinner.RSVPs.ToList()){
entities.RSVPs.DeleteObject(rsvp)
}


Rushino January 24th, 2011 05:46 PM

I gave up on this book a while ago lol


All times are GMT -4. The time now is 07:21 PM.

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