 |
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 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
|
|
|
|
|

December 17th, 2013, 04:56 PM
|
|
Registered User
|
|
Join Date: Dec 2013
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|
|

December 17th, 2013, 05:05 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
|

December 18th, 2013, 09:03 AM
|
|
Registered User
|
|
Join Date: Dec 2013
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|
|

December 18th, 2013, 09:23 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
|

December 18th, 2013, 10:51 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
|

December 18th, 2013, 11:06 AM
|
|
Registered User
|
|
Join Date: Dec 2013
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.

|
|

December 18th, 2013, 11:41 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Excellent; glad it's working.
Cheers,
Imar
|
|
 |
|