Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4.5 > BOOK: Professional ASP.NET 4.5 : in C# and VB
|
BOOK: Professional ASP.NET 4.5 : in C# and VB
This is the forum to discuss the Wrox book Professional ASP.NET 4.5 in C# and VB by Jason N. Gaylord, Christian Wenz, Pranav Rastogi, Todd Miranda, Scott Hanselman; ISBN: 978-1-1183-1182-0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET 4.5 : in C# and VB 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 September 24th, 2014, 08:43 AM
Registered User
 
Join Date: Sep 2014
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default Chpt 12 Can't get past registering the context in global.asax

I am totally new to asp.net

I am running Visual Studio Express 2013.

I am using Visual Basic over C#

I created a new Dynamic Data Website.

I added an existing database (NORTHWND) by right clicking on App_Data and adding an existing item, then following the wizard.

I added new LINQ to SQL Class and followed the wizard, then dragged the tables from NORTHWND after double clicking on it.

I amended global.asax by uncommenting the line and changing the values to:

Code:
      ' The following registration should be used if YourDataContextType does not derive from DbContext
DefaultModel.RegisterContext(GetType(DataClassesDataContext), New ContextConfiguration() With {.ScaffoldAllTables = True})
When opening Default.aspx in a browser I can see the page with all the tables. Success!

When I click on a table, there is an error:

Unable to cast object of type 'DataClassesDataContext' to type 'System.Data.Objects.ObjectContext'.

Help.

When trying to follow the instructions in the book and working through the Entity Data Model, I don't even get the first page with the tables listed on it.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Ch 23 Page 488 Data Context in Global.asax? ken evans BOOK: Professional Visual Studio 2010 5 December 7th, 2010 01:50 PM
How to declare the global variable in global.asax? calyn_gately ASP.NET 3.5 Basics 0 August 6th, 2008 08:06 PM
Context.clearerror() gives an error in Global.asax madhusrp ASP.NET 2.0 Basics 6 April 12th, 2007 02:12 AM
what is global.asax? gaurav_jain2403 General .NET 1 February 3rd, 2006 02:40 PM





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