Wrox Programmer Forums
BOOK: Professional ASP.NET MVC 2
This is the forum to discuss the Wrox book Professional ASP.NET MVC 2 by Jon Galloway, Scott Hanselman, Phil Haack, Scott Guthrie, Rob Conery; ISBN: Professional ASP.NET MVC 2
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET MVC 2 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 October 9th, 2010, 03:22 PM
Authorized User
Join Date: Sep 2010
Posts: 13
Thanks: 1
Thanked 1 Time in 1 Post
Default Where are my RSVPs?

When getting to page 120 where I should be able to see whether or not I have RSVP'ed to an event, it doesn't work.

Debugging I can see that I have all my Dinners returned from the database to my ObjectQuery. I can also see that I have all my RSVP's in another ObjectQuery. But when looking at the RSVPs in the Dinners ObjectQuery there are none! It is as if they are not connected correctly.

I can add a RSVP to the database through the tutorial, so something is working...

Anyone who has the same problem? And maybe solved it?
Old October 10th, 2010, 01:15 PM
Authorized User
Join Date: Sep 2010
Posts: 13
Thanks: 1
Thanked 1 Time in 1 Post
Default VS 2008 or VS 2010

Now it works... here is what I did:

Originally I did the tutorial in Visual Studio 2008.

Now I have installed Visual Studio 2010 and converted the project.
Then I changed the framework to version 4.0, removed the NerdDinner.edmx file, removed the NerdDinnerEntities connectionstring from the web.config file.

Then I added the NerdDinner.edmx file again (now with the posibilites of pluralizing and including foreign key as columns).

And voila - it works!

But if anyone can come up with a solution on how you can make it work in VS 2008, I am sure that other users would be happy
Old October 28th, 2010, 06:27 AM
Registered User
Join Date: Sep 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts

I'm also getting the exact error you describe and I'm using VS 2008 and .Net 3.5.

I really don't want to upgrade to 4.0 just yet!

I bought this book because it clearly stated in the Introduction on page "xxix" that "You can also use Visual Studio 2008" and then it goes onto say, "You will also need to make sure that you have the .NET Framework 3.5 installed at a minimum".

Yet again Chapter One in this book fails to deliver. Wrox really do need to give us a free e-copy of this book with all the issues fixed!

I think that Mickey Mouse & Donald Duck must have done the proof reading/testing on this book! :)
Old January 19th, 2011, 12:17 PM
Registered User
Join Date: Jan 2011
Posts: 9
Thanks: 2
Thanked 0 Times in 0 Posts
Cool Fix to view RSVPs

Folks, the reason you are unable to retrieve the RSVPs is a known limitation/feature of Entity Framework 1.0. By design, EF 1.0 does not do implicit lazy loading by default. You have to call the Load() method.

Here's how you get it to work:

        public bool IsUserRegistered(string userName)
 bool isRegistered = RSVPs.Any(r => r.AttendeeName.Equals(userName, StringComparison.OrdinalIgnoreCase));

            return isRegistered;
Like you, I am not currently able to upgrade to Visual Studio 10 & EF 4.0, but this should do the trick for you. I had to bust out my Entity Framework book to find this.

For more info:
see O'Reilly's "Programming Entity Framework" by Julia Lowry, 1st ed, page 469.
Or Google "Entity framework lazy loading versus deferred loading"

Last edited by Olin; January 19th, 2011 at 12:29 PM.. Reason: Corrected Entity Framework version number.

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