Expressions Params
Beatrix Expressions are a mechanism for defining how small pieces of code should be generated in your Solution. These code snippets can be constants, environment variables, pointers to other entity properties, among other types.
Every Expression requires that at least one parameter be informed. It allows Expression to know the desired value and the type of return that should be made.
The parameters are predefined and each one has an associated purpose and value type.
General Rules
All parameters have a pattern for their use: @[Param_Name]::[Param_Value].
- Must start with '@';
- Must have a pre-defined name;
- Depending on the type of parameter, it is optional to inform a desired value. Each value must be separated by '::'
Example:
1 |
|
Find out below the types of parameters that exist and the rules for using each one.
@ConstBool
Indicates a constant value of type bool or System.Boolean. Used when you want an Expression to return this constant value.
Requirements Rules:
- Is required to inform one value;
- The value must be a Boolean type (true or false)
Example:
1 |
|
Usage in an Expression:
1 |
|
@ConstByte
Indicates a constant value of type byte or System.Byte. Used when you want an Expression to return this constant value.
Requirements Rules:
- Is required to inform one value;
- The value must be equivalent to the byte type (Range: 0 to 255)
Example:
1 |
|
Usage in an Expression:
1 |
|
@ConstSByte
Indicates a constant value of type sbyte or System.SByte. Used when you want an Expression to return this constant value.
Requirements Rules:
- Is required to inform one value;
- The value must be equivalent to the sbyte type (Range: -128 to 127)
Example:
1 |
|
Usage in an Expression:
1 |
|
@ConstChar
Indicates a constant value of type char or System.Char. Used when you want an Expression to return this constant value.
Requirements Rules:
- Is required to inform one value;
- The value must be equivalent to the char type
Example:
1 |
|
Usage in an Expression:
1 |
|
@ConstDate
Indicates a constant value of type DateTimeOffset or System.DateTimeOffset. Used when you want an Expression to return this constant value.
It allows you to define the desired format for the date, including setting the time zone.
Requirements Rules:
- Two values are needed, they are:
- The desired date
- The date format
- The date and format must be valid and matches
Example:
1 |
|
Usage in an Expression:
1 |
|
@ConstDecimal
Indicates a constant value of type decimal or System.Decimal. Used when you want an Expression to return this constant value.
Requirements Rules:
- Is required to inform one value;
- The value must be equivalent to the decimal type
Example:
1 |
|
Usage in an Expression:
1 |
|
@ConstDouble
Indicates a constant value of type double or System.Double. Used when you want an Expression to return this constant value.
Requirements Rules:
- Is required to inform one value;
- The value must be equivalent to the double type
Example:
1 |
|
Usage in an Expression:
1 |
|
@ConstFloat
Indicates a constant value of type float or System.Single. Used when you want an Expression to return this constant value.
Requirements Rules:
- Is required to inform one value;
- The value must be equivalent to the float type
Example:
1 |
|
Usage in an Expression:
1 |
|
@ConstShort
Indicates a constant value of type short or System.Int16. Used when you want an Expression to return this constant value.
Requirements Rules:
- Is required to inform one value;
- The value must be equivalent to the short type (Range: -32,768 to 32,767)
Example:
1 |
|
Usage in an Expression:
1 |
|
@ConstUShort
Indicates a constant value of type ushort or System.UInt16. Used when you want an Expression to return this constant value.
Requirements Rules:
- Is required to inform one value;
- The value must be equivalent to the ushort type (Range: 0 to 65,535)
Example:
1 |
|
Usage in an Expression:
1 |
|
@ConstInt
Indicates a constant value of type int or System.Int32. Used when you want an Expression to return this constant value.
Requirements Rules:
- Is required to inform one value;
- The value must be equivalent to the int type (Range: -2,147,483,648 to 2,147,483,647)
Example:
1 |
|
Usage in an Expression:
1 |
|
@ConstUInt
Indicates a constant value of type uint or System.UInt32. Used when you want an Expression to return this constant value.
Requirements Rules:
- Is required to inform one value;
- The value must be equivalent to the uint type (Range: 0 to 4,294,967,295)
Example:
1 |
|
Usage in an Expression:
1 |
|
@ConstLong
Indicates a constant value of type long or System.Int64. Used when you want an Expression to return this constant value.
Requirements Rules:
- Is required to inform one value;
- The value must be equivalent to the long type (Range: -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807)
Example:
1 |
|
Usage in an Expression:
1 |
|
@ConstULong
Indicates a constant value of type ulong or System.UInt64. Used when you want an Expression to return this constant value.
Requirements Rules:
- Is required to inform one value;
- The value must be equivalent to the ulong type (Range: 0 to 18,446,744,073,709,551,615)
Example:
1 |
|
Usage in an Expression:
1 |
|
@ConstString
Indicates a constant value of type string or System.String. Used when you want an Expression to return this constant value.
Requirements Rules:
- Is required to inform one value;
- Must only have letters, numbers, underline char ('_'), dot char ('.') and at char ('@')
- Max length of 200 chars
Example:
1 |
|
Usage in an Expression:
1 |
|
@ConstGuid
Indicates a constant value of type Guid or System.Guid (Globally Unique Identifier). Used when you want an Expression to return this constant value.
Requirements Rules:
- Is required to inform one value;
- The value must be a valid Guid type
Example:
1 |
|
Usage in an Expression:
1 |
|
@UtcToday
Gets the current date at run time, in UTC format.
Requirements Rules:
- It isn't necessary to inform a value for this parameter
Example:
1 |
|
Usage in an Expression:
1 |
|
@UtcNow
Gets the current date and time at run time, in UTC format.
Requirements Rules:
- It isn't necessary to inform a value for this parameter
Example:
1 |
|
Usage in an Expression:
1 |
|
@Regex
Gets a Regular Expression string value.
Due to the complexity of characters that a Regular Expression can have, the value for the parameter must be in Base64 format.
Requirements Rules:
- Is required to inform one value;
- Must be a valid Base64 string;
- The Base64 string must contains a valid Regular Expression
Example:
1 2 |
|
Usage in an Expression:
1 |
|
@Prop
Indicates the property of an entity whose value you want to obtain at run time.
The entity for this property belongs to the expression/parameter execution context. For example: When executed on an EntityValidation, the validation entity is used.
Requirements Rules:
- Is required to inform one value;
- Must exist the property in the entity property list
Example:
1 |
|
Usage in an Expression:
1 |
|
@PropChild
Indicates a nesting of properties in an entity whose value you want to obtain at run time.
Only allowed for properties whose type is a relationship with another entity.
The entity of the main property belongs to the expression/parameter execution context. For example: When executed on an EntityValidation, the validation entity is used.
Requirements Rules:
- Is required to inform one value;
- Only allowed one child property, in which must be separated by dot char ('.');
- The main property must exist in the context entity property list;
- An entity must exist for the main property type in the current model;
- The child property must exist in the relationship entity
Example:
1 |
|
Usage in an Expression:
1 |
|