Reference

Elements

core concept: expression elements

Any

AnyElementThe base of all elements. All other elements extend this type. Any method that accepts an AnyElement will accept any other element type (nullable and non-nullable).
AnyElement<T>The base of all elements of a specific .NET CLR type, where the generic parameter T is a .NET CLR type. Any method that accepts this type will accept any other element of that data type; i.e. Int32Element can be used anywhere that specifies an AnyElement<int> and NullableInt32Element can be used anywhere that specifies an AnyElement<int?>.

Object

AnyObjectElementSimilar to AnyElement, but represents elements that equate to object. This element isn't typically used, but has use when dbExpression cannot definitively determine the .NET CLR type. For example, the COALESCE database function accepts a set of parameters that can be of different data types. Microsoft SQL Server will return the first non-nullable item in the list during query execution. As such, the return could be any type, so dbExpression must realize this as an object type.
AnyObjectElement<T>Typically used with user-defined types that are unkown to dbExpression, for example a complex type stored in the database as a primitive type * like an object serialized/deserialized as JSON in a varchar(max) field/column. dbExpression supports (through scaffold configuration) the ability to specify your own type for a database field/column and (through runtime configuration) allows you to provide a value converter for this type.
ObjectElementa AnyObjectElement, for use when non-nullable objects are required.
NullableObjectElementa AnyObjectElement, for use when nullable objects are required.
ObjectElement<T>a AnyObjectElement<T>, for use when non-nullable objects are required.
NullableObjectElement<T>a AnyObjectElement<T>, for use when nullable objects are required.
NullElementThis element is the return from the helper function dbex.Null to represent a server-side NULL. It's typically used in filter expressions, i.e. dbo.Table.Field == dbEx.Null.

Primitives

Numeric

AnyNumericElementAn element representing any numeric .NET CLR type. This element is used with fields/functions that specify a non-nullable numeric data type.
NullableAnyNumericElementAn element representing any numeric .NET CLR type. This element is used with fields/functions that specify a nullable numeric data type.
ByteElementAn element representing the byte .NET CLR type. This element is used with fields/functions that specify a byte.
NullableByteElementAn element representing the byte? .NET CLR type. This element is used with fields/functions that specify a byte?.
DecimalElementAn element representing the decimal .NET CLR type. This element is used with fields/functions that specify a decimal.
NullableDecimalElementAn element representing the decimal? .NET CLR type. This element is used with fields/functions that specify a decimal?.
DoubleElementAn element representing the double .NET CLR type. This element is used with fields/functions that specify a double.
NullableDoubleElementAn element representing the double? .NET CLR type. This element is used with fields/functions that specify a double?.
Int16ElementAn element representing the short .NET CLR type. This element is used with fields/functions that specify a short.
NullableInt16ElementAn element representing the short? .NET CLR type. This element is used with fields/functions that specify a short?.
Int32ElementAn element representing the int .NET CLR type. This element is used with fields/functions that specify a int.
NullableInt32ElementAn element representing the int? .NET CLR type. This element is used with fields/functions that specify a int?.
Int64ElementAn element representing the long .NET CLR type. This element is used with fields/functions that specify a long.
NullableInt64ElementAn element representing the long? .NET CLR type. This element is used with fields/functions that specify a long?.
SingleElementAn element representing the float .NET CLR type. This element is used with fields/functions that specify a float.
NullableSingleElementAn element representing the float? .NET CLR type. This element is used with fields/functions that specify a float?.

Boolean

BooleanElementAn element representing the bool .NET CLR type. This element is used with fields/functions that specify a bool.
NullableBooleanElementAn element representing the bool? .NET CLR type. This element is used with fields/functions that specify a bool?.

DateTime

Elements that map to .NET date/time data types. DateTime and DateTimeOffset are typically interchangeable; i.e. any method accepting a DateTimeElement will also accept a DateTimeOffsetElement element, and any method accepting a DateTimeOffsetElement will accept a DateTimeElement.

DateTimeElementAn element representing the DateTime .NET CLR type. This element is used with fields/functions that specify a DateTime.
NullableDateTimeElementAn element representing the DateTime? .NET CLR type. This element is used with fields/functions that specify a DateTime?.
DateTimeOffsetElementAn element representing the DateTimeOffset .NET CLR type. This element is used with fields/functions that specify a DateTimeOffset?.
NullableDateTimeOffsetElementAn element representing the DateTimeOffset? .NET CLR type. This element is used with fields/functions that specify a DateTimeOffset?.
TimeSpanElementAn element representing the TimeSpan .NET CLR type. This element is used with fields/functions that specify a TimeSpan.
NullableTimeSpanElementAn element representing the TimeSpan? .NET CLR type. This element is used with fields/functions that specify a TimeSpan?.

Guid

GuidElementAn element representing the Guid .NET CLR type. This element is used with fields/functions that specify a Guid.
NullableGuidElementAn element representing the Guid? .NET CLR type. This element is used with fields/functions that specify a Guid?.

String

AnyStringElementStrings in .NET act uniquely. They are not primitives, but sometimes they act like a primitive. In a non-nullable context (#nullable disable), string? is not legal syntax, but any object typed as string can be null or non-null. In a nullable context (#nullable enable), strings act much like other primitives related to nullability. To handle all the complexities of strings, dbExpression has this additional element type, where other primitive data types do not have this corresponding "Any" element type. This element basically represents a string in any context.
StringElementAn element representing the string .NET CLR type. This element is used with fields/functions that specify a string. Fields are of this element type when they do not allow null (database constraint).
NullableStringElementAn element representing the string? .NET CLR type. This element is used with fields/functions that specify a string?. Fields are of this element type when they allow null (database constraint).

Enum

These elements represent user-defined enum types that are unkown to dbExpression, where the generic parameter TEnum specifies the user-defined enum type. dbExpression supports (through scaffold configuration) the ability to specify your own enums for a database field/column and (through runtime configuration) allows you to provide settings for managing enums.

EnumElement<TEnum>An element representing the TEnum enum type. This element is used with fields/functions that specify a TEnum type.
NullableEnumElement<TEnum>An element representing the TEnum? enum type. This element is used with fields/functions that specify a TEnum? type.

Array (byte)

ByteArrayElementAny field or function typed as a byte[]. A typical use of this element type is when a database field/column is typed as an image or something similar.
NullableByteArrayElementSimilar to ByteArrayElement, any field or function typed as a byte[]. The difference between this element tyupe and a ByteArrayElement is this is used when the field/column allows null values.

Alias

AliasedElementAnyElement that has been aliased using the dbex.Alias utility method.
AliasedElement<T>AnyElement that has been aliased using the dbex.Alias<T> utility method.
Previous
Syntax Conventions

© 2024 dbExpression. All rights reserved.