Table of Contents

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:

  • SearchedCondition is set and Value is null. The branch is chosen when the condition evaluates to true, producing WHEN price > 100 THEN 'Premium'.
  • SimpleValue is set and Condition is null. The branch is chosen when the value equals the owning case expression's operand, producing WHEN '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 null when 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 null when this is a searched case branch.