You can use CS to manage your record objects, I have not done it that way. Earlie on the CS we talked about why we usually don't have CS manage domain objects.
I have found that it is easier to call the reactorFactory through my service objects to create record objects rather then have CS call the reactorFactory for me. I don't want my service object to have to depend on CS's bean factory which I would have to do if I wanted CS to manage my record objects. I would rather have my service depend on reactor's factory instead. Perhaps someone else has a better approach.
--Kurt
On 2/12/06, Baz <[EMAIL PROTECTED]> wrote:
Thanks a lot Kurt. I appreciate your input.
You mentioned that:
> I would only have the DAOs and Gateways defined in CS
Reactor says that their DAO's are there to be consumed by the Record object,
and shouldn't be called directly from the app. How can/should I use a
Reactor DAO defined in CS, other than having it be automatically consumed by
createRecord?
You also mentioned something else that was very interesting:
> I don't recommend having CS manage record objects for you
What is the main difference between the record object and the others, that
makes it less suitable to be handled by CS? I am asking purely out of
ignorance. I was under the impression that CS should handle instantiation of
ALL objects in your app. Doesn't it add a strange complexity to have to
remember which objects are called through CS and which are called through
some factory?
Cheers,
Baz
-----Original Message-----
From: [email protected]
[mailto: [email protected]] On Behalf Of Kurt Wiersma
Sent: Sunday, February 12, 2006 3:13 PM
To: [email protected]
Subject: [coldspring-dev] Coldpsring & Reactor
On 2/12/06, Baz <[EMAIL PROTECTED]> wrote:
>
>
> So just to clear some things up with Coldspring working with Reactor:
>
> 1. Should all Reactor objects be defined in CS and ONLY called through CS
in
> your apps?
I would only have the DAOs and Gateways defined in CS. The record
objects you can create yourself inside your service cfc. You can make
service object get injected with the reactorFactory.
> 2. The createRecord object in Reactor is dependent on reactor's createDAO
> object - but I think this dependency is handled by Reactor... does this
mean
> we don't define that dependency in CS?
I believe that dependence is handled by Reactor so you should be fine.
It works in the sample app I built.
> 3. If I had a reactor bean defined in CS like this:
>
> <bean id="Website" factory-bean="reactorFactory"
> factory-method="createRecord">
> <constructor-arg name="name"><value>Website</value></constructor-arg>
> </bean>
>
> Can I use that bean as a dependency for another object, just like I would
> any other bean?
Yes that should work. I don't recommend having CS manager record
objects for you. At a minium you have issingleton="false" in the above
config.
> 4. Before using Reactor, I had a Customer bean with a getCountOrders()
> method that used a dependent OrderGateway cfc to return the count. To
mimic
> this using CS & Reactor, should I build a new object called
CustomerService
> that handles this dependency since you can't build dependencies into
Reactor
> objects? (or can u?)
Yes I would recommend using a service object to hide the
implementation of the persistence layer from the rest of your app.
I hope that answers your questions. :) Let me know if you need any more
info.
--Kurt
