Some services in my Robotlegs app require parameters. I’m wondering which solution is better:
- Mediators pass parameters to services
- Services aquire parameters from injected models
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As Creynders suggested, it depends on the scope of these variables, if they are const, model, or user input.
A great resource for me has been the ActionScript Developer’s Guide to RobotLegs: http://books.google.ca/books/about/ActionScript_Developer_s_Guide_to_Robotl.html?id=PFA2TWqZdSMC&redir_esc=y
This is my usual workflow:
Command calls the service, passing any necessary parameters. In the example below, I am passing a variable from the LoadLicenseEvent and from the ITokenModel to the service call. I use commandMap.detain() and commandMap.release() to keep the command alive until the service call is complete. The base class ServiceModuleCommand handles the fault event.