Leon, there are sort of two issues here. When not using Reactor, I acutally
prefer to use a configuration CFC and inject the CFC into the components
that need it. This way I can wrap up all sorts of good information beyond
just the data source name. Things like server name, development mode (dev
mode or production mode?), paths, mappings, whatever. Anything that might
change from, say, my local system, to the staging server, to the production
server.

However, is there a reason why anything outside of your Reactor objects
would need the data source name? I could see it maybe on an existing app
that was having Reactor added onto it, but in a new app? You might want to
reassess whether non-Reactor CFCs should know anything about the database.



On 7/9/07, Leon Chalnick <[EMAIL PROTECTED]> wrote:

Howdy,

I'm working on my first Model-Glue: Unity app and am wondering about the
best way to configure my beans with a datasource name. I'm hoping someone
on
this list has experience with Model-Glue's implementation of CS and can
point me in the right direction.

<bean id="contact" class="MGcontactMgr.model.contact">
        <constructor-arg name="dsn"><value>ows</value></constructor-arg>
</bean>
<bean id="contactGateway" class="MGcontactMgr.model.contactGateway">
        <constructor-arg name="dsn"><value>ows</value></constructor-arg>
</bean>

I have the dsn already defined in my reactorConfiguration bean (below),
seems rather clumsy to have to spell it out again this way.

<bean id="reactorConfiguration" class="reactor.config.config">
        <constructor-arg name="pathToConfigXml">
          <value>/MGcontactMgr/config/Reactor.xml</value>
        </constructor-arg>
        <property name="dsn"><value>myContactMgr</value></property>
        ...
</bean>

So my first question is...is there a more elegant way to pull the dsn
property from the reactorConfiguration bean and pass it to my other beans
that need it?

Second...is this the appropriate place to be passing the dsn to beans that
will interact with the database? Seems like a better place to do it than
in
my controller.cfc...

TIA!

--Leon



Reply via email to