Re: WOUnitTest and sessions and EditingContexts
Re: WOUnitTest and sessions and EditingContexts
- Subject: Re: WOUnitTest and sessions and EditingContexts
- From: Colin Clark <email@hidden>
- Date: Tue, 14 Dec 2004 11:13:47 -0500
Hi David,
On Monday, December 13, 2004, at 04:06 AM, David Cake wrote:
We are overloading EOEditingContext so it also keeps session
information, because we want to put creationdate and modificationdate
logging into our subclass of EOGenericRecord, and EOGenericRecord has
no direct access to the session (but does have access to the editing
context).
I know your questions were specific to getting WOUnitTest up and
running, but this design seems worth discussing a bit more. It's really
not a great idea to create a subclass of EOEditingContext that is aware
of the WOSession. This breaks separation of concern in quite a
problematic way; an editing context really shouldn't need to be
concerned with the details of request/response processing of your Web
application.
I think we need to know more details about your problem. Why would an
EC need to know about the session in order to save creation and last
modified dates in an EO?
There are a number of ways you can accomplish this sort of behaviour
that have been discussed in the past on the list. Perhaps a look
through the archives will provides you with some alternative designs.
One option might be to use Project Wonder's ERXGenericRecord or roll
something similar where an EC delegate calls methods like willUpdate()
or willInsert() on your EOs, providing you with an opportunity directly
prior to saving to set those dates. Obviously you'll have to handle
cases where the save was not successful, but that should be pretty
straightforward. I'm at a loss to see how the WOSession needs to be
involved in this kind of a case.
I hope that helps,
Colin
---
Colin Clark
Dynamic Web and Database Development Lead,
Resource Centre for Academic Technology,
University of Toronto
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden