Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4.5 > BOOK: Beginning ASP.NET 4.5 : in C# and VB
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 4.5 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4.5: in C# and VB by Imar Spaanjaars; ISBN: 978-1-118-31180-6
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4.5 : in C# and VB 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
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 13th, 2014, 03:53 PM
Registered User
Points: 12, Level: 1
Points: 12, Level: 1 Points: 12, Level: 1 Points: 12, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2014
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default Chapter 14: All.aspx not working

Error message: Compiler Error Message: CS1061: 'PlanetWroxEntities' does not contain a definition for 'Reviews' and no extension method 'Reviews' accepting a first argument of type 'PlanetWroxEntities' could be found (are you missing a using directive or an assembly reference?)

(The error is on the line beginning "var authorizedReviews = from ...")

I've been struggling with the EF model for a couple of weeks. I found the thread from last September, which seemed to be very similar to the problem I'm having, but after trying the suggestions there I'm still getting the error.

The code generation strategy for the edmx has two options: T4 and Legacy Object Context; I chose the latter based on another previous thread on this forum.

This is the first time I haven't been able to get something in this book to run, but thinking I might have a subtle bug somewhere, I deleted all of my code and put in the downloaded source for Chapter 13, so I should be starting from a clean base.

I've been looking forward to learning about EF and would appreciate any suggestions.

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using PlanetWroxModel;

public partial class Reviews_All : BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        using (PlanetWroxEntities myEntities = new PlanetWroxEntities())
        {
            var authorizedReviews = from review in myEntities.Reviews
                                    where review.Authorized == true 
                                    orderby review.CreateDateTime descending
                                    select review;
            GridView1.DataSource = authorizedReviews;
            GridView1.DataBind();
        }
    }
}
Reply With Quote
  #2 (permalink)  
Old June 13th, 2014, 07:05 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

Are you using Visual Studio 2013 instead of 2012 by any chance?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #3 (permalink)  
Old June 13th, 2014, 07:16 PM
Registered User
Points: 12, Level: 1
Points: 12, Level: 1 Points: 12, Level: 1 Points: 12, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2014
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Yes, 2013 Express.
Reply With Quote
  #4 (permalink)  
Old June 13th, 2014, 07:45 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

In that case, check out this thread: Your Book and VS Versions in particular the first option of my first reply that explains how to drop back to EF 5. Things have changed between VS 2012 and VS 2013 so the default behavior of the new VS doesn't match the description in the book anymore.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
The Following User Says Thank You to Imar For This Useful Post:
p2psd (June 13th, 2014)
  #5 (permalink)  
Old June 13th, 2014, 07:56 PM
Registered User
Points: 12, Level: 1
Points: 12, Level: 1 Points: 12, Level: 1 Points: 12, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2014
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thank you Imar - I appreciate the prompt reply. This is on my work computer, and I will study the thread you linked over the weekend so on Monday I should be able to get things going.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Chap 14&15 - Combining AllByGenre.aspx and All.aspx southside123 BOOK: Beginning ASP.NET 4.5 : in C# and VB 2 March 26th, 2014 02:40 PM
Chapter 14 - All.aspx error Dbug BOOK: Beginning ASP.NET 4.5 : in C# and VB 6 September 18th, 2013 09:13 AM
ch 14: AllByGenre.aspx.cs binaryspirit BOOK: Beginning ASP.NET 4 : in C# and VB 6 May 4th, 2012 09:08 AM
Imar: Chp 14 - ManagePhotoAlbum.aspx nanonerd BOOK: Beginning ASP.NET 4 : in C# and VB 1 October 13th, 2011 12:38 PM
CH 14 register.php not working dlhicksjr BOOK: Beginning PHP 5.3 2 July 31st, 2011 01:36 PM



All times are GMT -4. The time now is 10:36 PM.


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