i drug a line between two tables in the Linq Object Relational (O/R) mapper:
Order Customer
-------------- ---------------
| OrderID | | CustomerID |
| CustomerID |♦---------˃| ... |
| | | |
-------------- ---------------
Note: Or perhaps it was
Order Customer
-------------- ---------------
| OrderID | | CustomerID |
| CustomerID |˂---------♦| ... |
| ... | | |
-------------- ---------------
i'm not sure; it lets me drag both ways.
- First question, what's the arrowhead, and what's the diamond?
Assuming the second diagram, the cardinality of the Association
was created as OneToMany
. This makes sense, since:
- one customer
- has many orders
But what confuses me is the Association.Unique
(Boolean) property. It defaults to false
. This makes sense because it's a OneToMany association. Order.CustomerID
cannot be unique, otherwise it wouldn't be a OneToMany association, it would be OneToOne.
But then i'm allowed to change the OneToMany Unique property to true. This makes no sense, so i conclude that Unique
ness doesn't apply to Order.CustomerID
, but instead to Customer.CustomerID
. But the diagram already indicates Customer.CustomerID
is a Primary Key. Of course it's unique, it's a primary key.
But the Unique
property isn't set. This makes no sense, so i conclude that Unique
ness doesn't mean either table.
Second question, what does
Unique
mean?Specifies whether the foreign target columns have a uniqueness constraint
Third question: What is parent and child?
Assuming, again, the second diagram:
Customers.CustomerID ♦------------> Orders.CustomerID
i take Customers
table to be a parent. It's the one who owns what it means to be a customer. You want to change something about a customer, you walk to the parent.
Meanwhile, the child Orders
table comes along and wants to reference a Customer
.
Parent(diamond) Child(arrowhead)
==================== =================
Customers.CustomerID (PK) ♦------------> Orders.CustomerID (FK)
Except that when i look at the association's Parent and Child properties:
Child property
Name
:Orders
Parent property
Name
:Customer
They want to create a property on the "child" called Orders
. No, no, no. The child is orders. And they want to add a property to the parent called Customer
. No, no no. The parent is a customer.
That means i must have it backwards, and the terms parent and child are the exact opposite of what i thought:
Child(diamond) Parent(arrowhead)
==================== =================
Customers.CustomerID (PK) ♦------------> Orders.CustomerID (FK)
And by this time i want to blow my brains out; and instead spend 35 minutes authoring a question on Stackoverflow; rather than continuing to scream at my computer.
Help.