Re: Core Data + Unidirectional Relationships
Re: Core Data + Unidirectional Relationships
- Subject: Re: Core Data + Unidirectional Relationships
- From: Alexander Spohr <email@hidden>
- Date: Wed, 12 Nov 2008 18:25:58 +0100
Am 12.11.2008 um 14:38 schrieb John Pannell:
The station has a to-many "ports" relationship with a cascade delete
rule, and the port has a to-one "station" relationship with a
cascade delete rule - these are inverses on one another. So now, if
I delete a station, all of its ports will also be deleted from the
object graph. Deleting a port, on the other hand, will remove it
from the ports relationship on the station, but leave the station
otherwise intact.
This can not be if „port has a to-one "station" relationship with a
cascade delete rule“. This should be nullify.
My trouble comes in relating the ports and the pipes. I'd like to
model the pipe by having a to-one "sourcePort" relationship (to
represent the port at the start of the tunnel - note: all of my
tunnels are one-way) and a to-one "targetPort" relationship to
represent the port at the end of the tunnel.
Sounds right if each pipe is unidirectional.
A port would have a to-many relationship with pipe as the target
entity. The difficulty comes in specifying an inverse... for the
port's "pipes" relationship, I'm forced to choose from either the
sourcePort or the targetPort as the inverse, and for the pipe's
sourcePort or targetPort relationships, setting either to port's
"pipes" breaks the inverse setting of the other.
Ports don’t have only one pipe-relationship. Each port has two:
sourcePipes and destinationPipes. This has to be as your ports have to
know if a pipe comes or goes.
atze
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden