Wrox Programmer Forums
| 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 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 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..
 
Old September 27th, 2010, 02:26 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 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!
 
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?
 
Old September 27th, 2010, 04:51 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 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!
 
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
 
Old September 27th, 2010, 06:00 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 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!
The Following User Says Thank You to Imar For This Useful Post:
stram (September 27th, 2010)
 
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




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





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