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: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9
This is the forum to discuss the Wrox book Professional ASP.NET 3.5: In C# and VB by Bill Evjen, Scott Hanselman, Devin Rader; ISBN: 9780470187579
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9 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 Display Modes
  #1 (permalink)  
Old August 11th, 2011, 09:06 AM
Authorized User
Points: 297, Level: 5
Points: 297, Level: 5 Points: 297, Level: 5 Points: 297, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2009
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 13 Can't see PlanetWroxDataContext

Hello All,

From the following code the all.aspx file can't locate the code in the PlanetWrox designer.cs file in the app_code folder.

The all.aspx file is located in the reviews folder.

the is the code behind of the all.aspx folder

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class All : BasePage
{
protected void Page_Load(object sender, EventArgs e)
{
using (PlanetWroxDataContext myDataContext = new PlanetWroxDataContext())
{
var allReviews = from review in myDataContext.Reviews
where Reviews.Authorized == true
orderby review.CreateDateTime descending
select review;

GridView1.DataSource = allReviews;
GridView1.DataBind();
}
}
}




This is the designer.cs file

pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.5446
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace tomemail.App_Code
{
using System.Data.Linq;
using System.Data.Linq.Mapping;
using System.Data;
using System.Collections.Generic;
using System.Reflection;
using System.Linq;
using System.Linq.Expressions;
using System.ComponentModel;
using System;


[System.Data.Linq.Mapping.DatabaseAttribute(Name="P lanetWrox")]
public partial class PlanetWroxDataContext : System.Data.Linq.DataContext
{

private static System.Data.Linq.Mapping.MappingSource mappingSource = new AttributeMappingSource();

#region Extensibility Method Definitions
partial void OnCreated();
partial void Insertreview(review instance);
partial void Updatereview(review instance);
partial void Deletereview(review instance);
partial void Insertgenre(genre instance);
partial void Updategenre(genre instance);
partial void Deletegenre(genre instance);
#endregion

public PlanetWroxDataContext() :
base(global::System.Configuration.ConfigurationMan ager.ConnectionStrings["PlanetWroxConnectionString1"].ConnectionString, mappingSource)
{
OnCreated();
}

public PlanetWroxDataContext(string connection) :
base(connection, mappingSource)
{
OnCreated();
}

public PlanetWroxDataContext(System.Data.IDbConnection connection) :
base(connection, mappingSource)
{
OnCreated();
}

public PlanetWroxDataContext(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
base(connection, mappingSource)
{
OnCreated();
}

public PlanetWroxDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
base(connection, mappingSource)
{
OnCreated();
}

public System.Data.Linq.Table<review> reviews
{
get
{
return this.GetTable<review>();
}
}

public System.Data.Linq.Table<genre> genres
{
get
{
return this.GetTable<genre>();
}
}
}

[Table(Name="dbo.review")]
public partial class review : INotifyPropertyChanging, INotifyPropertyChanged
{

private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);

private int _id;

private string _title;

private string _summary;

private string _body;

private int _genreid;

private bool _authorized;

private System.DateTime _createdatetime;

private System.DateTime _updatedatetime;

private EntityRef<genre> _genre;

#region Extensibility Method Definitions
partial void OnLoaded();
partial void OnValidate(System.Data.Linq.ChangeAction action);
partial void OnCreated();
partial void OnidChanging(int value);
partial void OnidChanged();
partial void OntitleChanging(string value);
partial void OntitleChanged();
partial void OnsummaryChanging(string value);
partial void OnsummaryChanged();
partial void OnbodyChanging(string value);
partial void OnbodyChanged();
partial void OngenreidChanging(int value);
partial void OngenreidChanged();
partial void OnauthorizedChanging(bool value);
partial void OnauthorizedChanged();
partial void OncreatedatetimeChanging(System.DateTime value);
partial void OncreatedatetimeChanged();
partial void OnupdatedatetimeChanging(System.DateTime value);
partial void OnupdatedatetimeChanged();
#endregion

public review()
{
this._genre = default(EntityRef<genre>);
OnCreated();
}

[Column(Storage="_id", DbType="Int NOT NULL", IsPrimaryKey=true)]
public int id
{
get
{
return this._id;
}
set
{
if ((this._id != value))
{
this.OnidChanging(value);
this.SendPropertyChanging();
this._id = value;
this.SendPropertyChanged("id");
this.OnidChanged();
}
}
}

[Column(Storage="_title", DbType="NVarChar(200) NOT NULL", CanBeNull=false)]
public string title
{
get
{
return this._title;
}
set
{
if ((this._title != value))
{
this.OntitleChanging(value);
this.SendPropertyChanging();
this._title = value;
this.SendPropertyChanged("title");
this.OntitleChanged();
}
}
}

[Column(Storage="_summary", DbType="NVarChar(MAX) NOT NULL", CanBeNull=false)]
public string summary
{
get
{
return this._summary;
}
set
{
if ((this._summary != value))
{
this.OnsummaryChanging(value);
this.SendPropertyChanging();
this._summary = value;
this.SendPropertyChanged("summary");
this.OnsummaryChanged();
}
}
}

[Column(Storage="_body", DbType="NVarChar(MAX)")]
public string body
{
get
{
return this._body;
}
set
{
if ((this._body != value))
{
this.OnbodyChanging(value);
this.SendPropertyChanging();
this._body = value;
this.SendPropertyChanged("body");
this.OnbodyChanged();
}
}
}

[Column(Storage="_genreid", DbType="Int NOT NULL")]
public int genreid
{
get
{
return this._genreid;
}
set
{
if ((this._genreid != value))
{
if (this._genre.HasLoadedOrAssignedValue)
{
throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValu eException();
}
this.OngenreidChanging(value);
this.SendPropertyChanging();
this._genreid = value;
this.SendPropertyChanged("genreid");
this.OngenreidChanged();
}
}
}

[Column(Storage="_authorized", DbType="Bit NOT NULL")]
public bool authorized
{
get
{
return this._authorized;
}
set
{
if ((this._authorized != value))
{
this.OnauthorizedChanging(value);
this.SendPropertyChanging();
this._authorized = value;
this.SendPropertyChanged("authorized");
this.OnauthorizedChanged();
}
}
}

[Column(Storage="_createdatetime", DbType="DateTime NOT NULL")]
public System.DateTime createdatetime
{
get
{
return this._createdatetime;
}
set
{
if ((this._createdatetime != value))
{
this.OncreatedatetimeChanging(value);
this.SendPropertyChanging();
this._createdatetime = value;
this.SendPropertyChanged("createdatetime");
this.OncreatedatetimeChanged();
}
}
}

[Column(Storage="_updatedatetime", DbType="DateTime NOT NULL")]
public System.DateTime updatedatetime
{
get
{
return this._updatedatetime;
}
set
{
if ((this._updatedatetime != value))
{
this.OnupdatedatetimeChanging(value);
this.SendPropertyChanging();
this._updatedatetime = value;
this.SendPropertyChanged("updatedatetime");
this.OnupdatedatetimeChanged();
}
}
}

[Association(Name="genre_review", Storage="_genre", ThisKey="genreid", OtherKey="id", IsForeignKey=true)]
public genre genre
{
get
{
return this._genre.Entity;
}
set
{
genre previousValue = this._genre.Entity;
if (((previousValue != value)
|| (this._genre.HasLoadedOrAssignedValue == false)))
{
this.SendPropertyChanging();
if ((previousValue != null))
{
this._genre.Entity = null;
previousValue.reviews.Remove(this);
}
this._genre.Entity = value;
if ((value != null))
{
value.reviews.Add(this);
this._genreid = value.id;
}
else
{
this._genreid = default(int);
}
this.SendPropertyChanged("genre");
}
}
}

public event PropertyChangingEventHandler PropertyChanging;

public event PropertyChangedEventHandler PropertyChanged;

protected virtual void SendPropertyChanging()
{
if ((this.PropertyChanging != null))
{
this.PropertyChanging(this, emptyChangingEventArgs);
}
}

protected virtual void SendPropertyChanged(String propertyName)
{
if ((this.PropertyChanged != null))
{
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}

[Table(Name="dbo.genre")]
public partial class genre : INotifyPropertyChanging, INotifyPropertyChanged
{

private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);

private int _id;

private string _name;

private int _sortorder;

private EntitySet<review> _reviews;

#region Extensibility Method Definitions
partial void OnLoaded();
partial void OnValidate(System.Data.Linq.ChangeAction action);
partial void OnCreated();
partial void OnidChanging(int value);
partial void OnidChanged();
partial void OnnameChanging(string value);
partial void OnnameChanged();
partial void OnsortorderChanging(int value);
partial void OnsortorderChanged();
#endregion

public genre()
{
this._reviews = new EntitySet<review>(new Action<review>(this.attach_reviews), new Action<review>(this.detach_reviews));
OnCreated();
}

[Column(Storage="_id", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)]
public int id
{
get
{
return this._id;
}
set
{
if ((this._id != value))
{
this.OnidChanging(value);
this.SendPropertyChanging();
this._id = value;
this.SendPropertyChanged("id");
this.OnidChanged();
}
}
}

[Column(Storage="_name", DbType="NChar(200) NOT NULL", CanBeNull=false)]
public string name
{
get
{
return this._name;
}
set
{
if ((this._name != value))
{
this.OnnameChanging(value);
this.SendPropertyChanging();
this._name = value;
this.SendPropertyChanged("name");
this.OnnameChanged();
}
}
}

[Column(Storage="_sortorder", DbType="Int NOT NULL")]
public int sortorder
{
get
{
return this._sortorder;
}
set
{
if ((this._sortorder != value))
{
this.OnsortorderChanging(value);
this.SendPropertyChanging();
this._sortorder = value;
this.SendPropertyChanged("sortorder");
this.OnsortorderChanged();
}
}
}

[Association(Name="genre_review", Storage="_reviews", ThisKey="id", OtherKey="genreid")]
public EntitySet<review> reviews
{
get
{
return this._reviews;
}
set
{
this._reviews.Assign(value);
}
}

public event PropertyChangingEventHandler PropertyChanging;

public event PropertyChangedEventHandler PropertyChanged;

protected virtual void SendPropertyChanging()
{
if ((this.PropertyChanging != null))
{
this.PropertyChanging(this, emptyChangingEventArgs);
}
}

protected virtual void SendPropertyChanged(String propertyName)
{
if ((this.PropertyChanged != null))
{
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}

private void attach_reviews(review entity)
{
this.SendPropertyChanging();
entity.genre = this;
}

private void detach_reviews(review entity)
{
this.SendPropertyChanging();
entity.genre = null;
}
}
}
#pragma warning restore 1591



Thanks in advance.

Thomas
Reply With Quote
Reply


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
Chapter 13 Try It! MikersSU BOOK: Stephens' C# Programming with Visual Studio 2010 24-Hour Trainer 11 April 1st, 2012 05:14 AM
Chapter 13 thepianoguy BOOK: Professional iPhone and iPad Application Development 3 April 6th, 2011 09:42 AM
Chapter 13 rock1233 BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 3 October 6th, 2009 12:18 PM
Chapter 13 bwoll BOOK: Beginning Access 2003 VBA 1 June 7th, 2007 03:57 PM
Chapter 13 ElMorenito BOOK: Beginning ASP 3.0 0 January 14th, 2005 01:56 PM



All times are GMT -4. The time now is 05:14 AM.


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