Re: Core Data Questions--Relationships, UUIDs, and Dirty States
Re: Core Data Questions--Relationships, UUIDs, and Dirty States
- Subject: Re: Core Data Questions--Relationships, UUIDs, and Dirty States
- From: "I. Savant" <email@hidden>
- Date: Mon, 27 Oct 2008 16:55:35 -0400
> 1. Confirmation clarification: do I understand correctly, considering
> typical RDBMS data integrity rules, that for most to-one relationships, I
> would set the delete rule to "no action", since deletion of the "many" item
> should not effect the "one" item?
Impossible to generalize, but generally - :-) - you'd want "nullify"
and not "no action". This is because you've most likely taken
advantage of the "inverse relationships". This means that (using the
Department / Employee example), when you remove an Employee from the
Department's "employees" set, you also want to tell the employee that
its department is nil.
Doing nothing in this case will leave your object graph in an
inconsistent state. If you have a good reason for this, knock yourself
out, but if you can't name it, you probably don't have it.
> 2. How do I best implement custom UUIDs for relationships (as a property to
> an entity)? I thought I saw this come up some time ago but I can't seem to
> find the discussion.
I'm not sure I understand your question ... do you want a UUID to be
the name of a relationship or do you just want a property that is a
UUID? What is your goal? Are you looking to solve a cross-store
relationship problem?
> 3. How can I, in a bindings-compliant manner, report the "dirty" state of an
> NSManagedObjectContext? I know I can be notified when the context has
> changed, and when the context has saved, but what about when the context has
> been rolled back or changes undo-ed?
Isn't an undo just another change? It's setting properties and
relationships back to the way they were, but the key is the word
"setting".
> 4. Does anyone have recommendations on how I can maintain the "dirty" state
> of a single NSManagedObject? I don't figure there is anything built into CD
> for this.
In a document-based or non-document-based application?
--
I.S.
_______________________________________________
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