AWG Blogs

Tuesday, August 24, 2010


I'm rediscovering LINQ, and came across this article - - by Scott Guthrie (probably not the first time I've read this article).

Ever wonder why arrows seem to point in the opposite direction in E-R diagrams? This paragraph explains it. It ties in well with O/RM, in that the mapped objects will be composed of their children. I always tended to look at it in the direction of the diamond head as more intuitive speaking of foreign keys and all.

The arrows between the four entity classes above represent associations/relationships between the different entities. These are typically modeled using primary-key/foreign-key relationships in the database. The direction of the arrows on the design-surface indicate whether the association is a one-to-one or one-to-many relationship. Strongly-typed properties will be added to the entity classes based on this. For example, the Category class above has a one-to-many relationship with the Product class. This means it will have a "Categories" property which is a collection of Product objects within that category. The Product class then has a "Category" property that points to a Category class instance that represents the Category to which the Product belongs.

No comments:

Post a Comment