tag:robotlegs.tenderapp.com,2009-10-18:/discussions/questions/1000-is-it-applicable-for-me-to-use-one-context-to-hold-all-the-mappings-for-a-big-and-modular-applicationRobotlegs: Discussion 2012-08-25T14:39:38Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/180392332012-08-15T16:54:00Z2012-08-16T07:42:03ZIs it applicable for me to use one context to hold all the mappings for a big and modular application?<div><p>Hi Meteor,</p>
<p>I’ve never used XML for Context configuration, so,
I’m not sure if this will help you.</p>
<p><a href=
"http://knowledge.robotlegs.org/kb/framework-core/is-robotlegs-compatible-with-the-flash-ide-cs3cs4">
http://knowledge.robotlegs.org/kb/framework-core/is-robotlegs-compa...</a><br>
<a href=
"https://github.com/tschneidereit/SwiftSuspenders/tree/the-past#xml-configuration-of-injection-points">
https://github.com/tschneidereit/SwiftSuspenders/tree/the-past#xml-...</a></p>
<p><a href=
"http://www.helmutgranda.com/2009/12/02/robotlegs-and-flash-ide-cs4-injection/">
http://www.helmutgranda.com/2009/12/02/robotlegs-and-flash-ide-cs4-...</a></p>
<p>Follow Ruprict’s link (odoe’s comments):<br>
<a href=
"http://knowledge.robotlegs.org/discussions/questions/38-can-i-inject-settings-at-runtime#comment_2514233">
http://knowledge.robotlegs.org/discussions/questions/38-can-i-injec...</a></p>
<p>Ondina</p>
<p>P.S. Huge configuration files or classes are not easy to
maintain.</p>
<p>For example, it would be much better to split the mappings into
smaller classes (Commands) than to have them all inside a huge
Context class.</p>
<p>The mappings can be grouped together by “type” or by
“features”, or other criteria.<br>
So in your Context you’d have something like this:</p>
<p>commandMap.mapEvent(MappingsEvent.START_MAPPING,
MapControllersCommand, MappingsEvent, true);</p>
<p>commandMap.mapEvent(MappingsEvent.START_MAPPING,
MapModelsCommand, MappingsEvent, true);</p>
<p>commandMap.mapEvent(MappingsEvent.START_MAPPING,
MapServicesCommand, MappingsEvent, true);</p>
<p>commandMap.mapEvent(MappingsEvent.START_MAPPING,
MapViewsCommand, MappingsEvent, true);</p>
<p>In your MapControllersCommand you’d map Commands, in your
MapViewsCommand you’d map Views and Mediators..etc</p>
<p>The naming of those commands is up to you, of course.
(bootstrap, config..)<br>
You could as well have commands for mapping the modules, if need
be.</p>
<p>The local mappings, inside of each module, should be done in the
module’s own Context. (following the same pattern as the one
above)</p></div>Ondina D.F.