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();
}
}
}