Class WhenClause
- Namespace
- YndigoBlue.Velocity.Model
- Assembly
- YndigoBlue.Velocity.dll
Represents a single WHEN branch of a Case expression.
public class WhenClause
- Inheritance
-
WhenClause
Remarks
A WHEN branch takes one of two shapes, matching the two forms of the SQL CASE expression:
-
Searched — Condition is set and Value is
null. The branch is chosen when the condition evaluates to true, producingWHEN price > 100 THEN 'Premium'. -
Simple — Value is set and Condition is
null. The branch is chosen when the value equals the owning case expression's operand, producingWHEN 'A' THEN 'Excellent'.
Instances are created by When(IFilterItem, IElement) and When(IElement, IElement) rather than directly, so the branch shape always matches the form of the case expression it belongs to.
Constructors
- WhenClause(IElement, IElement)
Creates a WHEN branch for a simple case expression.
- WhenClause(IFilterItem, IElement)
Creates a WHEN branch for a searched case expression.
Properties
- Condition
Gets the condition that selects this branch, or
nullwhen this is a simple case branch.
- IsSearched
Gets whether this branch belongs to a searched case expression (a condition rather than a value).
- Result
Gets the value produced when this branch is selected.
- Value
Gets the value compared against the case operand, or
nullwhen this is a searched case branch.