
Originally Posted by
Ted Husted
You can use conventional singletons alongside Spring, and refactor later. (Which I should actually do myself, now that everything else is running!)
Process complete. :wink:
I changed the Mapper property so that it stopped loading the singleton itself. I then wrapped our singleton in a Spring element:
Code:
<object id="Mapper" type="IBatisNet.DataMapper.Mapper, IBatisNet.DataMapper" factory-method="Instance"/>
To inject the Mapper into the business commands that need it, I setup a base element:
Code:
<object id="BaseCommand" >
<property name="Mapper"><ref object="Mapper"/></property>
</object>
And made this the parent of the (64) business commands.
Code:
<object id="program_delete" type="WNE.Core.Commands.BaseDelete, WNE.Core" parent="BaseCommand">
<property name="ID"><value>program_delete</value></property></object>
Run the tests; edit some flubbed XML; fix some naive code; run the tests; everybody is happy.
Code:
------ Test started: Assembly: WNE.Test.dll ------
98 succeeded, 0 failed, 0 skipped, took 38.51 seconds.
---------------------- Done ----------------------
8) Way cool.
While I was at it, I setup parent elements for other common object types. :idea: I'm thinking that a base element for a common object type is a best practice, just like having base objects and base pages.
-Ted.