-
Notifications
You must be signed in to change notification settings - Fork 7
Rule Initialization
Arif Yayalar (@ayayalar) edited this page Dec 30, 2019
·
2 revisions
Initialize or InitializeAsync methods used for rule-engine related initializations, such as setting up the configuration options Constraint, ExecutionOrder, etc.
class UpdateTotal : RuleAsync<Order>
{
public override Task InitializeAsync()
{
Configuration.Constraint = m => m.FreeShipping;
IsParallel = true;
return Task.FromResult<object>(null);
}
public async override Task<IRuleResult> InvokeAsync()
{
return await RuleResult.Nil();
}
}class Order
{
public int Id { get; set; }
public decimal Total { get; set; }
public bool FreeShipping { get; set; }
}| Synchronous Rules |
| Asynchronous Rules |
| Parallel Rules |
| Reactive Rules |
| Proactive Rules |
| ExceptionHandler Rules |