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
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 17th, 2013, 04:56 PM
Registered User
Points: 17, Level: 1
Points: 17, Level: 1 Points: 17, Level: 1 Points: 17, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2013
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation Problem with Try It Out in Chapter 17, Page 641

In step 2 of the Try It Out, it says to Open the ADO.NET Entity Data Model file PlanetWrox.edmx from the App_Code folder, right-click an empty space in the designer, and choose Update Model from Database. Wait until VWD has analyzed your database and click Finish.

When I did this step an Update Wizard window appears on the screen. I click on the Finish button in this window. After that, I received an error stating "Error 1109: Property 'PhotoAlbumId' is not mapped." Also, the following occurred:

* In the PhotoAlbum block, an extra navigation property called Pictures_1 appeared.
* In the Picture block, an extra field called PhotoAlbumID (I already had a field in that table called PhotoAlbumId) appeared as well as an extra navigation property called PhotoAlbum_1.

This is affecting my ability to complete this exercise. Any assistance will be greatly appreciated. Thank you.
Reply With Quote
  #2 (permalink)  
Old December 17th, 2013, 05:05 PM
Imar's Avatar
Wrox Author
Points: 72,035, Level: 100
Points: 72,035, Level: 100 Points: 72,035, Level: 100 Points: 72,035, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,079
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

Can you check your database and make sure that:

1. Each table has a column called Id, which is set as the primary key and an identity.
2. You correctly created a relationship between PhotoAlbum.Id and Picture.PhotoAlbumId and between Genre.Id and Review.GenreId.

It sounds like something is wrong with your database schema but it's hard to tell what.

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
  #3 (permalink)  
Old December 18th, 2013, 09:03 AM
Registered User
Points: 17, Level: 1
Points: 17, Level: 1 Points: 17, Level: 1 Points: 17, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2013
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Confirmed on both counts.

I have an Id field in all tables.

I have a one-to-many relationship on the Genre and Review tables with Genre.Id being the "one" and Review.GenreId being the "many".

Also, I have a one-to-many relationship on the PhotoAlbum and Picture tables with PhotoAlbum.Id being the "one" and Picture.PhotoAlbumId being the "many".

When I perform Step 2 it adds an navigation property to the PhotoAlbum (called "Picture") and Picture (called "PhotoAlbum_1") tables, I get a duplicate association and I get "Error 11009: Property 'PhotoAlbumId' is not mapped".

When I undo the operation, the duplicate navigation properties and the duplicate association go away, but the error message stays on.
Reply With Quote
  #4 (permalink)  
Old December 18th, 2013, 09:23 AM
Imar's Avatar
Wrox Author
Points: 72,035, Level: 100
Points: 72,035, Level: 100 Points: 72,035, Level: 100 Points: 72,035, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,079
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Can you send me a zipped version of the site (and database) by e-mail? Then I'll see if I can figure out what's wrong. You can find my e-mail address in the Introduction section of the book.

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 December 18th, 2013, 10:51 AM
Imar's Avatar
Wrox Author
Points: 72,035, Level: 100
Points: 72,035, Level: 100 Points: 72,035, Level: 100 Points: 72,035, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,079
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Files received, thank you.

Did you maybe rename the PhotoAlbumId to PhotoAlbumID column in the Pictue table or vice versa? It looks the Picture class has two properties with almost the same name except for the capitalization.

What if you remove all entities from the diagram, save it, and then add them again?

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
  #6 (permalink)  
Old December 18th, 2013, 11:06 AM
Registered User
Points: 17, Level: 1
Points: 17, Level: 1 Points: 17, Level: 1 Points: 17, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2013
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I got the diagram to work again.

I removed all of the tables and did "Update Model from Database" and re-inserted the tables and associations that way.

Thank you for your assistance.

Reply With Quote
  #7 (permalink)  
Old December 18th, 2013, 11:41 AM
Imar's Avatar
Wrox Author
Points: 72,035, Level: 100
Points: 72,035, Level: 100 Points: 72,035, Level: 100 Points: 72,035, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,079
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Excellent; glad it's working.

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
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
Chapter 17 custom error page problem.. dany96 BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 3 August 19th, 2011 10:17 AM
Chapter 17 Page 609: $safeitemname$ issue? AlexGrab BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 December 31st, 2010 06:06 AM
Chapter 19 - page 641 Struct RegisrtationInformation bon_chan BOOK: Beginning Microsoft Visual C# 2008 ISBN: 978-0-470-19135-4 1 July 29th, 2010 03:49 PM
Chapter 17 Page 608 Try It out - Debugging your application ceboc BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 November 24th, 2009 12:46 PM
DataGrid Updates BLANK PAGE (Chapter 17) happyhorseygal BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 1 April 8th, 2004 01:11 PM



All times are GMT -4. The time now is 01:15 PM.


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