Commands (DefaultOrchardCommandHandler)

Jan 17, 2011 at 11:10 AM
Edited Jan 17, 2011 at 11:12 AM

In Orchard i see alot of commands being used, but the documentation doesn't speak of commands.
There is a ICommandManager that provides CommandDescriptors

Some documentation regarding commands would be nice.
Just executing a parameter based request and redirecting or something, that is easy.

I want to execute a command in JSon so a small contentpart will be updated.
I can't find any examples where something like that is done..

Or should this always be a complete form postback?

PS: Is there any reason that several services are called sometimes xxxManager and other times xxxProvider or even xxxCoordinator.. or just xxxService

Jan 17, 2011 at 11:28 AM

btw, i know how commands work
Features can provide commands that will be available anywhere in Orchard and even from the commandline tool, or from the CommandController in Experimental.

Looking at the SetupCommand there is a javascript with a throbber showing synchronizing.gif
That seems to be the only way to let the browser wait for a response while a command is being executed?

Still a command behind Ajax that frequently updates a contentpart in the browser is something that i'm looking for.

Jan 17, 2011 at 6:30 PM

I think you're mixing several things. Commands are executed from the command-line interface. Doing work on a JSON request would be something completely different that you should handle with a controller. It would actually be no different from doing it in MVC without Orchard. Look up "AJAX ASP.NET MVC" for some pointers.

Jan 17, 2011 at 7:06 PM

hmm.. ok for Ajax calls returning data to update a small contentpart i think u are right.

Just missing the idea behind commands and if Orchard extends MVC regarding commands.

Jan 17, 2011 at 7:27 PM

The idea behind commands is that many tasks can be automated this way, which will be a real time saver to people building lots of sites with Orchard. Ideally, features would be exposed both as admin UI and commands, as relevant. They are not really an extension to MVC, more like an orthogonal concern.