CSLA Silverlight CommandBase usage?

CSLA Silverlight CommandBase usage?

Old forum URL: forums.lhotka.net/forums/t/9593.aspx


Ranjini posted on Friday, October 01, 2010

Are there any good example projects that show usage of a CommandBase object in Silverlight ?

 We are using Silverlight 4 / CSLA 4 and have a usecase where we need some operations/calculations performed within a business object that do not qualify as any of the CRUD operations. We figured CommandBase would be the right way to do this, but we are unable to find any good examples to get this to work. We tried using a Rule to trigger the DataPortal_Execute but may be because the affectedproperty is a BLB, it doesnt seem to work. Any pointers, please?

Thanks

Ranjini

RockfordLhotka replied on Friday, October 01, 2010

Remember that all server access is async, which means that invoking a command object is also async, which means that you must do this from within an async rule.

In the rule's Execute method you need to run the command, and handle the command's completion callback, and in that callback handler you need to call context.Complete to tell the rule that it is done.

I think this is demonstrated in the SimpleApp demo, though maybe with a ROB instead of CB - but the implementation is basically the same.

Copyright (c) Marimer LLC