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 > BOOK: Beginning ASP.NET 4 : in C# and VB
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : 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 December 23rd, 2012, 03:36 PM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation Chapter 14: Entity Model Code WILL NOT WORK!

Hi Imar, I hope you still check this forum out...

I picked up a copy of your book and I've been working through some of the exercises here and there. However, I am having a really hard time implementing the ADO Entity Object Model code in chapter 14.

I am using Visual Studio Web Developer Express 2012, and I have tried creating the project in ASP.NET 4 and 4.5 but to no avail. I can successfully connect to the database and create the entity model. However, I can't create a new object; the code keeps rejecting it saying I am missing a namespace.

I did quite a bit of Google-fu and found that I need to change the code generation strategy to Default (from none; your book doesn't mention to do this...) but now I am getting compiling errors saying that I am missing references in my web.config file.

I am ready to pull my hair out!

What the heck am I doing wrong?!

Thanks,
Drew
Reply With Quote
  #2 (permalink)  
Old December 23rd, 2012, 03:47 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

This book targets ASP.NET 4 and Visual Studio 2010 where the behavior was quite different and the generated code targets ObjectContext. In VS 2012 the code strategy is different indeed and generates code that targets DbContext. My book doesn't mention any of this as VS 2012 and it's new behavior didn't exist yet by the time it was published ;-)

What works for me is to delete the *.tt files that VS creates and then set the strategy to Default. This way, it ends up the same as in VS 2010. Fore more details; http://msdn.microsoft.com/en-us/data/jj556581

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:
kafshdoozak (January 2nd, 2013)
  #3 (permalink)  
Old December 23rd, 2012, 04:28 PM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Imar,

Just tried that; I am still getting two odd behaviors:

The first one I get is when I try to run the project:

Code:
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. 

Parser Error Message: Could not load type 'System.Data.Entity.Design.AspNet.EntityDesignerBuildProvider'.
Secondly, I am still not able to access the namespace in the application; I just cannot get that namespace to recognize!

Am I better off trying to do this in ASP.NET 4 and VS 2010 instead?

So frustrating!
Reply With Quote
  #4 (permalink)  
Old December 23rd, 2012, 04:48 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Make sure your web.config has references to System.Data.Entity like this:

Code:
 
<compilation debug="false" targetFramework="4.0">
  <assemblies>
    <add assembly="System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
    <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    <add assembly="System.Data.Entity.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
  </assemblies>
  <buildProviders>
    <add extension=".edmx" type="System.Data.Entity.Design.AspNet.EntityDesignerBuildProvider" />
  </buildProviders>
</compilation>
I just opened the full code for Chapter 13 in VS 2012. This code has the aforementioned references. I then added a model and then I can instantiate the context and other classes just fine.,

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
  #5 (permalink)  
Old February 28th, 2013, 07:32 AM
Authorized User
Points: 100, Level: 1
Points: 100, Level: 1 Points: 100, Level: 1 Points: 100, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2012
Posts: 26
Thanks: 0
Thanked 1 Time in 1 Post
Default

I am trying to use the information from this chapter on a different website that I am creating, and I have managed to get it working, however the All.aspx page is ignoring my master page.
Do you know why this may be?
Thanks

P.S. I'm using visual studio express 2012
Reply With Quote
  #6 (permalink)  
Old February 28th, 2013, 07:43 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

Is this related to the post you're answering to? If so, can you describe how? If not, please post new topics like this as a new thread here on P2P.

That said: you'll need to post the relevant code for that page and the master page so we can take a look...

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
  #7 (permalink)  
Old February 28th, 2013, 07:48 AM
Authorized User
Points: 100, Level: 1
Points: 100, Level: 1 Points: 100, Level: 1 Points: 100, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2012
Posts: 26
Thanks: 0
Thanked 1 Time in 1 Post
Default

I thought it was relevant, but I suppose that is is a little bit of a tangent.
I'll create a new post
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
entity data model problem and maximum exceeded errors Caden11998 ASP.NET 4 General Discussion 0 August 29th, 2012 11:55 AM
Trouble Creating Entity Framework Model floridaguy BOOK: Beginning ASP.NET 4 : in C# and VB 4 November 16th, 2011 02:56 PM
Chapter 14 - ADO.NET Entity Data Model Sean1980 BOOK: Beginning ASP.NET 4 : in C# and VB 3 July 15th, 2011 12:24 PM
Chapter 14 Linq and ado.net entity framework pandukal21 BOOK: Beginning ASP.NET 4 : in C# and VB 8 January 28th, 2011 05:19 AM
confusing in ADO.NET Entity Data Model,Linq to sql angelboy ADO.NET 5 November 21st, 2008 05:01 PM



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


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