2023 beta - APIs & Extensions (20%) Flashcards
How do you add a new handler to a handler chain?
- Implement the IHandler<TIn, TOut> interface
- Be decorated with the DependencyName attribute
- Return a result from the “Execute” method
- Specify an order via the “Order” property
How do you add a new pipe to an existing pipeline?
- Implement the IPipe<TIn, TOut> interface
- Return a result from the “Execute” method
- Specify an order via the “Order” property
How do you break a handler chain?
return result;
How do you call the next handler of a handler chain?
return this.NextHandler.Execute(unitOfWork, parameter, result);
How do you return an error code, a subcode, a message, and exit a pipe?
result.ResultCode = ResultCode.Error;
result.SubCode = SubCode.NotFound;
result.Messages.Add(new ResultMessage { Message = “A customer is required to format the label.” });
return result;
What do you need to do to exit a pipe without specifying an error code?
result.ExitPipeline = true;
return result;
How do you replace an existing pipe?
-Implement the IPipe<TIn, TOut> interface
- Return a result from the “Execute” method
- Specify an order via the “Order” property (The order does not necessarily need to be the same as the standard pipe)
- Be named the same as the pipe being replaced (this is a new requirement)
How do you stop the execution of a pipeline?
The pipe must either assign an error code to the result object or set the exit flag on the result object.
How do you use a pipeline in code?
Have an instance injected into the class constructor like most other objects.
On what is a persona built on?
A persona is built on the user and customer characteristics that you add to a persona rule
What is the RuleManager?
RuleManager is the container class that is attached to Entities to allow that Entity to have a RulesEngine
What is the purpose of RuleClause?
RuleClause defines the actual rules to be run and the Condition, Grouping, and Order in which they run
What are the rule types?
Persona
Category
Shipping
Promotion
Page Variants
Restriction Groups
What is the purpose of RuleTypeOption?
RuleTypeOption defines the rules that are available when adding a RuleClause. (These options define the “IF” statement of the rule).
Which class is the base class for all criteria types?
CriteriaTypeBase