ios - Parent Child Context Confusion & Concurrency issues -


am having few doubts parent child context set-up , how data behaves. can please suggest link can find proper explanation on how work.

few points & observation

  1. parent context acts store child context :- changes in parent not reflected in child.

question 1: if parent context acts store child context why changes in parent not reflected in child context, while child fetches them.

observations :

  1. insert in parent :- child fetch requests objects.
  2. update/delete object in parent :- fetch request not updated object instead provides object in child context, if need updated object have either reset context lose changes in child context or refresh object.

question 2: child overwrites parent context values. if user has modified in parent context , child has modified same thing updates of user lost. not problem until relationships involved.

say there 1 many relationship between entity a,b (a->>b).

parent context : inserts new child entity child-1.

child context : deletes both entity , child.

so when child saves parent context, deletes entity , old child, newly inserted child-1 remains in context null referencing parent.

how can resolve issue?

question 1 because have fetched data, if want force fetch said should either reset context or refresh object.

question 2 can try use cascade delete if want delete entities b when parent entity deleted.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -