EOEditingContext - multiple contexts
EOEditingContext - multiple contexts
- Subject: EOEditingContext - multiple contexts
- From: David Griffith <email@hidden>
- Date: Fri, 26 Mar 2004 20:26:40 +0100
HI all,
This is a little tricky to explain, and I need a little further detail on
how editing contexts work if anyone can help.
I have a shopping cart:
ShoppingCart <-->> CartItems
This is generally available throughout the application and I have left it in
the default ec.
I also have:
CustomerOrder <-->> CustOrderItems
Which is generated from the Shopping Cart.
The CustomerOrder is in its own context orderContext so that I can save it
when it9s completed and not before. Also so that saving the default EC
doesn9t save the order before I9m ready. This works fine. It is a peer
editing context.
However, I also have another requirement to create a customer order from
another set of data that is very similar to the shopping cart, but I only
want this to be available at a certain point in the application. I decided
to use the CartItems class without a ShoppingCart in a new editing context
(loyaltyContext) to create the list of items to go on the order. The point
is that this EC will NEVER save to the database. It does however set up
some relationships to other things (like CartItem <<-- Product) in the same
way that the Shopping Cart does.
The problem is that if I create an order from the second type BEFORE
creating an order of the first type, the CartItem seems to already be
registered in the loyaltyContext. The thing is, I really want the
loyaltyContext and anything registered in it to cease to exist if the user
leaves this particular page. So that it won9t affect any other contexts.
Does it sound like this is possible, or should I create my own class to hold
the data and pass it on to the order that way without using CartItem?
I9m not exactly sure how the registering9 of objects works with EC9s. I
thought that each object got registered in whichever context when you
inserted it, but the errors I am getting seem to indicate that once CartItem
has been used in one context, it9s registered there and has to be faulted in
other contexts. Even if the object instances are different. Anyone feel
like trying to explain this? :-)
Regards,
Dave.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.