I've watched all the screencasts (magic!) and am now reading some of the code to better understand how things have been done.
Is there are reason for sometimes holding a reference to an object and other times holding the ID of the object? For example, in the OrderItem class there is a public property called Product which is of type Product but in the ProductReview class there
is a public property called ProductID which is of type int. The Category class has a LazyList<Product> but ProductImage has a ProductID. Why is it so?
I was just going over this today in my head - it seems so silly to do it :). The issue comes down to the need of using the ID in the repositories - I've needed it many times. Such as checking if a Product exists and adding items to a basket. I know it's not
OO, but it works and it's not intrusive so I'm just keeping it.
Paul Linton
Star
13403 Points
2531 Posts
Reasoning behind model design
Oct 09, 2008 01:12 AM|LINK
I've watched all the screencasts (magic!) and am now reading some of the code to better understand how things have been done.
Is there are reason for sometimes holding a reference to an object and other times holding the ID of the object? For example, in the OrderItem class there is a public property called Product which is of type Product but in the ProductReview class there is a public property called ProductID which is of type int. The Category class has a LazyList<Product> but ProductImage has a ProductID. Why is it so?
Any explanations (or even guesses) appreciated.
robconery
Participant
852 Points
195 Posts
Re: Reasoning behind model design
Oct 17, 2008 12:16 AM|LINK