O'Reilly logo

Programming Reactive Extensions and LINQ by Paul Betts, Jesse Liberty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using LINQ to SQL to Work with Relationships

Objects are typically not isolated entities; they exist in relationship to other objects. The three principle relationships in object oriented programming are is-a, has-a, and relates-to. The first is modeled through inheritance, the second through composition, and the third through method calls.

Not surprisingly, the heart of relational databases is relations; in this case, modeled by foreign key relationships.

Mapping from object relationships to relational database relationships is the main objective of LINQ to SQL.

We can model the relationship between the Customer class and the Order class more explicitly by the use of attributes in both classes. For example, we can mark up the Customer class ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required