-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Commands depending on Other Queries to work - Lookup Tables #38
Comments
I'm afraid I don't fully understand what problem you are trying to solve. Could you elaborate a bit? Do you need some kind of queuing? Or perhaps some kind of cross-cutting concern that needs to be applied to command handlers? |
Thanks for your prompt reply. If the user clicks on the "Open New Facility" menu Option, it should then query the locations (For the user to select where the new facility is based on) After that, the user fills the data fields and selects the location from the drop down list and the client app sends This means that the I am thinking of building a
|
I wouldn't say the command depends on the query; it simply depends on the location id. How to proceed here, depends a bit on the technology, but say that you're creating an MVC application, what I would typically do here, is create an public class CreateNewFacilityModel
{
public CreateNewFacilityCommand Command { get; set; }
public Location[] Locations { get; set; }
} The MVC controller's action method can create and return this var locations = this.qureyProcessor.Execute(new GetLocationsQuery());
return new CreateNewFacilityModel
{
Locations = locations,
Command = new CreateNewFacilityCommand
{
LocationId = locations.First().Id,
}
} The view can now bind to the Later on, when the model is sent back to the server, MVC will model bind that object, after which you can grab the But perhaps you're not using MVC, but rather using a controllerless approach. In that case you will likely have a desktop or Angular client communicating with the service. In that case the model could be quite similar where the client constructs a model class that wraps the queries information to show to the user and the command to fill and send back. |
Million thanks Steven. I am going try implement the approaches you provided. |
Hello Steven,
I hope you are healthy, and doing well.
Some of my Commands needs to do some data to work. For example, a
CreateNewFacility
Command depends on querying Locations; so that, When sendingCreateNewFacilityCommand
for handling it containsLocationId
.I am thinking of building a commands dependency list. When the client (Web, Mobile app) logs in the system, it first call
GetCommandsDependencyListQuery
. Then before calling a command it sees if there any Query to send to the server.Your assistance is highly appreciated.
The text was updated successfully, but these errors were encountered: