Zum Hauptinhalt springen

FieldFilterOperatorDtoExtensions

Namespace: Meshmakers.Octo.Communication.Contracts.DataTransferObjects

Conversions between the transport enum FieldFilterOperatorDto and the engine enum .

public static class FieldFilterOperatorDtoExtensions

Inheritance Object → FieldFilterOperatorDtoExtensions

Remarks:

AB#4956: the two enums are deliberately NOT numerically compatible. carries Contains/StartsWith/EndsWith on 13/14/15 (inserted by AB#2179), where FieldFilterOperatorDto carries Between/IsNull/IsNotNull. A numeric cast therefore silently turns a BETWEEN filter into a CONTAINS filter. Always convert through this class - never cast.

Methods​

ToFieldFilterOperator(FieldFilterOperatorDto)​

Converts a transport operator into the engine operator of the same name.

public static FieldFilterOperator ToFieldFilterOperator(FieldFilterOperatorDto op)

Parameters​

op FieldFilterOperatorDto
The transport operator.

Returns​

FieldFilterOperator
The matching engine operator.

Exceptions​

ArgumentOutOfRangeException
The operator has no engine counterpart.

ToFieldFilterOperatorDto(FieldFilterOperator)​

Converts an engine operator into the transport operator of the same name.

public static FieldFilterOperatorDto ToFieldFilterOperatorDto(FieldFilterOperator op)

Parameters​

op FieldFilterOperator
The engine operator.

Returns​

FieldFilterOperatorDto
The matching transport operator.

Exceptions​

ArgumentOutOfRangeException
The operator is engine-only and cannot be expressed on the wire: (see AB#1231) and the string operators , and .

FromCkModelEnum(Enum)​

Converts a CK model operator enum (System/FieldFilterOperator, e.g. as carried by a persisted query) into the engine operator of the same name.

public static FieldFilterOperator FromCkModelEnum(Enum op)

Parameters​

op Enum
The CK model enum value.

Returns​

FieldFilterOperator
The matching engine operator.

Exceptions​

ArgumentOutOfRangeException
The value has no engine counterpart.

Remarks:

Matched by name on purpose: the CK enum is a third, independent numbering that today happens to agree with the engine up to and would drift the same way the transport enum did (AB#4956) as soon as a member is inserted on either side.