Click or drag to resize

ExpressionParser Class

Helper class for working with field reference expressions.

Field references can be used throughout platform applications with an expression containing markers for IField values of the form [<flags><key>] where <key> is a field Key and <flags> are zero or more modifier flag characters (see the corresponding FieldExpressionAttrs flags) specifing how the field value is to be represented:

  • $ - DisplayText - Use the field's display text rather than its raw value (obtained via DisplayTextGet(DispTextFlags)).
  • ' - AnsiQuote - AnsiQuote the value using AnsiQuote(String) (this is a single-tick character).
  • ` - DoubleQuote - Enclose the field value in double-quote '"' characters (this is a back-tick character).
  • # - Numeric - The value is a numeric value and should be rendered as zero "0" if the value is null/empty.
  • < - UseOldValue - Use the OldValue if the field is dirty.
  • & - UseCaption - Use the field's Caption instead of its value.
  • ? - EscapeForUrl - The field's value should be escaped for use in a URL using ForUrl(String).
  • @ - EscapeForHtml - The field's value should be escaped for use in HTML using ForHtml(String).
  • ^ - ApplyDefault - Use the field's DefaultValue if the field's value is null/empty.
  • + - EscapeForXML - The field's value should be escaped for use in XML using ForXml(String).
  • * - RawValue - Use the field's value (obtained via Value), implied if no other option specified.
  • ~ - ClientElement - Renders as a javascript expression accessing the field. Often combined with either '$' or '*' attributes to obtain the client-side display or raw values respectively.
  • : - Optional - Value is optional and should default to zero or empty string, as appropriate.
  • - - Guid - The value is a GUID value and should be rendered as the zero GUID "{00000000-0000-0000-0000-000000000000}" if the value is null/empty.

Field references are sometimes used in conjunction with "!fn" Embedded Functions which are resolved by the EmbeddedParser.

Inheritance Hierarchy
SystemObject
  NetQuarryExpressionParser

Namespace:  NetQuarry
Assembly:  EAP.Core (in EAP.Core.dll) Version: 2.0.0.0 (4.6.8.0)
Syntax
public class ExpressionParser

The ExpressionParser type exposes the following members.

Constructors
  NameDescription
Public methodExpressionParser
Initializes a new instance of the ExpressionParser class
Top
Methods
  NameDescription
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodStatic memberExtractFieldKeys(String)
Construct a set of keys for the fields referenced in the specified expression.
Public methodStatic memberExtractFieldKeys(String, Boolean)
Construct a set of keys for the fields referenced in the specified expression.
Public methodStatic memberExtractFlags
Converts a string of field expression flags to their corresponding FieldExpressionAttrs. Field expression flags occur in field expressions immediately following the opening square bracket.
Protected methodFinalize
Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodStatic memberHasReferences
Determines if the specified expression MIGHT include Field References by checking for the existence of any field reference prefixes. See HasReferencesOrEmbeddedFunctions(String) to also check for Embedded Functions.
Public methodStatic memberHasReferencesOrEmbeddedFunctions
Determines if the specified expression MIGHT include Field References or Embedded Functions by checking for the existence of any field reference or embedded function prefixes. See HasReferences(String) to only test for Field References.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodStatic memberParse(String, String)
Parse a field expression extracting its FieldExpressionAttrs and reference string. Flag characters, if any, must precede the expression itself and any leading and/or trailing square brackets will be removed.
Public methodStatic memberParse(String, String, String)
Parse a field expression into its FieldExpressionAttrs and reference string. Flag characters, if any, must precede the expression itself.
Public methodStatic memberPerformExpressionModification
Modify a resolved expression per the specified FieldExpressionAttrs.
Public methodStatic memberResolveReferences
Common helper function to resolve a string of references, given a list of possible replacement values (contained in property collection).
Public methodStatic memberToNumericString
Convert a supposedly numeric string into a validated numeric string. This method has two purposes:
  1. Convert likely non-numerics to valid numerics. In particular, null/empty string to zero, "false" to zero, "true" to one.
  2. Protect against possible SQL injection attack by converting supposedly numeric values that don't parse to zero.
In the case of an unexpected, non-parsable value, a simple SQL injection attack detection is performed and a devlog and request log entry generated if a SQL injection attempt looks likely.
Public methodToString
Returns a String that represents the current Object.
(Inherited from Object.)
Top
Fields
  NameDescription
Public fieldStatic memberFieldRefFlags
The set of valid field reference flags used in field reference expressions. See FieldExpressionAttrs for a description of each.
Public fieldStatic memberRefCaption
The field reference flag signifying that the expression should be resolved using the field's caption. See UseCaption.
Public fieldStatic memberRefRaw
The field reference flag signifying that the expression should be resolved using the field's raw value. See RawValue.
Top
Extension Methods
  NameDescription
Public Extension MethodEqualValue
Determines if the object value is equal to another object. If the two objects are null, then this returns true. There is special handling for guid comparisons (since a guid could be a string formatted in up to 3 different ways). If the special guid handling is not performed, then the object.Equals method is used.
(Defined by EAPUtil.)
Top
Remarks
Note that in many contexts, particular filters on pages and page elements, references to query parameters in the current request URL may be used. These take the form [<flags>req.<paramy>] where the "req." prefix indicates that the value is to be obtained from the <param> parameter in the current request URL.
See Also