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 | 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 September 26th, 2010, 03:17 PM
Authorized User
 
Join Date: Sep 2010
Posts: 12
Thanks: 2
Thanked 0 Times in 0 Posts
Default question for ADO.NET chapter 14

hello all. i have a question that is confusing me. On page 482 the book writes that the tables(Genre and review) on figure 14.2 named classes...But on How it works on page 484 on second paragraph i read "objects". does it referring to the previous thing?(classes) ? does it the same as oo programming where we have objects that created by classes?

also i want to know where is used the navigation properties below the classes.

thanks

Last edited by stram; September 26th, 2010 at 03:48 PM..
Reply With Quote
  #2 (permalink)  
Old September 27th, 2010, 02:26 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Quote:
does it the same as oo programming where we have objects that created by classes?
Yes, it's the same. Based on the database, Visual Studio generates classes for you. The LINQ to SQL run time then creates objects based on these class definitions.

Quote:
also i want to know where is used the navigation properties below the classes.
This makes no sense to me, so I am afraid I can't answer it.

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 September 27th, 2010, 04:34 AM
Authorized User
 
Join Date: Sep 2010
Posts: 12
Thanks: 2
Thanked 0 Times in 0 Posts
Default

hello Imar. thanks for the first answer.

for the second question:

i can't understand what is navigation properties? for example genre has navigation properties Reviews. did it created when I create the relationship between two tables?
Reply With Quote
  #4 (permalink)  
Old September 27th, 2010, 04:51 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi stram,

It doesn't do that when you create the relationship in the database, but when you create the model in Visual Studio. When you create the model, Visual Studio analyses your database and detects the relationship. It then creates a Navigation property in both classes; one a single instance, the other a collection (so you can navigate from a genre to its reviews - myGenre.Reviews - and back - myReview.Genre).

Hope this helps,

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 September 27th, 2010, 05:28 AM
Authorized User
 
Join Date: Sep 2010
Posts: 12
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Imar View Post
(so you can navigate from a genre to its reviews - myGenre.Reviews - and back - myReview.Genre).
can you give me an example where it used? or an example in the book?
thanks
Reply With Quote
  #6 (permalink)  
Old September 27th, 2010, 06:00 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

One place where it's used is in the Code Behind of AllByGenre.aspx:

Code:
     Dim allGenres = From genre In myEntities.Genres
                      Order By genre.Name
                      Select New With {genre.Name, genre.Reviews}
Code:
 
      var allGenres = from genre in myEntities.Genres
                      orderby genre.Name
                      select new { genre.Name, genre.Reviews };
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:
stram (September 27th, 2010)
  #7 (permalink)  
Old September 27th, 2010, 06:44 AM
Authorized User
 
Join Date: Sep 2010
Posts: 12
Thanks: 2
Thanked 0 Times in 0 Posts
Default

ok Imar I understand it.

thanks
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 15 FooReader.Net Question maxint40 BOOK: Professional Ajax 2nd Edition ISBN: 978-0-470-10949-6 5 April 13th, 2007 09:14 AM
Listing 4-14 Question rsendek BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 1 March 6th, 2006 02:31 PM
Ado.net performance question (SQL server vs OleDB spamp ADO.NET 1 August 2nd, 2004 10:37 AM
Question of calling Oracle'Procedure by ADO.Net sechmet Classic ASP Databases 0 December 3rd, 2003 05:41 AM



All times are GMT -4. The time now is 04:57 AM.


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