BO parameters validation

Profile Reply
gabossolo Client

Hello -- Please help me on how to validate BusinessOperation parameters...
I would like to validation required parameters.

Thank you


User Description Posted On
MariyaVoytovich Agent

Hello gabossolo!

I apologize for the delayed response.

To validate the parameters of a BusinessOperation, you need to create your own BOMethodRunner.

public class ValidateBOMethodRunnerExecute : BOMethodRunnerExecute
public ValidateBOMethodRunnerExecute(XafApplication application)
: base(application)
}public override void Run(BusinessOperationAction createResultViewParameters, IBusinessOperation businessOperation,
ShowViewParameters showViewParameters)
base.Run(createResultViewParameters, businessOperation, showViewParameters);if (showViewParameters.CreatedView != null)
var dialogController = showViewParameters.Controllers.OfType().FirstOrDefault();
if (dialogController == null)
dialogController = Application.CreateController();
}dialogController.Accepting += (sender, args) =>
var controller = sender as DialogController;
RuleSetValidationResult result = Validator.RuleSet.ValidateTarget(this.Application.CreateObjectSpace(), controller.Frame.View.CurrentObject, ContextIdentifier.Save);
if (result.ValidationOutcome > ValidationOutcome.Information)
args.Cancel = true;
MyRunOperationCore(createResultViewParameters, businessOperation, args.ShowViewParameters);

Add a controller to customize the BusinessOperationCustomExecute event. To more information see Business Operations. Executing Events and Customization.

public class CustomizeBusinessOperationsController : ViewController
private BOExecViewController _boExecViewController;protected override void OnActivated()
_boExecViewController = Frame.GetController();
if (_boExecViewController != null)
// Subscribing to handling of controller's events for specific business operations.
_boExecViewController.BOEvents[typeof(TargetBO)].BusinessOperationCustomExecute += CustomizeBusinessOperationsController_BusinessOperationCustomExecute;

Feel free to contact us if you need further assistance or have additional questions.

On behalf of Xafari Client Services Team

× This ticket is closed.

Write US