<div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div class="h5"><br>
</div></div>There are a few different ways for objects to get a dependency,<br>
looking up a singleton is only one of them. I'd prefer not to use it.<br>
Let me show you some fake code that should hopefully demonstrate what<br>
I want to do better than I've explained it so far.<br>
<br>
MyBlogApp new userRepository: UserRepository new;<br>
mountAt: '/us/blog';<br>
run.<br>
<br>
MyBlogApp new userRepository: UserRepository new;<br>
mountAt: '/ca/blog';<br>
run.<br>
<br>
Each of those is an instance of my blog app, and runs separately from<br>
the other. The userRepository automatically gets injected into the<br>
components that make up the application. This way they can just look<br>
up their local instance variable as opposed to grabbing a singleton.<br>
<br>
Is that clearer? That's the gist of what I'm trying to do. Now I<br>
just need to know how to do it with Seaside.<br>
<div><div></div><div class="h5"><br>
Pat<br>
</div></div></blockquote></div><br>Ah, I see, you're wanting to be involved in the creation of the root instance of your component and hand in the dependency there. What you're looking for is a custom render loop, subclass WARenderLoopMain so you can override #createRoot and control the creation of your component. Then you can pass in any dependencies you like during the construction of your component.<br>
<br>You can plug in your render loop during the registration of your app on a mount point.<br><br>YourRootClass class>>initialize<br> | app |<br> app := self registerAsApplication: 'someAppName'.<br> app preferenceAt: #mainClass put: YourRenderLoop.<br>
^ app<br><br>Ramon Leon<br><a href="http://onsmalltalk.com">http://onsmalltalk.com</a><br>