Data access through ORM

Advanced

The back-end core components provide the following database access options:

  • access using the ORM model
  • direct access

This article covers database queries that use the ORM model.

ORM (Object-relational mapping) is a technology that lets you use object-oriented programming languages to manage data retrieved from the database. The purpose of ORM is to bind objects implemented in the code to the database table records.

The ORM data model implements data management via the following classes:

  • The Terrasoft.Core.Entities.EntitySchemaQuery class builds queries to retrieve the database table records. The queries apply the access permissions of the current user.
  • The Terrasoft.Core.Entities.Entity class accesses entities that represent records in the database table.

We recommend using the ORM model to access data, though the direct access to the database is also implemented in the back-end core components. Learn more about running direct database queries: Access data directly.

Configure a column path relative to the root schema 

Base a selection query that uses EntitySchemaQuery on the root schema. The root schema is the database table relative to which to build paths to the query columns, including the columns of joinable tables. To use a table column in a query, set the path to the column correctly.

Follow the principle of connection by lookup fields when building the column paths. Build the name of a column to add to the query as a chain of interconnected links. Each link must represent the context of the schema connected to the previous schema by a lookup column.

The template for configuring the path to a column in the N schema: 1SchemaContext.[...].NSchemaContext.LookupSchema'sColumnName.

Specify the column path using the direct connections 

The template for configuring the column path using the direct connections: LookupColumnName.LookupSchema'sColumnSchemaName.

Use direct connections if the connection lookup column is located in the main schema and links to the joinable schema. For example, a [City] root schema contains the [Country] lookup column. The column is connected to the [Country] lookup schema by the [Id] column.

The path to the column that contains the name of the country connected to the city, built using the direct connections: Country.Name. Where:

  • Country is the name of the lookup column in the [City] root schema. Links to the [Country] schema.
  • Name is the name of the column in the [Country] lookup schema.

Specify the column path using the reverse connections 

Unlike direct connections, reverse connections require the lookup field to join to be located in the joinable entity, not the main entity.

The template for configuring the column path using the reverse connections: [JoinableSchemaName:NameOfTheColumnToLinkTheJoinableSchema:NameOfTheColumnToLinkTheCurrentSchema].JoinableSchema'sColumnName.

The path to the name column of the account whose [City] field contains the [City] record selected in the query, built using the reverse connections: [Account:City:Id].Name. Where:

  • Account is the name of the joinable schema.
  • City is the name of the [Account] schema's column to connect the joinable schema.
  • Id is the name of the [City] schema's lookup column to connect the current schema.
  • Name is the value of the [Account] schema's lookup column.

If the schema's lookup column to connect the current schema is [Id], you do not have to specify it: [JoinableSchemaName:NameOfTheColumnToConnectTheJoinableSchema].JoinableSchema'sColumnName. For example, [Account:City].Name.

Retrieve data from the database 

Use the following classes to retrieve data from the database:

  • Terrasoft.Core.DB.Select retrieves data by accessing the database directly. Learn more: Access data directly.
  • Terrasoft.Core.Entities.EntitySchemaQuery retrieves database data using the ORM model.

The purpose of the Terrasoft.Core.Entities.EntitySchemaQuery class is to build selection queries for database table records. By default, you can retrieve up to 20 000 records in a query. This value can be modified in the MaxEntityRowCount setting in the ...\Terrasoft.WebApp\Web.config file.

Attention. However, we do not recommend modifying the MaxEntityRowCount setting. Doing so may lead to performance issues.

After you create and configure the class instance, Creatio will build a SELECT query to the application database. You can add columns, filters, and restriction conditions to the query. You can also set the parameters to output the query results in pagination mode. If needed, use the Terrasoft.Core.Entities.EntitySchemaQueryOptions class to set the parameters of a hierarchical query. Pass the same EntitySchemaQueryOptions instance as the GetEntityCollection() method parameter of the corresponding query to retrieve the results of various queries.

The Terrasoft.Core.Entities.EntitySchemaQuery class major features:

  • The resulting query applies the access permissions of the current user.
  • You can manage the current user's access permissions to the tables that JOIN SQL operator joined to the query.
  • The class lets you manage data of a cache repository or any repository you specify.

Creatio will cache the data retrieved from the database after running the query. Any repository that implements the Terrasoft.Core.Store.ICacheStore interface can serve as the query cache. By default, Creatio uses the session level cache with local storage. Define the query cache in the Cache property of the EntitySchemaQuery class instance. Set the key to access the query cache in the CacheItemName property. Learn more about Creatio repository levels: The object model of Creatio repositories.

As result of the query, is the Terrasoft.Nui.ServiceModel.DataContract.EntityCollection instance or the Terrasoft.Core.Entities.Entity class instance collection. Each Entity collection instance represents a string of data returned by the query.

Manage joined tables 

You can specify the schema join type of a query using the EntitySchemaQuery class. Use the JOIN operator to add the joinable schema column to the query.

The template for configuring the join type of the joinable schema column: SpecialCharacterOfTheJoinTypeNameOfTheColumnToConnectTheJoinableSchema.

Join types description
Join type
Special character of the join type
Use example
INNER JOIN
=
=Country.Name
LEFT OUTER JOIN
>
>Country.Name
RIGHT OUTER JOIN
<
<Country.Name
FULL OUTER JOIN
<>
<>Country.Name
CROSS JOIN
*
*Country.Name

By default, Creatio uses the LEFT OUTER JOIN type.

See the example that adds columns to a query using various join types below.

Add columns to a query
/* Create a query instance based on the City root schema. */
var esqResult = new EntitySchemaQuery(UserConnection.EntitySchemaManager, "City");

/* Add the Country schema of the LEFT OUTER JOIN type to the query. */
esqResult.AddColumn("Country.Name");

/* Add the Country schema of the INNER JOIN type to the query. */
esqResult.AddColumn("=Country.Name");

/* Add the Country schema of the LEFT OUTER JOIN type and the Contact schema of the RIGHT OUTER JOIN type to the query. */
esqResult.AddColumn(">Country.<CreatedBy.Name");

As a result, Creatio will generate the SQL query.

SQL query
SELECT
    [Country].[Name] [Country.Name],
    [Country1].[Name] [Country1.Name],
    [CreatedBy].[Name] [CreatedBy.Name]
FROM
    [dbo].[City] [City]
    LEFT OUTER JOIN [dbo].[Country] [Country] ON ([Country].[Id] = [City].[CountryId])
    INNER JOIN [dbo].[Country] [Country1] ON ([Country1].[Id] = [City].[CountryId])
    LEFT OUTER JOIN [dbo].[Country] [Country2] ON ([Country2].[Id] = [City].[CountryId])
    RIGHT OUTER JOIN [dbo].[Contact] [CreatedBy] ON ([CreatedBy].[Id] = [Country2].[CreatedById])

If the query contains the root schema and joinable schemas that use record permissions, you will be able to apply the access permissions of the current user. The Terrasoft.Core.DB.QueryJoinRightLevel enumeration lists the ways to apply the record access permissions to the joinable schemas.

The ways to apply the access permissions to the joinable schema queries are as follows:

  • Apply always.
  • Apply only if the joinable schema query uses columns other than the primary column and primary display column. Usually, these are [Id] and [Name] columns.
  • Do not apply.

The JoinRightState query property determines the order to apply the access permissions. The Joined objects administering (QueryJoinRightLevel code) system setting determines the default value of the property. If the setting is empty, Creatio will apply the access permissions if the joinable schema query uses columns other than the primary column and the primary display column.

Manage the query filters 

Filter is sets of conditions applied when displaying the query data. In SQL terms, a filter is a separate predicate (condition) of the WHERE operator.

Filter structure
Filter = {[AggregationType] {<LeftExpression> | <LeftExpressionColumnPath>}
    <ComparisonType>
    {{<RightExpression> | {<RightExpressionColumnPath>,...}} | {<Macros>, [MacrosValue]}}
}

To create a simple filter in EntitySchemaQuery, use the CreateFilter() method that returns the instance of the EntitySchemaQueryFilter type. EntitySchemaQuery implements a series of overloads for this method. This lets you create filters with different incoming parameters. EntitySchemaQuery implements methods that create special kinds of filters.

The EntitySchemaQuery instance contains the Filters property that represents the filter collection of the query (the EntitySchemaQueryFilterCollection class instance). The EntitySchemaQueryFilterCollection class instance is a typed collection of the IEntitySchemaQueryFilterItem elements.

Follow this procedure to add a filter to the query:

  • Create a filter instance for the query (CreateFilter() methods, methods that create special kinds of filters).
  • Add the filter instance to the query filter collection (the Add() collection method).

By default, Creatio uses the logical AND operation to combine the filters added to the Filters collection. To implement the logical OR operation, use the LogicalOperation property of the Filters collection. This property takes the values of the LogicalOperationStrict enumeration and lets you specify the logical operation to combine the filters.

You can manage the filters that build the resulting dataset in the EntitySchemaQuery queries. Each element of the Filters collection includes the IsEnabled property that determines whether the element takes part in building the resulting query (true/false). Creatio defines the similar IsEnabled property for the Filters collection. If you set this property to false, the query filtering will be disabled, yet the query filters collection will remain unchanged. Thus, you can create a query filters collection and use various combinations without changing the collection itself.

Manage the database entity 

Terrasoft.Core.Entities.Entity is a class that implements the database entity management.

The purpose of the Terrasoft.Core.Entities.Entity class is to access the object that represents a database table record. You can also use the class for CRUD operations on the corresponding records.

Retrieve the database data based on the user's corresponding access permissions
Advanced

Note. The examples in this article are also implemented in the web service. The package that contains the web service implementation is attached in the Resources block.

Example 1 

Example. Create an EntitySchemaQuery instance.

CreateESQ method
public string CreateESQ()
{
    var result = "";
    /* Retrieve the instance of the object schema manager. */           
    EntitySchemaManager esqManager = SystemUserConnection.EntitySchemaManager;
    /* Retrieve the instance of the schema to set as root for the EntitySchemaQuery instance. */
    var rootEntitySchema = esqManager.GetInstanceByName("City") as EntitySchema;
    /* Create the EntitySchemaQuery instance that has the rootEntitySchema set as root. */
    var esqResult = new EntitySchemaQuery(rootEntitySchema);
    /* Add columns to select in the resulting query. */
    esqResult.AddColumn("Id");
    esqResult.AddColumn("Name");
    /* Retrieve the Select instance associated with the EntitySchemaQuery query. */
    Select selectEsq = esqResult.GetSelectQuery(SystemUserConnection);
    /* Retrieve the text of the EntitySchemaQuery instance's resulting query. */
    result = selectEsq.GetSqlText();
    return result;
}

Example 2 

Example. Clone the EntitySchemaQuery instance.

CreateESQClone method
public string CreateESQClone()
{
    var result = "";
    EntitySchemaManager esqManager = SystemUserConnection.EntitySchemaManager;
    var esqSource = new EntitySchemaQuery(esqManager, "Contact");
    esqSource.AddColumn("Id");
    esqSource.AddColumn("Name");
    /* Clone the EntitySchemaQuery instance from the esqSource instance. */
    var esqClone = new EntitySchemaQuery(esqSource);
    result = esqClone.GetSelectQuery(SystemUserConnection).GetSqlText();
    return result;
}

Example 3 

Example. Retrieve the query results.

GetEntitiesExample method
public string GetEntitiesExample()
{
    var result = "";
    /* Create a query to the City schema, add the Name column to the query. */
    var esqResult = new EntitySchemaQuery(UserConnection.EntitySchemaManager, "City");
    var colName = esqResult.AddColumn("Name");

    /* Run the database query and retrieve the entire resulting objects collection. */
    var entities = esqResult.GetEntityCollection(UserConnection);
    for (int i=0; i < entities.Count; i++) {
        result += entities[i].GetColumnValue(colName.Name).ToString();
        result += "\n";
    }
    
    /* Run the database query and retrieve the object that has the set identifier. */
    var entity = esqResult.GetEntity(UserConnection, new Guid("100B6B13-E8BB-DF11-B00F-001D60E938C6"));
    result += "\n";
    result += entity.GetColumnValue(colName.Name).ToString();
    return result;
}

Example 4 

Example. Use the EntitySchemaQuery query cache.

UsingCacheExample method
public Collection<string> UsingCacheExample()
{
    /* Create a query to the City schema, add the Name column to the query. */
    var esqResult = new EntitySchemaQuery(UserConnection.EntitySchemaManager, "City");
    esqResult.AddColumn("Name");

    /* Define the key the cache will use to store the query results. Creatio will use the session level Creatio cache with local storage since the Cache object property is not redefined. */
    esqResult.CacheItemName = "EsqResultItem";

    /* The collection to place the query results. */
    var esqCityNames = new Collection<string>();

    /* The collection to place the cached query results. */
    var cachedEsqCityNames = new Collection<string>();

    /* Run the database query and retrieve the resulting objects collection. Creatio will cache the query results after this operation. */
    var entities = esqResult.GetEntityCollection(UserConnection);

    /* Process the query results and populate the esqCityNames collection. */
    foreach (var entity in entities)
    {
        esqCityNames.Add(entity.GetTypedColumnValue<string>("Name"));
    }

    /* Retrieve the link to the esqResult query cache as a data table in memory using the CacheItemName key. */
    var esqCacheStore = esqResult.Cache[esqResult.CacheItemName] as DataTable;

    /* Populate the cachedEsqCityNames collection using the query cache values. */
    if (esqCacheStore != null)
    {
        foreach (DataRow row in esqCacheStore.Rows)
        {
            cachedEsqCityNames.Add(row[0].ToString());
        }
    }
    return cachedEsqCityNames;
}

Example 5 

Example. Use the additional settings of the EntitySchemaQuery query.

UsingCacheExample method
public Collection<string> ESQOptionsExample()
{
    /* Create a query instance that has the City root schema. */
    var esqCities = new EntitySchemaQuery(UserConnection.EntitySchemaManager, "City");
    esqCities.AddColumn("Name");

    /* Create a query that has the Country root schema. */
    var esqCountries = new EntitySchemaQuery(UserConnection.EntitySchemaManager, "Country");
    esqCountries.AddColumn("Name");

    /* Create an instance of settings to return first 5 strings in the query. */
    var esqOptions = new EntitySchemaQueryOptions()
    {
        PageableDirection = PageableSelectDirection.First,
        PageableRowCount = 5,
        PageableConditionValues = new Dictionary<string, object>()
    };

    /* Retrieve the city collection that contains the first 5 cities of the resulting dataset. */
    var cities = esqCities.GetEntityCollection(UserConnection, esqOptions);

    /* Retrieve the country collection that contains the first 5 countries of the resulting dataset. */
    var countries = esqCountries.GetEntityCollection(UserConnection, esqOptions);
        var esqStringCollection = new Collection<string>();
    foreach (var entity in cities)
    {
        esqStringCollection.Add(entity.GetTypedColumnValue<string>("Name"));
    }
    foreach (var entity in countries)
    {
        esqStringCollection.Add(entity.GetTypedColumnValue<string>("Name"));
    }
    return esqStringCollection;
}
Manage the database entities
Advanced

Note. Examples 1-5 in this article are also implemented in the web service. The package that contains the web service implementation is attached in the Resources block.

Example 1 

Example. Retrieve the value of the City schema column whose name is Name.

GetEntityColumnData method
public string GetEntityColumnData()
{
    var result = "";
    /* Create a query to the City schema, add the Name column to the query. */
    var esqResult = new EntitySchemaQuery(UserConnection.EntitySchemaManager, "City");
    var colName = esqResult.AddColumn("Name");
    /* Run the database query and retrieve the object that has the set identifier. You can retrieve the object UId from the browser navigation bar after opening the section record page. */
    var entity = esqResult.GetEntity(UserConnection, new Guid("100B6B13-E8BB-DF11-B00F-001D60E938C6"));
    /* Retrieve the object column value. */
    result += entity.GetColumnValue(colName.Name).ToString();
    return result;
}

Example 2 

Example. Retrieve the name collection of the City schema columns.

GetEntityColumns method
public IEnumerable<string> GetEntityColumns()
{
    /* Create a data string object of the City schema based on the schema identifier retrieved from the database. */
    var entity = new Entity(UserConnection, new Guid("5CA90B6A-93E7-4448-BEFE-AB5166EC2CFE"));
    /* Retrieve the object that has the set identifier from the database. You can retrieve the object UId from the browser navigation bar after opening the section record page. */
    entity.FetchFromDB(new Guid("100B6B13-E8BB-DF11-B00F-001D60E938C6"),true);
    /* Retrieve the name collection of the object columns. */
    var result = entity.GetColumnValueNames();
    return result;
}

Example 3 

Example. Delete the Order schema records from the database.

DeleteEntity method
public bool DeleteEntity()
{
    /* Create a query to the Order schema, add all schema columns to the query. */
    var esqResult = new EntitySchemaQuery(UserConnection.EntitySchemaManager, "Order");
    esqResult.AddAllSchemaColumns();
    /* Run the database query and retrieve the object that has the set identifier. You can retrieve the object UId from the browser navigation bar after opening the section record page. */
    var entity = esqResult.GetEntity(UserConnection, new Guid("e3bfa32f-3fe9-4bae-9332-16c162c51e0d"));
    /* Delete the object from the database. */
    entity.Delete();
    /* Check if the object that has the set identifier exists in the database. */
    var result = entity.ExistInDB(new Guid("e3bfa32f-3fe9-4bae-9332-16c162c51e0d"));
    return result;
}

Example 4 

Example. Change the order status.

UpdateEntity method
public bool UpdateEntity()
{
    /* Create a query to the Order schema, add all schema columns to the query. */
    var esqResult = new EntitySchemaQuery(UserConnection.EntitySchemaManager, "Order");
    esqResult.AddAllSchemaColumns();
    /* Run the database query and retrieve the object that has the set identifier. You can retrieve the object UId from the browser navigation bar after opening the section record page. */
    var entity = esqResult.GetEntity(UserConnection, new Guid("58be5223-715d-4b16-a5c4-e3d4ec0412d9"));
    /* Create the data string object of the OrderStatus schema. */
    var statusSchema = UserConnection.EntitySchemaManager.GetInstanceByName("OrderStatus");
    var newStatus = statusSchema.CreateEntity(UserConnection);
    /* Retrieve the object that has the set identifier from the database. */
    newStatus.FetchFromDB("Name", "4. Completed");
    /* Assign the new value to the StatusId column. */
    entity.SetColumnValue("StatusId", newStatus.GetTypedColumnValue<Guid>("Id"));
    /* Save the modified object to the database. */
    var result = entity.Save();
    return result;
}

Example 5 

Example. Add the city that has the specified name and connect it to the specified country.

UpdateEntity method
public bool InsertEntity(string city, string country)
{
    city = city ?? "unknown city";
    country = country ?? "unknown country";
    var citySchema = UserConnection.EntitySchemaManager.GetInstanceByName("City");
    var entity = citySchema.CreateEntity(UserConnection);
    entity.FetchFromDB("Name", city);
    /* Set the default values for the object columns. */
    entity.SetDefColumnValues();
    var contryEntity = new Entity(UserConnection, new Guid("09FCE1F8-515C-4296-95CD-8CD93F79A6CF"));
    contryEntity.FetchFromDB("Name", country);
    /* Assign the passed city name to the Name column. */
    entity.SetColumnValue("Name", city);
    /* Assign the passed country UId to the CountryId column. */
    entity.SetColumnValue("CountryId", contryEntity.GetTypedColumnValue<Guid>("Id"));
    var result = entity.Save();
    return result;
}

Example 6 

Example. Create a contact that has the "User01" name.

EntitySchema contactSchema = UserConnection.EntitySchemaManager.GetInstanceByName("Contact");
Entity contactEntity = contactSchema.CreateEntity(UserConnection);
contactEntity.SetDefColumnValues();
contactEntity.SetColumnValue("Name", "User01");
contactEntity.Save();

Example 7 

Example. Change the contact name to "User02".

EntitySchema entitySchema = UserConnection.EntitySchemaManager.GetInstanceByName("Contact");
Entity entity = entitySchema.CreateEntity(UserConnection);
if (!entity.FetchFromDB(some_id) {
    return false;
}
entity.SetColumnValue("Name", "User02");
return entity.Save();

Example 8 

Example. Delete the contact that has the "User02" name.

EntitySchema entitySchema = UserConnection.EntitySchemaManager.GetInstanceByName("Contact");
Entity entity = entitySchema.CreateEntity(UserConnection);
var fetchConditions = new Dictionary<string, object> {
    {"Name", "User02"}
};
if (entity.FetchFromDB(fetchConditions)) {
    entity.Delete();
}
EntitySchemaQuery class
Advanced

EntitySchemaQuery class 

Terrasoft.Core.Entities namespace.

The Terrasoft.Core.Entities.EntitySchemaQuery class is used to build queries for selecting records in Creatio database tables. As a result of creating and configuring the instance of this class, the SELECT SQL-expression query to the application database will be built. You can add the needed columns, filters, and restriction conditions to the query.

Note. Use the .NET classes reference to access the full list of the methods, properties, parent classes, and implemented interfaces of the EntitySchemaQuery class.

Constructors 

public EntitySchemaQuery(EntitySchema rootSchema)

Creates a class instance, where the EntitySchema passed instance is set as a root schema. The manager of the passed-in instance of the root schema is set as the schema manager.

public EntitySchemaQuery(EntitySchemaManager entitySchemaManager, string sourceSchemaName)

Creates a class instance with the specified EntitySchemaManager and the root schema passed as an argument.

public EntitySchemaQuery(EntitySchemaQuery source)

Creates a class instance that is a clone of the instance passed as an argument.

Properties 

Cache Terrasoft.Core.Store.ICacheStore

The query cache.

CacheItemName string

Name of the cache item.

CanReadUncommitedData bool

Determines whether the query results will include the data for which the transaction is not completed.

Caption Terrasoft.Common.LocalizableString

Title.

ChunkSize int

The number of strings in one chunk.

Columns Terrasoft.Core.Entities.EntitySchemaQueryColumnCollection

Collection of columns of the current entity schema query.

DataValueTypeManager DataValueTypeManager

Manager of the data type values.

EntitySchemaManager Terrasoft.Core.Entities.EntitySchemaManager

Entity schema manager.

Filters Terrasoft.Core.Entities.EntitySchemaQueryFilterCollection

Collection of filters of the current entity schema query.

HideSecurityValue bool

Determines whether the values of the encrypted columns will be hidden.

IgnoreDisplayValues bool

Determines whether the displayed column values will be used in the query.

IsDistinct bool

Indicates whether duplicates in the resulting data set should be removed.

IsInherited bool

Indicates whether the query is inherited.

JoinRightState QueryJoinRightLevel

Determines the conditions for applying permissions when using related tables if the schema is managed by records.

Manager Terrasoft.Core.IManager

Schema manager.

ManagerItem Terrasoft.Core.IManagerItem

Manager element.

Name string

Name.

ParentCollection Terrasoft.Core.Entities.EntitySchemaQueryCollection

A collection of queries to which the current request to the object schema belongs.

ParentEntitySchema Terrasoft.Core.Entities.EntitySchema

Parent schema of the query.

PrimaryQueryColumn Terrasoft.Core.Entities.EntitySchemaQueryColumn

The column created from the primary column of the root schema. Initialized during the first access.

QueryOptimize bool

Allows using query optimization.

RootSchema Terrasoft.Core.Entities.EntitySchema

The root schema.

RowCount int

Number of rows that are returned by the query.

SchemaAliasPrefix string

The prefix used to create schema alias.

SkipRowCount int

Number of rows to skip when returning the query result.

UseAdminRights bool

The parameter that defines whether permissions will be taken into account when constructing a data acquisition request.

UseLocalization bool

Determines whether localizable data will be used.

UseOffsetFetchPaging bool

Determines whether the per-page returning of the query result is available.

UseRecordDeactivation bool

Determines whether data will be excluded from filtering.

Methods 

void AddAllSchemaColumns(bool skipSystemColumns)

The object schema adds all the columns of the root schema in the column collection of the current query.

EntitySchemaQueryColumn AddColumn(string columnPath, AggregationTypeStrict aggregationType, out EntitySchemaQuery subQuery)
void AddColumn(EntitySchemaQueryColumn queryColumn)
EntitySchemaQueryColumn AddColumn(string columnPath)
EntitySchemaQueryColumn AddColumn(EntitySchemaQueryFunction function)
EntitySchemaQueryColumn AddColumn(object parameterValue, DataValueType parameterDataValueType)
EntitySchemaQueryColumn AddColumn(EntitySchemaQuery subQuery)

Creates and inserts a column in the current entity schema query.

Parameters
columnPath Path to the schema column in relation to the root schema.
aggregationType The type of the aggregate function. The enumeration type values of the Terrasoft.Common.AggregationTypeStrict aggregate function are passed as a parameter.
subQuery Reference to the created subquery placed in the column.
queryColumn An EntitySchemaQueryColumn instance to be added to the column collection of the current query.
function An EntitySchemaQueryFunction function instance.
parameterValue The value of the parameter added to the query as a column.
parameterDataValueType The type of parameter value added to the query as a column.
void ClearCache()

Clears the cache of the current query.

static void ClearDefCache(string cacheItemName)

Removes the item with the specified cacheItemName name from the cache of the query.

object Clone()

Creates a clone of the current EntitySchemaQuery instance.

EntitySchemaQueryExpression CreateAggregationEntitySchemaExpression(string leftExprColumnPath, AggregationTypeStrict leftExprAggregationType)

Returns expression of the aggregated function with the specified aggregation type from the Terrasoft.Common.AggregationTypeStrict enumeration for the column, located at the leftExprColumnPath specified path.

static EntitySchemaQueryExpression CreateParameterExpression(object parameterValue)
static EntitySchemaQueryExpression CreateParameterExpression(object parameterValue, DataValueType valueType)
static EntitySchemaQueryExpression CreateParameterExpression(object parameterValue, string displayValue, DataValueType valueType)

Creates an expression for the query parameter.

Parameters
parameterValue The value of the parameter.
valueType The type of the parameter value.
displayValue Parameter displayed value.
static IEnumerable CreateParameterExpressions(DataValueType valueType, params object[] parameterValues)
static IEnumerable CreateParameterExpressions(DataValueType valueType, IEnumerable<object> parameterValues)

Creates an expression collection for the query parameters with a certain DataValueType type of data.

static EntitySchemaQueryExpression CreateSchemaColumnExpression(EntitySchemaQuery parentQuery, EntitySchema rootSchema, string columnPath, bool useCoalesceFunctionForMultiLookup, bool useDisplayValue)
static EntitySchemaQueryExpression CreateSchemaColumnExpression(EntitySchema rootSchema, string columnPath, bool useCoalesceFunctionForMultiLookup)
EntitySchemaQueryExpression CreateSchemaColumnExpression(string columnPath, bool useCoalesceFunctionForMultiLookup)

Returns the expression of the entity schema column.

Parameters
parentQuery The entity schema query for which the column expression is created.
rootSchema The root schema.
columnPath The path to column in relation to the root schema.
useCoalesceFunctionForMultiLookup Indicates whether to use the COALESCE function for the column of the lookup type. An optional parameter, set to true by default.
useDisplayValue Indicates whether to use the displayed value for the column. An optional parameter, set to false by default.
Enumerable CreateSchemaColumnExpressions(params string[] columnPaths)
IEnumerable CreateSchemaColumnExpressions(IEnumerable columnPaths, bool useCoalesceFunctionForMultiLookup)

Returns a collection of column expressions of the entity schema query by the specified columnPaths collection of paths to columns.

IEnumerable CreateSchemaColumnExpressionsWithoutCoalesce(params string[] columnPaths)

Returns the collection of column expressions of the entity schema query by the specified array of paths to columns. If it is a column of the multilookup type, the COALESCE function is not used for its values.

static EntitySchemaQueryExpression CreateSchemaColumnQueryExpression(string columnPath, EntitySchema rootSchema, EntitySchemaColumn schemaColumn, bool useDisplayValue)
static EntitySchemaQueryExpression CreateSchemaColumnQueryExpression(string columnPath, EntitySchema rootSchema, bool useDisplayValue)

Returns the expression of the entity schema query by the specified path to column, root schema and schema column instance. You can define which column value type to use in the expression – either the stored value or the displayed value.

EntitySchemaQueryExpression CreateSubEntitySchemaExpression(string leftExprColumnPath)

Returns the expression of entity schema subquery for the column located at the specified leftExprColumnPath path.

EntitySchemaAggregationQueryFunction CreateAggregationFunction(AggregationTypeStrict aggregationType, string columnPath)

Returns the EntitySchemaAggregationQueryFunction aggregation function instance with the specified type of aggregation from the Terrasoft.Common.AggregationTypeStrict enumeration for the column at the specified columnPath path in relation to the root schema.

EntitySchemaCaseNotNullQueryFunction CreateCaseNotNullFunction(params EntitySchemaCaseNotNullQueryFunctionWhenItem[] whenItems)

Returns an instance of the CASE EntitySchemaCaseNotNullQueryFunction function for the specified EntitySchemaCaseNotNullQueryFunctionWhenItem array of condition expressions.

EntitySchemaCaseNotNullQueryFunctionWhenItem CreateCaseNotNullQueryFunctionWhenItem(string whenColumnPath, object thenParameterValue)

Returns an instance of an expression for the sql construct of the WHEN <Expression_1> IS NOT NULL THEN <Expression_2> form.

Parameters
whenColumnPath Path to the column that contains the expression of the WHEN clause.
thenParameterValue Path to the column that contains the expression of the THEN clause.
EntitySchemaCastQueryFunction CreateCastFunction(string columnPath, DBDataValueType castType)

Returns an instance of the CAST EntitySchemaCastQueryFunction function for the column expression located at the specified columnPath path relative to the root schema and the specified DBDataValueType target data type.

EntitySchemaCoalesceQueryFunction CreateCoalesceFunction(params string[] columnPaths)
static EntitySchemaCoalesceQueryFunction CreateCoalesceFunction(EntitySchemaQuery parentQuery, EntitySchema rootSchema, params string[] columnPaths)
static EntitySchemaCoalesceQueryFunction CreateCoalesceFunction(EntitySchema rootSchema, params string[] columnPaths)

Returns the function instance returning the first expression that is other than null from the list of arguments for the specified columns.

Parameters
columnPaths An array of paths to columns in relation to the root schema.
parentQuery A query to entity schema, for which the function instance is created.
rootSchema The root schema.
EntitySchemaConcatQueryFunction CreateConcatFunction(params EntitySchemaQueryExpression[] expressions)

Returns a function instance for generating a string that is the result of combining the string values of function arguments for the specified EntitySchemaQueryExpression array of expressions.

EntitySchemaDatePartQueryFunction CreateDatePartFunction(EntitySchemaDatePartQueryFunctionInterval interval, string columnPath)

Returns a DATEPART instance of the EntitySchemaDatePartQueryFunction function that determines the date interval specified by the EntitySchemaDatePartQueryFunctionInterval enumeration (month, day, hour, year, week day...) for the value of column located at the specified path in relation to the root schema.

EntitySchemaDatePartQueryFunction CreateDayFunction(string columnPath)

Returns an instance of the EntitySchemaDatePartQueryFunction function that determines the Day date range for a column value located at the specified path in relation to the root schema.

EntitySchemaDatePartQueryFunction CreateHourFunction(string columnPath)

Returns an instance of the EntitySchemaDatePartQueryFunction function that returns a part of the Hour date for a column value located at the specified path in relation to the root schema.

EntitySchemaDatePartQueryFunction CreateHourMinuteFunction(string columnPath)

Returns an instance of the EntitySchemaDatePartQueryFunction function that returns a part of the Minute date for a column value located at the specified path in relation to the root schema.

EntitySchemaDatePartQueryFunction CreateMonthFunction(string columnPath)

Returns an instance of the EntitySchemaDatePartQueryFunction function that returns a part of the Month date for a column value located at the specified path in relation to the root schema.

EntitySchemaDatePartQueryFunction CreateWeekdayFunction(string columnPath)

Returns an instance of the EntitySchemaDatePartQueryFunction function that returns a part of the Week day date for a column value located at the specified path in relation to the root schema.

EntitySchemaDatePartQueryFunction CreateWeekFunction(string columnPath)

Returns an instance of the EntitySchemaDatePartQueryFunction function that returns a part of the Week date for a column value located at the specified path in relation to the root schema.

EntitySchemaDatePartQueryFunction CreateYearFunction(string columnPath)

Returns an instance of the EntitySchemaDatePartQueryFunction function that returns a part of the Year date for a column value located at the specified path in relation to the root schema.

EntitySchemaIsNullQueryFunction CreateIsNullFunction(string checkColumnPath, string replacementColumnPath)

Returns the instance of the EntitySchemaIsNullQueryFunction function for columns with values to check and substitute located at specified paths in relation to the root schema.

EntitySchemaLengthQueryFunction CreateLengthFunction(string columnPath)
EntitySchemaLengthQueryFunction CreateLengthFunction(params EntitySchemaQueryExpression[] expressions)

Creating an instance of the LEN function (the function for returning the length of expression) for the column expression at the specified path in relation to the root schema or for the specified expression array.

EntitySchemaTrimQueryFunction CreateTrimFunction(string columnPath)
EntitySchemaTrimQueryFunction CreateTrimFunction(params EntitySchemaQueryExpression[] expressions)

Creating an instance of the TRIM function (the function for removing all leading and trailing whitespace from expression) for the column expression at the specified path in relation to the root schema or for the specified expression array.

EntitySchemaUpperQueryFunction CreateUpperFunction(string columnPath)

Returns an instance of the EntitySchemaUpperQueryFunction function that converts all the argument expression characters into upper case. The column expression located at the specified path relative to the root schema is specified as the argument.

EntitySchemaCurrenddateQueryFunction CreateCurrenddateFunction()

Returns an instance of the EntitySchemaCurrentDateQueryFunction function that defines the current date.

EntitySchemaCurrenddateTimeQueryFunction CreateCurrenddateTimeFunction()

Returns an instance of the EntitySchemaCurrentDateTimeQueryFunction function that returns the current date and time.

EntitySchemaCurrentTimeQueryFunction CreateCurrentTimeFunction()

Returns the instance of the EntitySchemaCurrentTimeQueryFunction function that defines the current time.

EntitySchemaCurrentUserAccountQueryFunction CreateCurrentUserAccountFunction()

Returns the instance of the EntitySchemaCurrentUserAccountQueryFunction function that defines the account Id of the current user.

EntitySchemaCurrentUserContactQueryFunction CreateCurrentUserContactFunction()

Returns the instance of the EntitySchemaCurrentUserContactQueryFunction function that defines the contact Id of the current user.

EntitySchemaCurrentUserQueryFunction CreateCurrentUserFunction()

Returns the instance of the EntitySchemaCurrentUserQueryFunction function that defines the current user.

EntitySchemaQueryFilter CreateExistsFilter(string rightExpressionColumnPath)

Creates the Exists by the specified condition type comparison filter and sets the column expression located at the rightExpressionColumnPath specified path as the testing value.

IEntitySchemaQueryFilterItem CreateFilter(FilterComparisonType comparisonType, string leftExpressionColumnPath, params string[] rightExpressionColumnPaths)
IEntitySchemaQueryFilterItem CreateFilter(FilterComparisonType comparisonType, string leftExpressionColumnPath, EntitySchemaQueryExpression rightExpression)
IEntitySchemaQueryFilterItem CreateFilter(FilterComparisonType comparisonType, string leftExpressionColumnPath, EntitySchemaQueryFunction rightExpressionValue)
IEntitySchemaQueryFilterItem CreateFilter(FilterComparisonType comparisonType, EntitySchemaQueryExpression leftExpression, EntitySchemaQueryMacrosType macrosType, int rightValue)
IEntitySchemaQueryFilterItem CreateFilter(FilterComparisonType comparisonType, EntitySchemaQueryExpression leftExpression, EntitySchemaQueryMacrosType macrosType, DateTime rightValue)
IEntitySchemaQueryFilterItem CreateFilter(FilterComparisonType comparisonType, EntitySchemaQueryExpression leftExpression, EntitySchemaQueryMacrosType macrosType, DayOfWeek rightValue)
IEntitySchemaQueryFilterItem CreateFilter(FilterComparisonType comparisonType, string leftExpressionColumnPath, EntitySchemaQueryMacrosType macrosType, int rightValue)
IEntitySchemaQueryFilterItem CreateFilter(FilterComparisonType comparisonType, string leftExpressionColumnPath, EntitySchemaQueryMacrosType macrosType, DateTime rightValue)
IEntitySchemaQueryFilterItem CreateFilter(FilterComparisonType comparisonType, string leftExpressionColumnPath, EntitySchemaQueryMacrosType macrosType, DayOfWeek rightValue)
IEntitySchemaQueryFilterItem CreateFilter(FilterComparisonType comparisonType, string leftExpressionColumnPath, EntitySchemaQuery rightExpressionValue)
EntitySchemaQueryFilter CreateFilter(FilterComparisonType comparisonType, string leftExprColumnPath, AggregationTypeStrict leftExprAggregationType, int rightExprParameterValue)
EntitySchemaQueryFilter CreateFilter(FilterComparisonType comparisonType, string leftExprColumnPath, AggregationTypeStrict leftExprAggregationType, double rightExprParameterValue)
EntitySchemaQueryFilter CreateFilter(FilterComparisonType comparisonType, string leftExprColumnPath, AggregationTypeStrlict leftExprAggregationType, DateTime rightExprParameterValue)
EntitySchemaQueryFilter CreateFilter(FilterComparisonType comparisonType, string leftExprColumnPath, AggregationTypeStrict leftExprAggregationType, string rightExprParameterValue)
EntitySchemaQueryFilter CreateFilter(FilterComparisonType comparisonType, string leftExprColumnPath, AggregationTypeStrict leftExprAggregationType, object rightExprParameterValue, out EntitySchemaQuery leftExprSubQuery)
IEntitySchemaQueryFilterItem CreateFilter(FilterComparisonType comparisonType, string leftExprColumnPath, AggregationTypeStrict leftExprAggregationType, EntitySchemaQueryMacrosType macrosType, int daysCount)
IEntitySchemaQueryFilterItem CreateFilter(FilterComparisonType comparisonType, string leftExprColumnPath, AggregationTypeStrict leftExprAggregationType, EntitySchemaQueryMacrosType macrosType, out EntitySchemaQuery leftExprSubQuery, int daysCount)

Creates a query filter for selecting records according to specified conditions.

Parameters
comparisonType A comparison type from the Terrasoft.Core.Entities.FilterComparisonType enumeration.
leftExpressionColumnPath A path to the column that contains the filter's left side expression.
leftExpression An expression in the filter's left side.
leftExprAggregationType The type of the aggregate function.
leftExprSubQuery A parameter that returns a subquery for the expression on the left side of the filter (if it is not null) or a subquery for the first expression on the right side of the filter (if the left-hand side of the filter is null).
rightExpressionColumnPaths An array of paths that contain the filter's right side expressions.
rightExpression The expression in the filter's right side.
rightExpressionValue An instance of the expression function on the right side of the filter (the EntitySchemaQueryFunction parameter type) or a subquery expression on the right side of the filter (the EntitySchemaQuery parameter type).
rightValue The value processed by the macro in the filter's right side.
rightExprParameterValue The value of the parameter to which the filter's right side aggregate function is applied.
macrosType A type of macro from the Terrasoft.Core.Entities.EntitySchemaQueryMacrosType enumeration.
daysCount The value to which the filter's right side macro is applied. An optional parameter, default value is 0.
IEntitySchemaQueryFilterItem CreateFilterWithParameters(FilterComparisonType comparisonType, bool useDisplayValue, string leftExpressionColumnPath, params object[] rightExpressionParameterValues)
IEntitySchemaQueryFilterItem CreateFilterWithParameters(FilterComparisonType comparisonType, string leftExpressionColumnPath, params object[] rightExpressionParameterValues)
IEntitySchemaQueryFilterItem CreateFilterWithParameters(FilterComparisonType comparisonType, string leftExpressionColumnPath, IEnumerable<object> rightExpressionParameterValues, bool useDisplayValue)
static IEntitySchemaQueryFilterItem CreateFilterWithParameters(EntitySchemaQuery parentQuery, EntitySchema rootSchema, FilterComparisonType comparisonType, bool useDisplayValue, string leftExpressionColumnPath, params object[] rightExpressionParameterValues)
static IEntitySchemaQueryFilterItem CreateFilterWithParameters(EntitySchema rootSchema, FilterComparisonType comparisonType, bool useDisplayValue, string leftExpressionColumnPath, params object[] rightExpressionParameterValues)

Creates a parameter filter for selecting records according to specified conditions.

Parameters
parentQuery The parent query for which the filter is being created.
rootSchema The root schema.
comparisonType A comparison type from the Terrasoft.Core.Entities.FilterComparisonType enumeration.
useDisplayValue Whether the column value type used in the filter:true – for the displayed value; false – for the stored value.
leftExpressionColumnPath A path to the column that contains the filter's left side expression.
rightExpressionParameterValues The collection of parameter expressions on the right side of the filter.
IEntitySchemaQueryFilterItem CreateIsNotNullFilter(string leftExpressionColumnPath)

Creates the comparison filter of the Is not “null” in database type and, as the tested value, sets the column expression located at the path specified in the leftExpressionColumnPath parameter.

IEntitySchemaQueryFilterItem CreateIsNullFilter(string leftExpressionColumnPath)

Creates the comparison filter of the Is “null” in database type and, as the testing condition, sets the column expression located at the path specified in the leftExpressionColumnPath parameter.

EntitySchemaQueryFilter CreateNotExistsFilter(string rightExpressionColumnPath)

Creates the Does not exist by the specified condition type comparison filter and sets the column expression located at the rightExpressionColumnPath specified path as the tested value.

DataTable GetDataTable(UserConnection userConnection)

Returns the result of the current query execution to the object schema as a data table in memory using UserConnection.

static int GetDayOfWeekNumber(UserConnection userConnection, DayOfWeek dayOfWeek)

Returns the sequence number of the week day for the System.DayOfWeek entity taking into account local settings.

Entity GetEntity(UserConnection userConnection, object primaryColumnValue)

Returns an Entity instance by the primaryColumnValue primary key using UserConnection.

EntityCollection GetEntityCollection(UserConnection userConnection, EntitySchemaQueryOptions options)
EntityCollection GetEntityCollection(UserConnection userConnection)

Returns the Entity instance collection representing the results of executing the current query using UserConnection and the specified additional EntitySchemaQueryOptions query settings.

EntitySchema GetSchema()

Returns the EntitySchema entity schema instance of the current EntitySchemaQuery instance.

Select GetSelectQuery(UserConnection userConnection)
Select GetSelectQuery(UserConnection userConnection, EntitySchemaQueryOptions options)

Returns a data selection query instance using UserConnection and the specified additional settings of the EntitySchemaQueryOptions query.

EntitySchemaQueryColumnCollection GetSummaryColumns()
EntitySchemaQueryColumnCollection GetSummaryColumns(IEnumerable<string> columnNames)

Returns the collection of expressions of the query columns for which total values are calculated.

Entity GetSummaryEntity(UserConnection userConnection, EntitySchemaQueryColumnCollection summaryColumns)
Entity GetSummaryEntity(UserConnection userConnection)
Entity GetSummaryEntity(UserConnection userConnection, IEnumerable<string> columnNames)
Entity GetSummaryEntity(UserConnection userConnection, params string[] columnNames)

Returns an Entity instance for the result returned by the total value selection query.

Parameters
userConnection The user connection.
summaryColumns The collection of query columns for which totals are selected.
columnNames A collection of the column names.
Select GetSummarySelectQuery(UserConnection userConnection, EntitySchemaQueryColumnCollection summaryColumns)
Select GetSummarySelectQuery(UserConnection userConnection)
Select GetSummarySelectQuery(UserConnection userConnection, IEnumerable<string> columnNames)
Select GetSummarySelectQuery(UserConnection userConnection, params string[] columnNames)

Builds a query for the selection of total values for a specified column collection of the EntitySchemaQuery current instance.

Parameters
userConnection The user connection.
summaryColumns The collection of query columns for which totals are selected.
columnNames A collection of the column names.
T GetTypedColumnValue(Entity entity, string columnName)

Returns the typed column value with columnName from the Entity passed instance.

void LoadDataTableData(UserConnection userConnection, DataTable dataTable)
void LoadDataTableData(UserConnection userConnection, DataTable dataTable, EntitySchemaQueryOptions options)

Loads the result of executing the current query to the entity schema into the System.Data.DataTable entity using UserConnection and the EntitySchemaQueryOptions specified additional query settings.

void RemoveColumn(string columnName)

Removes the columnName column from the current query column collection.

void ResetSchema()

Clears the schema of the EntitySchemaQuery current instance.

void ResetSelectQuery()

Clears the select query for the current entity schema query.

void SetLocalizationCultureId(System.Guid cultureId)

Sets the identifier of the local culture.

Entity class
Advanced

Terrasoft.Core.Entities namespace.

The Terrasoft.Core.Entities.Entity class provides access to an entity that represents a record in the database table.

Note. View the entire list of methods and properties of the Entity class, its parent classes, as well as the interfaces it implements, in the .NET classes reference.

Constructors 

Entity(UserConnection userConnection)

Creates a new Entity class instance for the set UserConnection user connection.

Entity(UserConnection userConnection, Guid schemaUId)

Creates a new Entity class instance for the set UserConnection user connection and the schema set by the schemaUId identifier.

Entity(Entity source)

Creates a class instance that is a clone of the instance passed as an argument.

Properties 

ChangeType EntityChangeType

The type of entity status change (added, modified, deleted, unchanged).

EntitySchemaManager EntitySchemaManager

An instance of the entity schema manager.

EntitySchemaManagerName string

The name of the entity schema manager.

HasColumnValues bool

Whether an entity has at least one column.

HierarchyColumnValue Guid

The value of the column that binds the parent record, for hierarchical entities.

InstanceUId Guid

The object instance identifier.

IsDeletedFromDB bool

Whether the object is deleted from the database.

IsInColumnValueChanged bool

Whether to handle the ColumnValueChanged event.

IsInColumnValueChanging bool

Whether to handle the ColumnValueChanging event.

IsInDefColumnValuesSet bool

Whether to handle the DefColumnValuesSet event.

IsInDeleted bool

Whether to handle the Deleted event.

IsInDeleting bool

Whether to handle the Deleting event.

IsInInserted bool

Whether to handle the Inserted event.

IsInInserting bool

Whether to handle the Inserting event.

IsInLoaded bool

Whether to hanlde the Loaded event.

IsInLoading bool

Whether to handle the Loading event.

IsInSaved bool

Whether to handle the Saved event.

IsInSaveError bool

Whether to handle the SaveError event.

IsInSaving bool

Whether to handle the Saving event.

IsInUpdated bool

Whether to handle the Updated event.

IsInUpdating bool

Whether to handle the Updating event.

IsInValidating bool

Whether to handle the Validating event.

IsSchemaInitialized bool

Whether the entity schema is initialized.

LicOperationPrefix string

The prefix of the operation to license.

LoadState EntityLoadState

The object load state.

PrimaryColumnValue Guid

The ID of the initial column.

PrimaryDisplayColumnValue string

The value to display in the initial column.

Process Process

The nested process of the entity.

Schema EntitySchema

An instance of the entity schema.

SchemaName string

The entity schema name.

StoringState StoringObjectState

The entity status (modified, added, deleted, unchanged).

UseAdminRights bool

Whether to apply permissions when inserting, updating, deleting, and retrieving data.

UseDefRights bool

Whether to use the default entity permissions.

UseLazyLoad bool

Whether to use the lazy initial loading of entity data.

UserConnection UserConnection

The user connection.

ValidationMessages EntityValidationMessageCollection

The message collection displayed when validating an entity.

ValueListSchemaManager ValueListSchemaManager

An instance of the entity enumerations manager.

ValueListSchemaManagerName string

The name of the entity enumerations manager.

Methods 

void AddDefRights()
void AddDefRights(Guid primaryColumnValue)
void AddDefRights(IEnumerable<Guid> primaryColumnValues)

Sets the default permissions for the entity.

Parameters
primaryColumnValue The ID of the access permission value.
primaryColumnValues An array of IDs of the access permission values.
virtual object Clone()

Creates a clone of the current Entity instance.

Insert CreateInsert(bool skipLookupColumnValues)

Creates a query to add data to the database.

Parameters
skipLookupColumnValues Whether to take the lookup columns into account while adding data. By default, false.
Update CreateUpdate(bool skipLookupColumnValues)

Creates a query to update data in the database.

Parameters
skipLookupColumnValues Whether to add the columns of the lookup type to the database. If set to true, Creatio will not add the columns of the lookup type to the database. By default, false.
virtual bool Delete()
virtual bool Delete(object keyValue)

Deletes the entity record from the database.

Parameters
keyValue The key field value.
bool DeleteWithCancelProcess()

Deletes the entity record from the database and cancels the started process.

static Entity DeserializeFromJson(UserConnection userConnection, string jsonValue)

Creates an Entity type entity using the userConnection user connection and populates the entity field values from the specified jsonValue JSON string.

Parameters
jsonValue A JSON string.
userConnection The user connection.
bool ExistInDB(EntitySchemaColumn conditionColumn, object conditionValue)
bool ExistInDB(string conditionColumnName, object conditionValue)
bool ExistInDB(object keyValue)
bool ExistInDB(Dictionary<string,object> conditions)

Whether the database contains a record that matches the given condition of the conditionValue query to the conditionColumn entity schema column or with the specified keyValue initial key.

Parameters
conditionColumn The column for which to specify the selection condition.
conditionColumnName The name of the column for which to specify the selection condition.
conditionValue The value of the condition column for the selected data.
conditions A set of conditions to filter the object record selection.
keyValue The key field value.
bool FetchFromDB(EntitySchemaColumn conditionColumn, object conditionValue, bool useDisplayValues)
bool FetchFromDB(string conditionColumnName, object conditionValue, bool useDisplayValues)
bool FetchFromDB(object keyValue, bool useDisplayValues)
bool FetchFromDB(Dictionary<string,object> conditions, bool useDisplayValues)
bool FetchFromDB(EntitySchemaColumn conditionColumn, object conditionValue, IEnumerable<EntitySchemaColumn> columnsToFetch, bool useDisplayValues)
bool FetchFromDB(string conditionColumnName, object conditionValue, IEnumerable<string>columnNamesToFetch, bool useDisplayValues)

Loads the object from the database by the specified condition.

Parameters
conditionColumn The column for which to specify the selection condition.
conditionColumnName The name of the column for which to specify the selection condition.
conditionValue The value of the condition column for the selected data.
columnsToFetch The list of columns to select.
columnNamesToFetch The list of column names to select.
conditions A set of conditions to filter the object record selection.
keyValue The key field value.
useDisplayValues Indicates that the query returns the initial displayed values. If set to true, the query will return the initial displayed values.
bool FetchPrimaryColumnFromDB(object keyValue)

Loads the object with the initial column from the database by the set keyValue condition.

Parameters
keyValue The key field value.
bool FetchPrimaryInfoFromDB(EntitySchemaColumn conditionColumn, object conditionValue)
bool FetchPrimaryInfoFromDB(string conditionColumnName, object conditionValue)

Loads a database object with initial columns, including the initial displayed column, by the set condition.

Parameters
conditionColumn The column for which to specify the selection condition.
conditionColumnName The name of the column for which to specify the selection condition.
conditionValue The value of the condition column for the selected data.
byte[] GetBytesValue(string valueName)

Returns the value of the specified entity column as a byte array.

Parameters
valueName The name of the entity column.
IEnumerable<EntityColumnValue> GetChangedColumnValues()

Returns the name collection of the object properties that were modified.

string GetColumnDisplayValue(EntitySchemaColumn column)

Returns the value for the display of the object property that matches the specified entity schema column.

Parameters
column A specific entity schema column.
object GetColumnOldValue(string valueName)
object GetColumnOldValue(EntitySchemaColumn column)

Returns the previous value of the specified entity property.

Parameters
column A specific entity schema column.
valueName The name of the entity column.
virtual object GetColumnValue(string valueName)
virtual object GetColumnValue(EntitySchemaColumn column)

Returns the value of the entity column with the specified name that matches the passed entity schema column.

Parameters
column A specific entity schema column.
valueName The name of the entity column.
IEnumerable<string> GetColumnValueNames()

Returns the collection of entity column names.

virtual bool GetIsColumnValueLoaded(string valueName)
bool GetIsColumnValueLoaded(EntitySchemaColumn column)

Returns the flag that determines whether the specified entity property is loaded.

Parameters
column A specific entity schema column.
valueName The name of the entity column.
virtual MemoryStream GetStreamValue(string valueName)

Returns the value of the passed entity schema column converted into the System.IO.MemoryStream type instance.

Parameters
valueName The name of the entity column.
TResult GetTypedColumnValue<TResult>(EntitySchemaColumn column)

Returns the typed value of the entity property that matches the specified column of the entity schema.

Parameters
column A specific entity schema column.
TResult GetTypedOldColumnValue<TResult>(string valueName)
TResult GetTypedOldColumnValue<TResult>(EntitySchemaColumn column)

Returns the typed previous value of the entity property that matches the specified column of the entity schema.

Parameters
column A specific entity schema column.
valueName The name of the entity column.
virtual bool InsertToDB(bool skipLookupColumnValues, bool validateRequired)

Adds a record of the current entity to the database.

Parameters
skipLookupColumnValues Whether to add the columns of the lookup type to the database. If set to true, Creatio will not add the columns of the lookup type to the database. By default, false.
validateRequired Whether to validate the required values. By default, true.
bool IsColumnValueLoaded(string valueName)
bool IsColumnValueLoaded(EntitySchemaColumn column)

Whether the value of the entity property with the specified name is loaded.

Parameters
column A specific entity schema column.
valueName The name of the entity column.
virtual bool Load(DataRow dataRow)
virtual bool Load(DataRow dataRow, Dictionary<string,string> columnMap)
virtual bool Load(IDataReader dataReader)
virtual bool Load(IDataReader dataReader, IDictionary<string,string> columnMap)
virtual bool Load(object dataSource)
virtual bool Load(object dataSource, IDictionary<string,string> columnMap)

Populates the entity with the passed data.

Parameters
columnMap The entity properties to populate with data.
dataRow A System.Data.DataRow instance from which to load the data to the entity.
dataReader A System.Data.IDataReader instance from which to load the data to the entity.
dataSource A System.Object instance from which to load the data to the entity.
void LoadColumnValue(string columnValueName, IDataReader dataReader, int fieldIndex, int binaryPackageSize)
void LoadColumnValue(string columnValueName, IDataReader dataReader, int fieldIndex)
void LoadColumnValue(string columnValueName, object value)
void LoadColumnValue(EntitySchemaColumn column, object value)

Loads the value from the passed instance for the property with the specified name.

Parameters
binaryPackageSize The size of the loaded value.
column The entity schema column.
columnValueName The entity property name.
dataReader A System.Data.IDataReader instance from which to load the property value.
fieldIndex The index of the field loaded from System.Data.IDataReader.
value The loaded value of the property.
static Entity Read(UserConnection userConnection, DataReader dataReader)

Returns the current property value of the Entity type from the input stream.

Parameters
dataReader A System.Data.IDataReader instance from which to load the property value.
userConnection The user connection.
void ReadData(DataReader reader)
void ReadData(DataReader reader, EntitySchema schema)

Reads data from the entity schema and saves the data to the specified object of the System.Data.IDataReader type.

Parameters
reader A System.Data.IDataReader instance to which to load the entity schema data.
schema The entity schema.
void ResetColumnValues()

Cancels the changes for all entity properties.

void ResetOldColumnValues()

Reverts all entity properties to previous values.

bool Save(bool validateRequired)

Saves the entity to the database.

Parameters
validateRequired Whether to validate the required values. By default, true.
static string SerializeToJson(Entity entity)

Converts the entity object into a JSON string.

Parameters
entity The Entity instance.
virtual void SetBytesValue(string valueName, byte[] streamBytes)

Sets the specified entity property to the passed value of the System.Byte type.

Parameters
streamBytes A value of the System.Byte type set for the specified entity column.
valueName The name of the entity column.
bool SetColumnBothValues(EntitySchemaColumn column, object value, string displayValue)
bool SetColumnBothValues(string columnValueName, object value, string displayColumnValueName, string displayValue)

Sets the entity property that matches the specified schema column to passed value and displayValue.

Parameters
column The entity schema column.
displayValue The loaded value for display.
displayColumnValueName The name of the column that contains the value for display.
value The loaded value of the column.
bool SetColumnValue(string valueName, object value)
bool SetColumnValue(EntitySchemaColumn column, object value)

Sets the specified schema column to the passed value.

Parameters
column The entity schema column.
value The loaded value of the column.
valueName The name of the entity column.
void SeddefColumnValue(string columnValueName, object defValue)
void SeddefColumnValue(string columnValueName)

Sets the property with the specified name to the default value.

Parameters
columnValueName The name of the entity column.
defValue The default value.
void SeddefColumnValues()

Sets default values for all entity properties.

bool SetStreamValue(string valueName, Stream value)

Sets the specified entity property to the passed value of the System.IO.Stream type.

Parameters
value The loaded value of the column.
valueName The name of the entity column.
virtual bool UpdateInDB(bool validateRequired)

Updates the entity record in the database.

Parameters
validateRequired Whether to validate the required values. By default, true.
bool Validate()

Verifies if the required fields are populated.

static void Write(DataWriter dataWriter, Entity entity, string propertyName)
static void Write(DataWriter dataWriter, Entity entity, string propertyName, bool couldConvertForXml)

Writes the value of the Entity type to the output stream with the specified name.

Parameters
couldConvertForXml Allow converting for XML serialization.
dataWriter An instance of the Terrasoft.Common.DataWriter class that provides methods for writing values to the output stream sequentially.
entity A value for a record of the Entity type.
propertyName The entity name.
void Write(DataWriter dataWriter, string propertyName)

Writes the data to the output stream with the specified name.

Parameters
dataWriter An instance of the Terrasoft.Common.DataWriter class that provides methods for writing values to the output stream sequentially.
propertyName The property name.
void WriteData(DataWriter writer)
void WriteData(DataWriter writer, EntitySchema schema)

Writes to the output stream for the specified or current entity schema.

Parameters
schema The entity schema.
writer An instance of the Terrasoft.Common.DataWriter class that provides methods for writing values to the output stream sequentially.

Events 

event EventHandler<EntityColumnAfterEventArgs> ColumnValueChanged

Event handler used after modifying the entity column value.

The event handler receives an argument of the EntityColumnAfterEventArgs type.

The EntityColumnAfterEventArgs properties that provide information relevant to the event:

  • ColumnValueName
  • DisplayColumnValueName
event EventHandler<EntityColumnBeforeEventArgs> ColumnValueChanging

Event handler used before modifying the entity column value.

The event handler receives an argument of the EntityColumnBeforeEventArgs type.

The EntityColumnBeforeEventArgs properties that provide information relevant to the event:

  • ColumnStreamValue
  • ColumnValue
  • ColumnValueName
  • DisplayColumnValue
  • DisplayColumnValueName
event EventHandler<EventArgs> DefColumnValuesSet

Event handler used after setting default entity field values.

event EventHandler<EntityAfterEventArgs> Deleted

Event handler used after deleting an entity.

The event handler receives an argument of the EntityAfterEventArgs type.

The EntityAfterEventArgs properties that provide information relevant to the event:

  • ModifiedColumnValues
  • PrimaryColumnValue
event EventHandler<EntityBeforeEventArgs> Deleting

Event handler used before deleting an entity.

The event handler receives an argument of the EntityBeforeEventArgs type.

The EntityBeforeEventArgs properties that provide information relevant to the event:

  • AdditionalCondition
  • IsCanceled
  • KeyValue
event EventHandler<EntityAfterEventArgs> Inserted

Event handler used after inserting an entity.

The event handler receives an argument of the EntityAfterEventArgs type.

The EntityAfterEventArgs properties that provide information relevant to the event:

  • ModifiedColumnValues
  • PrimaryColumnValue
event EventHandler<EntityBeforeEventArgs> Inserting

Event handler used before inserting an entity.

The event handler receives an argument of the EntityBeforeEventArgs type.

The EntityBeforeEventArgs properties that provide information relevant to the event:

  • AdditionalCondition
  • IsCanceled
  • KeyValue
event EventHandler<EntityAfterLoadEventArgs> Loaded

Event handler used after loading an entity.

The event handler receives an argument of the EntityAfterLoadEventArgs type.

The EntityAfterLoadEventArgs properties that provide information relevant to the event:

  • ColumnMap
  • DataSource
event EventHandler<EntityBeforeLoadEventArgs> Loading

Event handler used before loading an entity.

The event handler receives an argument of the EntityBeforeLoadEventArgs type.

The EntityBeforeLoadEventArgs properties that provide information relevant to the event:

  • ColumnMap
  • DataSource
  • IsCanceled
event EventHandler<EntityAfterEventArgs> Saved

Event handler used after saving an entity.

The event handler receives an argument of the EntityAfterEventArgs type.

The EntityAfterEventArgs properties that provide information relevant to the event:

  • ModifiedColumnValues
  • PrimaryColumnValue
event EventHandler<EntitySaveErrorEventArgs> SaveError

Event handler used if an error occurs while saving an entity.

The event handler receives an argument of the EntitySaveErrorEventArgs type.

The EntitySaveErrorEventArgs properties that provide information relevant to the event:

  • Exception
  • IsHandled
event EventHandler<EntityBeforeEventArgs> Saving

Event handler used before saving an entity.

The event handler receives an argument of the EntityBeforeEventArgs type.

The EntityBeforeEventArgs properties that provide information relevant to the event:

  • AdditionalCondition
  • IsCanceled
  • KeyValue
event EventHandler<EntityAfterEventArgs> Updated

Event handler used after updating an entity.

The event handler receives an argument of the EntityAfterEventArgs type.

The EntityAfterEventArgs properties that provide information relevant to the event:

  • ModifiedColumnValues
  • PrimaryColumnValue
event EventHandler<EntityBeforeEventArgs>Updating

Event handler used before updating an entity.

The event handler receives an argument of the EntityBeforeEventArgs type.

The EntityBeforeEventArgs properties that provide information relevant to the event:

  • AdditionalCondition
  • IsCanceled
  • KeyValue
event EventHandler<EntityValidationEventArgs> Validating

Event handler used when validating an entity.

The event handler receives an argument of the EntityValidationEventArgs type.

The EntityValidationEventArgs properties that provide information relevant to the event:

  • Messages
EntityMapper class
Advanced

The Terrasoft.Configuration.EntityMapper class is a utility configuration class located in the FinAppLending package of the Lending product. EntityMapper lets you map data of one Entity to another according to the rules defined in the configuration file. Use this approach to avoid code monotony.

The Lending product has two objects that contain the same columns. These objects are Contact and AppForm. Also, several details of the Contact object are similar to details of the AppForm object. When filling out the app form, you might want to use the Id column of the Contact object to retrieve the list of all its columns and values, as well as required details with their columns and values, and map this data to the app form data. After that, Creatio can populate the app form fields using the mapped data. This helps to reduce the manual entry of the same data significantly.

The following classes implement the data mapping between different entities:

  • EntityMapper – implements the mapping logic.
  • EntityResult – defines the resulting type of the mapped entity.
  • MapConfig – a set of mapping rules.
  • DetailMapConfig – sets up a list of mapping rules for details and entities connected to them.
  • RelationEntityMapConfig – contains rules for mapping connected entities.
  • EntityFilterMap – a filter for database query.

EntityMapper class 

The Terrasoft.Configuration namespace.

The class implements the mapping logic.

Methods 

virtual EntityResult GetMappedEntity(Guid recId, MapConfig config)

Returns the mapped data for two Entity objects.

Parameters
recId The GUID records in the database.
config The instance of the MapConfig class, which is a set of mapping rules.
virtual Dictionary<string, object> GetColumnsValues(Guid recordId, MapConfig config, Dictionary<string, object> result)

Retrieves the main entity from the database and matches its columns and values according to the rules specified in the config object.

Parameters
recordId The GUID records in the database.
config The instance of the MapConfig class, which is a set of mapping rules.
result The dictionary of columns and their values of the mapped entity.
virtual Dictionary<string, object> GetRelationEntityColumnsValues(List<RelationEntityMapConfig> relations, Dictionary<string, object> dictionaryToMerge, string columnName, Terrasoft.Nui.ServiceModel.DataContract.LookupColumnValue entitylookup)

Retrieves the bound entities from the database and matches them to the main entities.

Parameters
relations The list of rules for retrieving bound records.
dictionaryToMerge The dictionary of columns and their values.
columnName The parent column name.
entitylookup The object that contains the name and ID of the database record.

EntityResult class 

The Terrasoft.Configuration namespace.

The class defines the resulting type of the mapped entity.

Properties 

Columns Dictionary<string, object>

The dictionary of main entity column names and their values.

Details Dictionary<string, List<Dictionary<string, object>>>

The dictionary of detail names with the list of their columns and values.

MapConfig class 

The Terrasoft.Configuration namespace.

The class is a set of mapping rules.

Properties 

SourceEntityName string

The entity name in the database.

Columns Dictionary<string, object>

The dictionary with the names of columns of one entity and mapped columns of another entity.

DetailsConfig List<DetailMapConfig>

The list of configuration objects with rules for details.

CleanDetails List<string>

The list of detail names. Required to clean their values.

RelationEntities List<RelationEntityMapConfig>

The list of configuration objects with rules for mapping bound records to the main entity.

DetailMapConfig class 

The Terrasoft.Configuration namespace.

The class sets up a list of mapping rules for the details and entities connected to them.

Properties 

DetailName string

The detail name. Ensures the detail instance is unique.

SourceEntityName string

The entity name in the database.

Columns Dictionary<string, object>

The dictionary with the names of columns of one entity and mapped columns of another entity.

Filters List<EntityFilterMap>

The list of configuration objects with filtering rules for more accurate selections from the database.

RelationEntities List<RelationEntityMapConfig>

The list of configuration objects with rules for mapping bound records to the main entity.

RelationEntityMapConfig class 

The Terrasoft.Configuration namespace.

The class contains rules for mapping connected entities.

Properties 

ParentColumnName string

The parent column name. When Creatio finds the column the entity data retrieval and mapping logic activates.

SourceEntityName string

The entity name in the database.

Columns Dictionary<string, object>

The dictionary with the names of columns of one entity and mapped columns of another entity.

Filters List<EntityFilterMap>

The list of configuration objects with filtering rules for more accurate selections from the database.

RelationEntities List<RelationEntityMapConfig>

The list of configuration objects with rules for mapping bound records to the main entity.

EntityFilterMap class 

The Terrasoft.Configuration namespace.

The class is a filter for database queries.

Properties 

ColumnName string

The name of the column. When Creatio finds the column, the filtering logic activates.

Value object

The value to which to compare.

EntitySchemaQueryFunction class
Advanced

The Terrasoft.Core.Entities.EntitySchemaQueryFunction class implements the expression function.

The expression function is implemented in the following classes:

  • EntitySchemaQueryFunction – the base class of expression of the entity schema query.
  • EntitySchemaAggregationQueryFunction – implements the aggregate function of the expression.
  • EntitySchemaIsNullQueryFunction – replaces null values with the replacement experession.
  • EntitySchemaCoalesceQueryFunction returns the first not null expression from the list of arguments.
  • EntitySchemaCaseNotNullQueryFunctionWhenItem is a class that describes the condition expression of the CASE SQL operator.
  • EntitySchemaCaseNotNullQueryFunctionWhenItems is a collection of condition expressions of the CASE SQL operator.
  • EntitySchemaStartOfCurrentHourQueryFunction(EntitySchemaQuery parentQuery, EntitySchemaQueryExpression expression, int offset = 0) : this(parentQuery, offset)
  • EntitySchemaCaseNotNullQueryFunction – returns one value from the set of possible values depending on the specified conditions.
  • EntitySchemaSystemValueQueryFunction – returns the expression of the system value.
  • EntitySchemaCurrentDateTimeQueryFunction – implements the function for current date and time expression.
  • EntitySchemaBaseCurrentDateQueryFunction – base class of the expression function for the base date.
  • EntitySchemaCurrentDateQueryFunction – implements the function for current date and time expression.
  • EntitySchemaDateToCurrentYearQueryFunction implements a function that converts the date expression to the same date of the current year.
  • EntitySchemaStartOfCurrentWeekQueryFunction implements a function for the date expression of the current week’s start.
  • EntitySchemaStartOfCurrentMonthQueryFunction implements a function for the date expression of the current month’s start.
  • EntitySchemaStartOfCurrentQuarterQueryFunction implements a function for the date expression of the current quarter’a start.
  • EntitySchemaStartOfCurrentHalfYearQueryFunction implements a function for the date expression of the current half-year’s start.
  • EntitySchemaStartOfCurrentYearQueryFunction implements a function for the date expression of the current year’s start.
  • EntitySchemaBaseCurrentDateTimeQueryFunction is a base class for a function for the base date and time expression.
  • EntitySchemaStartOfCurrentHourQueryFunction implements a function for the time expression of the current hour.
  • EntitySchemaCurrentTimeQueryFunction implements a function for the current time expression.
  • EntitySchemaCurrentUserQueryFunction implements a function for the current user expression.
  • EntitySchemaCurrentUserContactQueryFunction implements a function for the current user’s contact expression.
  • EntitySchemaCurrentUserAccountQueryFunction implements a function for the current user’s account expression.
  • EntitySchemaDatePartQueryFunction implements a function for a date part query.;
  • EntitySchemaUpperQueryFunction – converts the argument expression characters to uppercase.
  • EntitySchemaCastQueryFunction – casts the argument expression to the specified data type.
  • EntitySchemaTrimQueryFunction – removes whitespaces from both ends of the expression.
  • EntitySchemaLengthQueryFunction – returns the length of the expression.
  • EntitySchemaConcatQueryFunction – returns a string resulting from merging the string arguments of the function.
  • EntitySchemaWindowQueryFunction – implements an SQL window function.

EntitySchemaQueryFunction class 

Terrasoft.Core.Entities namespace.

The base class of expression of the entity schema query.

Note. Use the .NET classes reference to access the full list of the methods, parent classes, and implemented interfaces of the EntitySchemaQueryFunction class.

Methods 

abstract QueryColumnExpression CreateQueryColumnExpression(DBSecurityEngine dbSecurityEngine)

For the current function, gets the query column expression that is generated taking into account the specified access rights.

Parameters
dbSecurityEngine The Terrasoft.Core.DB.DBSecurityEngine object that defines the access rights.
abstract DataValueType GetResultDataValueType(DataValueTypeManager dataValueTypeManager)

Gets the data type of the output returned by the function, using the passed-in data type manager.

Parameters
dataValueTypeManager Data type manager.
abstract bool GetIsSupportepataValueType(DataValueType dataValueType)

Indicates whether the output of the function has the specified data type.

Parameters
dataValueType Data type.
abstract string GetCaption()

Gets the caption of the expression function.

virtual EntitySchemaQueryExpressionCollection GetArguments()

Gets the collection of expressions of function arguments.

void CheckIsSupportepataValueType(DataValueType dataValueType)

Verifies that the output of the function has the specified data type. Otherwise, an exception is thrown.

Parameters
dataValueType Data type.

EntitySchemaAggregationQueryFunction class 

Terrasoft.Core.Entities namespace.

The class implements the aggregate expression function.

Note. Use the .NET classes reference to access the full list of the methods, properties, parent classes, and implemented interfaces of the EntitySchemaAggregationQueryFunction class.

Constructors 

EntitySchemaAggregationQueryFunction(EntitySchemaQuery parentQuery)

Initializes the EntitySchemaAggregationQueryFunction instance of the specified aggregate function type for the specified query to the object schema.

Parameters
parentQuery Query against the schema of the entity that contains the function.
EntitySchemaAggregationQueryFunction(AggregationTypeStrict aggregationType, EntitySchemaQuery parentQuery)

Initializes the EntitySchemaAggregationQueryFunction instance of the specified aggregate function type for the specified query to the object schema.

Parameters
aggregationType The type of the aggregate function.
parentQuery Query against the schema of the entity that contains the function.
EntitySchemaAggregationQueryFunction(AggregationTypeStrict aggregationType, EntitySchemaQueryExpression expression, EntitySchemaQuery parentQuery)

Initializes a new EntitySchemaAggregationQueryFunction instance for the specified type of aggregate function, expression, and query to the object schema.

Parameters
aggregationType The type of the aggregate function.
expression The query expression.
parentQuery Query against the schema of the entity that contains the function.
EntitySchemaAggregationQueryFunction(EntitySchemaAggregationQueryFunction source)

Initializes a new EntitySchemaAggregationQueryFunction instance that is a clone of the passed aggregate expression function instance.

Parameters
source Instance of the expression aggregate function whose clone is being created.

Properties 

QueryAlias string

The alias of the function in the SQL query.

AggregationType AggregationTypeStrict

The type of the aggregate function.

AggregationEvalType AggregationEvalType

The scope of the aggregate function.

Expression EntitySchemaQueryExpression

The expression of the aggregate function argument.

Methods 

override void WriteMetaData(DataWriter writer)

Serializes the aggregate function, using the specified Terrasoft.Common.DataWriter instance.

Parameters
writer A Terrasoft.Common.DataWriter instance used for serialization.
override QueryColumnExpression CreateQueryColumnExpression(DBSecurityEngine dbSecurityEngine)

For the aggregate function, gets the query column expression that is generated taking into account the specified access rights.

Parameters
dbSecurityEngine The Terrasoft.Core.DB.DBSecurityEngine object that defines the access rights.
override EntitySchemaQueryExpressionCollection GetArguments()

Gets the collection of expressions of the aggregate function arguments.

override DataValueType GetResultDataValueType(DataValueTypeManager dataValueTypeManager)

Gets the data type of the output returned by the aggregate function, using the specified data type manager.

Parameters
dataValueTypeManager Data type manager.
override bool GetIsSupportepataValueType(DataValueType dataValueType)

Indicates whether the output of the aggregate function has the specified data type.

Parameters
dataValueType Data type.
override string GetCaption()

Gets the caption of the expression function.

override object Clone()

Creates a clone of the current EntitySchemaAggregationQueryFunction instance.

EntitySchemaAggregationQueryFunction All()

Sets the To All Values scope for the current aggregate function.

EntitySchemaAggregationQueryFunction Distinct()

Sets the To Unique Values scope for the current aggregate function.

EntitySchemaIsNullQueryFunction class 

Terrasoft.Core.Entities namespace.

The class replaces null values with the replacement experession.

Note. Use the .NET classes reference to access the full list of the methods, properties, parent classes, and implemented interfaces of the EntitySchemaIsNullQueryFunction class.

Constructors 

EntitySchemaIsNullQueryFunction(EntitySchemaQuery parentQuery)

Initializes a EntitySchemaIsNullQueryFunction instance for the specified entity schema query.

Parameters
parentQuery Query against the schema of the entity that contains the function.
EntitySchemaIsNullQueryFunction(EntitySchemaQuery parentQuery, EntitySchemaQueryExpression checkExpression, EntitySchemaQueryExpression replacementExpression)

Initializes a new EntitySchemaIsNullQueryFunction instance for the specified query to the object schema, validated expression and substitute expression.

Parameters
parentQuery Query against the schema of the entity that contains the function.
checkExpression Expression to check for being equal to null.
replacementExpression The expression returned by the function if checkExpression is null.
EntitySchemaIsNullQueryFunction(EntitySchemaIsNullQueryFunction source)

Initializes a new EntitySchemaIsNullQueryFunction instance that is a clone of the passed expression function.

Parameters
source An instance of the EntitySchemaIsNullQueryFunction function whose clone is being created.

Properties 

QueryAlias string

The alias of the function in the SQL query.

CheckExpression EntitySchemaQueryExpression

Expression of the function argument to check the null value.

ReplacementExpression EntitySchemaQueryExpression

Expression of the function argument that is returned if the check expression is equal to null.

Methods 

override void WriteMetaData(DataWriter writer)

Serializes the expression function, using the passed DataWriter instance.

Parameters
writer A DataWriter instance used for serializing the expression function.
override QueryColumnExpression CreateQueryColumnExpression(DBSecurityEngine dbSecurityEngine)

For the current function, gets the query column expression that is generated taking into account the specified access rights.

Parameters
dbSecurityEngine The Terrasoft.Core.DB.DBSecurityEngine object that defines the access rights.
override EntitySchemaQueryExpressionCollection GetArguments()

Gets the collection of expressions of function arguments.

override DataValueType GetResultDataValueType(DataValueTypeManager dataValueTypeManager)

Gets the data type of the output returned by the function, using the passed-in data type manager.

Parameters
dataValueTypeManager Data type manager.

EntitySchemaCoalesceQueryFunction class 

Terrasoft.Core.Entities namespace.

The class returns the first not null expression from the list of arguments.

Note. Use the .NET classes reference to access the full list of the methods, properties, parent classes, and implemented interfaces of the EntitySchemaCoalesceQueryFunction class.

Constructors 

EntitySchemaCoalesceQueryFunction(EntitySchemaQuery parentQuery)

Initializes the new EntitySchemaCoalesceQueryFunction instance for the specified entity schema query.

Parameters
aggregationType The type of the aggregate function.
parentQuery Query against the schema of the entity that contains the function.
EntitySchemaCoalesceQueryFunction(EntitySchemaCoalesceQueryFunction source)

Initializes a new EntitySchemaCoalesceQueryFunction instance that is a clone of the passed function.

Parameters
source The EntitySchemaCoalesceQueryFunction function whose clone is being created.

Properties 

QueryAlias string

The alias of the function in the SQL query.

Expressions EntitySchemaQueryExpressionCollection

Collection of expressions of function arguments.

HasExpressions bool

Indicates whether at least one item exists in the collection of expressions of the function arguments.

Methods 

override bool GetIsSupportepataValueType(DataValueType dataValueType)

Indicates whether the output of the function has the specified data type.

Parameters
dataValueType Data type.

EntitySchemaCaseNotNullQueryFunctionWhenItem class 

Terrasoft.Core.Entities namespace.

Class that describes the condition expression of the CASE SQL operator.

Note. Use the .NET classes reference to access the full list of the methods, parent classes, and implemented interfaces of the EntitySchemaCaseNotNullQueryFunctionWhenItem class.

Constructors 

EntitySchemaCaseNotNullQueryFunctionWhenItem()

Initializes a new instance of the EntitySchemaCaseNotNullQueryFunctionWhenItem class.

EntitySchemaCaseNotNullQueryFunctionWhenItem(EntitySchemaQueryExpression whenExpression, EntitySchemaQueryExpression thenExpression)

Initializes a EntitySchemaCaseNotNullQueryFunctionWhenItem instance for the specified expressions of the WHEN and THEN clauses.

Parameters
whenExpression Expression of the WHEN condition clause.
thenExpression Expression of the THEN condition clause.
EntitySchemaCaseNotNullQueryFunctionWhenItem(EntitySchemaCaseNotNullQueryFunctionWhenItem source)

Initializes the EntitySchemaCaseNotNullQueryFunctionWhenItem instance that is a clone of the passed function.

Parameters
source The EntitySchemaCaseNotNullQueryFunctionWhenItem function whose clone is being created.

Properties 

WhenExpression EntitySchemaQueryExpression

Expression of the WHEN clause.

ThenExpression EntitySchemaQueryExpression

Expression of the THEN clause.

EntitySchemaCaseNotNullQueryFunctionWhenItems class 

Terrasoft.Core.Entities namespace.

The class implements a collection condition expressions of the CASE SQL operator.

Note. Use the .NET classes reference to access the full list of the methods, parent classes, and implemented interfaces of the EntitySchemaCaseNotNullQueryFunctionWhenItems class.

Constructors 

EntitySchemaCaseNotNullQueryFunctionWhenItems()

Initializes an EntitySchemaCaseNotNullQueryFunctionWhenItems instance.

EntitySchemaCaseNotNullQueryFunctionWhenItems(EntitySchemaCaseNotNullQueryFunctionWhenItems source)

Initializes a new EntitySchemaCaseNotNullQueryFunctionWhenItems instance that is a clone of the passed collection of conditions.

Parameters
source The collection of conditions whose clone is being created.

EntitySchemaCaseNotNullQueryFunction class 

Terrasoft.Core.Entities namespace.

The class returns one value from the set of possible values depending on the specified conditions.

Note. Use the .NET classes reference to access the full list of the methods, properties, parent classes, and implemented interfaces of the EntitySchemaCaseNotNullQueryFunction class.

Constructors 

CurrentDateTimeQueryFunction()

Initializes a new CurrentDateTimeQueryFunction instance.

EntitySchemaCaseNotNullQueryFunction(EntitySchemaQuery parentQuery)

Initializes the new EntitySchemaCaseNotNullQueryFunction instance for the specified entity schema query.

Parameters
parentQuery Query against the schema of the entity that contains the function.
EntitySchemaCaseNotNullQueryFunction(EntitySchemaCaseNotNullQueryFunction source)

Initializes a new EntitySchemaCaseNotNullQueryFunction instance that is a clone of the passed function.

Parameters
source The EntitySchemaCaseNotNullQueryFunction function whose clone is being created.

Properties 

QueryAlias string

The alias of the function in the SQL query.

WhenItems EntitySchemaCaseNotNullQueryFunctionWhenItems

Collection of conditions of the expression function.

HasWhenItems bool

Indicates whether the function has at least one condition.

ElseExpression EntitySchemaQueryExpression

Expression of the ELSE clause.

Methods 

void SpecifyQueryAlias(string queryAlias)

For the current expression function, defines the specified alias in the resulting SQL query.

Parameters
queryAlias Alias to define for the current function.

EntitySchemaSystemValueQueryFunction class 

Terrasoft.Core.Entities namespace.

The class returns the expression of the system value.

Note. Use the .NET classes reference to access the full list of the methods, properties, parent classes, and implemented interfaces of the EntitySchemaSystemValueQueryFunction class.

Properties 

QueryAlias string

The alias of the function in the SQL query.

SystemValueName string

Name of the system value.

EntitySchemaCurrentDateTimeQueryFunction class 

Terrasoft.Core.Entities namespace.

The class implements the function for current date and time expression.

Note. Use the .NET classes reference to access the full list of the methods, properties, parent classes, and implemented interfaces of the EntitySchemaCurrentDateTimeQueryFunction class.

Constructors 

EntitySchemaCurrentDateTimeQueryFunction(EntitySchemaQuery parentQuery)

Initializes a EntitySchemaCurrentDateTimeQueryFunction instance for the specified entity schema query.

Parameters
parentQuery Query against the schema of the entity that contains the function.
EntitySchemaCurrentDateTimeQueryFunction(EntitySchemaCurrentDateTimeQueryFunction source)

Initializes a EntitySchemaCurrentDateTimeQueryFunction instance that is a clone of the passed function.

Parameters
source An instance of the EntitySchemaCurrentDateTimeQueryFunction function whose clone is being created.

Properties 

SystemValueName string

Name of the system value.

Methods 

override string GetCaption()

Gets the caption of the expression function.

override object Clone()

Creates a clone of the current EntitySchemaCurrentDateTimeQueryFunction instance.

EntitySchemaBaseCurrentDateQueryFunction class 

Terrasoft.Core.Entities namespace.

Base class of the expression function for the base date.

Note. Use the .NET classes reference to access the full list of the methods, properties, parent classes, and implemented interfaces of the EntitySchemaBaseCurrentDateQueryFunction class.

Properties 

SystemValueName string

Name of the system value.

Offset int

The offset.

EntitySchemaCurrentDateQueryFunction class 

Terrasoft.Core.Entities namespace.

EntitySchemaCurrentDateQueryFunction – implements the function for current date and time expression.

Note. Use the .NET classes reference to access the full list of the methods, properties, parent classes, and implemented interfaces of the EntitySchemaCurrentDateQueryFunction class.

Constructors 

EntitySchemaCurrentDateQueryFunction(EntitySchemaQuery parentQuery, int offset = 0) : this(parentQuery, null, offset)
EntitySchemaCurrentDateQueryFunction(EntitySchemaQuery parentQuery, EntitySchemaQueryExpression expression, int offset = 0) : base(parentQuery, expression, offset)

Initializes a EntitySchemaCurrentDateQueryFunction instance with the specified offset from the base date for the request to the object schema.

Parameters
parentQuery Query against the schema of the entity that contains the function.
offset Day offset from the control date. By default, 0.
expression The query expression.
EntitySchemaCurrentDateQueryFunction(EntitySchemaCurrentDateQueryFunction source)

Initializes a EntitySchemaCurrentDateQueryFunction instance that is a clone of the passed function.

Parameters
source An instance of the EntitySchemaCurrentDateQueryFunction function whose clone is being created.

Methods 

override string GetCaption()

Gets the caption of the expression function.

override object Clone()

Creates a clone of the current EntitySchemaCurrentDateQueryFunction instance.

EntitySchemaDateToCurrentYearQueryFunction class 

Terrasoft.Core.Entities namespace.

The class implements the function that converts the date expression to the same date of the current year.

Note. Use the .NET classes reference to access the full list of the methods, properties, parent classes, and implemented interfaces of the EntitySchemaDateToCurrentYearQueryFunction class.

Constructors 

EntitySchemaDateToCurrentYearQueryFunction(EntitySchemaQuery parentQuery)

Initializes the new EntitySchemaDateToCurrentYearQueryFunction instance for the specified entity schema query.

Parameters
parentQuery Query against the schema of the entity that contains the function.
EntitySchemaDateToCurrentYearQueryFunction(EntitySchemaQuery parentQuery, EntitySchemaQueryExpression expression)

Initializes the new EntitySchemaDateToCurrentYearQueryFunction instance for the specified entity schema query and passed date expression.

Parameters
parentQuery Query against the schema of the entity that contains the function.
expression The query expression.
EntitySchemaDateToCurrentYearQueryFunction(EntitySchemaDateToCurrentYearQueryFunction source)

Initializes a new EntitySchemaDateToCurrentYearQueryFunction instance that is a clone of the passed function.

Parameters
source The EntitySchemaDateToCurrentYearQueryFunction function whose clone is being created.

Properties 

QueryAlias string

The alias of the function in the SQL query.

Expression EntitySchemaQueryExpression

The expression of the function arguments.

EntitySchemaStartOfCurrentWeekQueryFunction class 

Terrasoft.Core.Entities namespace.

The class implements the function for current date expression.

Note. Use the .NET classes reference to access the full list of the methods, properties, parent classes, and implemented interfaces of the EntitySchemaStartOfCurrentWeekQueryFunction class.

Constructors 

EntitySchemaStartOfCurrentWeekQueryFunction(EntitySchemaQuery parentQuery, int offset = 0) : this(parentQuery, null, offset)
EntitySchemaStartOfCurrentWeekQueryFunction(EntitySchemaQuery parentQuery, EntitySchemaQueryExpression expression, int offset = 0) : base(parentQuery, expression, offset)

Initializes a EntitySchemaStartOfCurrentWeekQueryFunction instance with the specified offset from the base date for the request to the object schema.

Parameters
parentQuery Query against the schema of the entity that contains the function.
offset Day offset from the control date. By default, 0.
expression The query expression.
EntitySchemaStartOfCurrentWeekQueryFunction(EntitySchemaStartOfCurrentWeekQueryFunction source) : base(source)

Initializes a EntitySchemaStartOfCurrentWeekQueryFunction instance that is a clone of the passed-in expression function.

Parameters
source An instance of the EntitySchemaStartOfCurrentWeekQueryFunction function whose clone is being created.

Methods 

override string GetCaption()

Gets the caption of the expression function.

override object Clone()

Creates a clone of the current EntitySchemaStartOfCurrentWeekQueryFunction instance.

EntitySchemaStartOfCurrentMonthQueryFunction class 

Terrasoft.Core.Entities namespace.

The class implements the function for the current month start date expression.

Note. Use the .NET classes reference to access the full list of the methods, properties, parent classes, and implemented interfaces of the EntitySchemaStartOfCurrentMonthQueryFunction class.

Constructors 

EntitySchemaStartOfCurrentMonthQueryFunction(EntitySchemaQuery parentQuery, int offset = 0) : this(parentQuery, null, offset)
EntitySchemaStartOfCurrentMonthQueryFunction(EntitySchemaQuery parentQuery, EntitySchemaQueryExpression expression, int offset = 0) : base(parentQuery, expression, offset)

Initializes a EntitySchemaStartOfCurrentMonthQueryFunction instance with the specified offset from the base date for the request to the object schema.

Parameters
parentQuery Query against the schema of the entity that contains the function.
offset Day offset from the control date. By default, 0.
expression The query expression.
EntitySchemaStartOfCurrentMonthQueryFunction(EntitySchemaStartOfCurrentMonthQueryFunction source) : base(source)

Initializes an EntitySchemaStartOfCurrentMonthQueryFunction instance that is a clone of the passed-in expression function.

Parameters
source An instance of the EntitySchemaStartOfCurrentMonthQueryFunction function whose clone is being created.

Methods 

override string GetCaption()

Gets the caption of the expression function.

override object Clone()

Creates a clone of the current EntitySchemaStartOfCurrentMonthQueryFunction instance.

EntitySchemaStartOfCurrentQuarterQueryFunction class 

Terrasoft.Core.Entities namespace.

The class implements the function for the current month start date expression.

Note. Use the .NET classes reference to access the full list of the methods, properties, parent classes, and implemented interfaces of the EntitySchemaStartOfCurrentQuarterQueryFunction class.

Constructors 

EntitySchemaStartOfCurrentQuarterQueryFunction(EntitySchemaQuery parentQuery, int offset = 0) : this(parentQuery, null, offset)
EntitySchemaStartOfCurrentQuarterQueryFunction(EntitySchemaQuery parentQuery, EntitySchemaQueryExpression expression, int offset = 0) : base(parentQuery, expression, offset)

Initializes a EntitySchemaStartOfCurrentQuarterQueryFunction instance with the specified offset from the base date for the request to the object schema.

Parameters
parentQuery Query against the schema of the entity that contains the function.
offset Day offset from the control date. By default, 0.
expression The query expression.
EntitySchemaStartOfCurrentQuarterQueryFunction(EntitySchemaStartOfCurrentQuarterQueryFunction source) : base(source)

Initializes an EntitySchemaStartOfCurrentQuarterQueryFunction instance that is a clone of the passed-in expression function.

Parameters
source An instance of the EntitySchemaStartOfCurrentQuarterQueryFunction function whose clone is being created.

Methods 

override string GetCaption()

Gets the caption of the expression function.

override object Clone()

Creates a clone of the current EntitySchemaStartOfCurrentQuarterQueryFunction instance.

EntitySchemaStartOfCurrentHalfYearQueryFunction class 

Terrasoft.Core.Entities namespace.

The class implements the function for the current half-year start date expression.

Note. Use the .NET classes reference to access the full list of the methods, properties, parent classes, and implemented interfaces of the EntitySchemaStartOfCurrentHalfYearQueryFunction class.

Constructors 

EntitySchemaStartOfCurrentHalfYearQueryFunction(EntitySchemaQuery parentQuery, int offset = 0) : this(parentQuery, null, offset)
EntitySchemaStartOfCurrentHalfYearQueryFunction(EntitySchemaQuery parentQuery, EntitySchemaQueryExpression expression, int offset = 0) : base(parentQuery, expression, offset)

Initializes a EntitySchemaStartOfCurrentHalfYearQueryFunction instance with the specified offset from the base date for the request to the object schema.

Parameters
parentQuery Query against the schema of the entity that contains the function.
offset Day offset from the control date. By default, 0.
expression The query expression.
EntitySchemaStartOfCurrentHalfYearQueryFunction(EntitySchemaStartOfCurrentHalfYearQueryFunction source) : base(source)

Initializes a EntitySchemaStartOfCurrentHalfYearQueryFunction instance that is a clone of the passed-in expression function.

Parameters
source An instance of the EntitySchemaStartOfCurrentHalfYearQueryFunction function whose clone is being created.

Methods 

override string GetCaption()

Gets the caption of the expression function.

override object Clone()

Creates a clone of the current EntitySchemaStartOfCurrentHalfYearQueryFunction instance.

EntitySchemaStartOfCurrentYearQueryFunction class 

Terrasoft.Core.Entities namespace.

The class implements the function for the current year start date expression.

Note. Use the .NET classes reference to access the full list of the methods, properties, parent classes, and implemented interfaces of the EntitySchemaStartOfCurrentYearQueryFunction class.

Constructors 

EntitySchemaStartOfCurrentYearQueryFunction(EntitySchemaQuery parentQuery, int offset = 0) : this(parentQuery, null, offset)
EntitySchemaStartOfCurrentYearQueryFunction(EntitySchemaQuery parentQuery, EntitySchemaQueryExpression expression, int offset = 0) : base(parentQuery, expression, offset)

Initializes a EntitySchemaStartOfCurrentYearQueryFunction instance with the specified offset from the base date for the request to the object schema.

Parameters
parentQuery Query against the schema of the entity that contains the function.
offset Day offset from the control date. By default, 0.
expression The query expression.
EntitySchemaStartOfCurrentYearQueryFunction(EntitySchemaStartOfCurrentYearQueryFunction source) : base(source)

Initializes a EntitySchemaStartOfCurrentYearQueryFunction instance that is a clone of the passed-in expression function.

Parameters
source An instance of the EntitySchemaStartOfCurrentYearQueryFunction function whose clone is being created.

Methods 

override string GetCaption()

Gets the caption of the expression function.

override object Clone()

Creates a clone of the current EntitySchemaStartOfCurrentHalfYearQueryFunction instance.

EntitySchemaBaseCurrentDateTimeQueryFunction class 

Terrasoft.Core.Entities namespace.

Base class of the expression function for the base date and time.

Note. Use the .NET classes reference to access the full list of the methods, properties, parent classes, and implemented interfaces of the EntitySchemaBaseCurrentDateTimeQueryFunction class.

Properties 

SystemValueName string

Name of the system value.

EntitySchemaStartOfCurrentHourQueryFunction class 

Terrasoft.Core.Entities namespace.

The class implement a function for the current hour expression.

Note. Use the .NET classes reference to access the full list of the methods, properties, parent classes, and implemented interfaces of the EntitySchemaStartOfCurrentHourQueryFunction class.

Constructors 

EntitySchemaStartOfCurrentHourQueryFunction(EntitySchemaQuery parentQuery, int offset = 0) : base(parentQuery, offset)

Initializes a EntitySchemaStartOfCurrentHourQueryFunction instance that is part of the parentQuery with the specified offset from the base date.

Parameters
parentQuery An EntitySchemaQuery instance.
offset Hour offset from the base date.
EntitySchemaStartOfCurrentHourQueryFunction(EntitySchemaQuery parentQuery, EntitySchemaQueryExpression expression, int offset = 0) : this(parentQuery, offset)

Initializes a EntitySchemaStartOfCurrentHourQueryFunction instance that is part of the parentQuery with the specified expression and offset from the base date.

Parameters
parentQuery An EntitySchemaQuery instance.
expression The expression of the function argument.
offset Hour offset from the base date.
EntitySchemaStartOfCurrentHourQueryFunction(EntitySchemaStartOfCurrentHourQueryFunction source)	: base(source)

Initializes a EntitySchemaStartOfCurrentHourQueryFunction instance that is a clone of the passed-in expression function.

Parameters
source An instance of the EntitySchemaStartOfCurrentHourQueryFunction function whose clone is being created.

Methods 

override string GetCaption()

Gets the caption of the expression function.

override object Clone()

Creates a clone of the current EntitySchemaStartOfCurrentHourQueryFunction instance.

EntitySchemaCurrentTimeQueryFunction class 

Terrasoft.Core.Entities namespace.

The class implements the function for current time expression.

Note. Use the .NET classes reference to access the full list of the methods, properties, parent classes, and implemented interfaces of the EntitySchemaCurrentTimeQueryFunction class.

Constructors 

EntitySchemaCurrentTimeQueryFunction(EntitySchemaQuery parentQuery) : base(parentQuery)

Initializes the new EntitySchemaCurrentTimeQueryFunction instance for the specified entity schema query.

Parameters
parentQuery Query against the schema of the entity that contains the function.
EntitySchemaCurrentTimeQueryFunction(EntitySchemaCurrentTimeQueryFunction source) : base(source)

Initializes a new EntitySchemaCurrentTimeQueryFunction instance that is a clone of the passed function.

Parameters
source The EntitySchemaCurrentTimeQueryFunction function whose clone is being created.

Properties 

SystemValueName string

Name of the system value.

Methods 

override string GetCaption()

Gets the caption of the expression function.

override object Clone()

Creates a clone of the current EntitySchemaCurrentTimeQueryFunction instance.

EntitySchemaCurrentUserQueryFunction class 

Terrasoft.Core.Entities namespace.

The class implements the function for current user expression.

Note. Use the .NET classes reference to access the full list of the methods, properties, parent classes, and implemented interfaces of the EntitySchemaCurrentUserQueryFunction class.

Constructors 

EntitySchemaCurrentUserQueryFunction(EntitySchemaQuery parentQuery) : base(parentQuery)

Initializes the new EntitySchemaCurrentUserQueryFunction instance for the specified entity schema query.

Parameters
parentQuery Query against the schema of the entity that contains the function.
EntitySchemaCurrentUserQueryFunction(EntitySchemaCurrentUserQueryFunction source) : base(source)

Initializes a new EntitySchemaCurrentUserQueryFunction instance that is a clone of the passed function.

Parameters
source The EntitySchemaCurrentUserQueryFunction function whose clone is being created.

Properties 

SystemValueName string

Name of the system value.

Methods 

override string GetCaption()

Gets the caption of the expression function.

override object Clone()

Creates a clone of the current EntitySchemaCurrentUserQueryFunction instance.

EntitySchemaCurrentUserContactQueryFunction class 

Terrasoft.Core.Entities namespace.

The class implements the function for the current user's contact.

Note. Use the .NET classes reference to access the full list of the methods, properties, parent classes, and implemented interfaces of the EntitySchemaCurrentUserContactQueryFunction class.

Constructors 

EntitySchemaCurrentUserContactQueryFunction(EntitySchemaQuery parentQuery) : base(parentQuery)

Initializes a new EntitySchemaCurrentUserContactQueryFunction instance for the specified entity schema query.

Parameters
parentQuery Query against the schema of the entity that contains the function.
EntitySchemaCurrentUserContactQueryFunction(EntitySchemaCurrentUserContactQueryFunction source) : base(source)

Initializes a new EntitySchemaCurrentUserContactQueryFunction instance that is a clone of the passed function.

Parameters
source The EntitySchemaCurrentUserContactQueryFunction function whose clone is being created.

Properties 

SystemValueName string

Name of the system value.

Methods 

override string GetCaption()

Gets the caption of the expression function.

override object Clone()

Creates a clone of the current EntitySchemaCurrentUserContactQueryFunction instance.

EntitySchemaCurrentUserAccountQueryFunction class 

Terrasoft.Core.Entities namespace.

The class implments the expression function of the current user's account.

Note. Use the .NET classes reference to access the full list of the methods, properties, parent classes, and implemented interfaces of the EntitySchemaCurrentUserAccountQueryFunction class.

Constructors 

EntitySchemaCurrentUserAccountQueryFunction(EntitySchemaQuery parentQuery)

Initializes the new EntitySchemaCurrentUserAccountQueryFunction instance for the specified entity schema query.

Parameters
parentQuery Query against the schema of the entity that contains the function.
EntitySchemaCurrentUserAccountQueryFunction(EntitySchemaCurrentUserAccountQueryFunction source)

Initializes a new EntitySchemaCurrentUserAccountQueryFunction instance that is a clone of the passed function.

Parameters
source The EntitySchemaCurrentUserAccountQueryFunction function whose clone is being created.

Properties 

SystemValueName string

Name of the system value.

EntitySchemaDatePartQueryFunction class 

Terrasoft.Core.Entities namespace.

The class implements a function for a date part query.

Note. Use the .NET classes reference to access the full list of the methods, properties, parent classes, and implemented interfaces of the EntitySchemaDatePartQueryFunction class.

Constructors 

EntitySchemaDatePartQueryFunction(EntitySchemaQuery parentQuery) : base(parentQuery)

Initializes a new EntitySchemaDatePartQueryFunction instance for the specified entity schema query.

Parameters
parentQuery An EntitySchemaQuery instance.
EntitySchemaDatePartQueryFunction(EntitySchemaQuery parentQuery, EntitySchemaDatePartQueryFunctionInterval interval, EntitySchemaQueryExpression expression) : base(parentQuery)

Initializes a new EntitySchemaDatePartQueryFunction instance that is part of the parentQuery with the specified interval date part for requesting the entity schema and the query expression.

Parameters
parentQuery An EntitySchemaQuery instance.
interval Datepart.
expression The query expression.
EntitySchemaDatePartQueryFunction(EntitySchemaDatePartQueryFunction source) : base(source)

Initializes a new EntitySchemaDatePartQueryFunction instance that is a clone of the passed function.

Parameters
source The EntitySchemaDatePartQueryFunction function whose clone is being created.

Properties 

QueryAlias string

The alias of the function in the SQL query.

EntitySchemaDatePartQueryFunctionInterval Interval

The date part returned by the function.

EntitySchemaQueryExpression Expression

The expression of the function argument.

Methods 

override void WriteMetaData(DataWriter writer)

Serializes the function using the specified Terrasoft.Common.DataWriter instance.

Parameters
writer A Terrasoft.Common.DataWriter instance used for serialization.
override QueryColumnExpression CreateQueryColumnExpression(DBSecurityEngine dbSecurityEngine)

For the current function, gets the query column expression that is generated taking into account the specified access rights.

Parameters
dbSecurityEngine The Terrasoft.Core.DB.DBSecurityEngine object that defines the access rights.
override DataValueType GetResultDataValueType(DataValueTypeManager dataValueTypeManager)

Gets the data type of the output returned by the function, using the passed-in data type manager.

Parameters
dataValueTypeManager Data type manager.
override bool GetIsSupportedDataValueType(DataValueType dataValueType)

Indicates whether the output of the function has the specified data type.

Parameters
dataValueType Data type.
override string GetCaption()

Gets the caption of the expression function.

override EntitySchemaQueryExpressionCollection GetArguments()

Gets the collection of expressions of function arguments.

override object Clone()

Creates a clone of the current EntitySchemaUpperQueryFunction instance.

EntitySchemaUpperQueryFunction class 

Terrasoft.Core.Entities namespace.

The class converts the argument expression characters to uppercase.

Note. Use the .NET classes reference to access the full list of the methods, properties, parent classes, and implemented interfaces of the EntitySchemaUpperQueryFunction class.

Constructors 

EntitySchemaUpperQueryFunction(EntitySchemaQuery parentQuery)

Initializes the new EntitySchemaUpperQueryFunction instance for the specified entity schema query.

Parameters
parentQuery Query against the schema of the entity that contains the function.
EntitySchemaUpperQueryFunction(EntitySchemaQuery parentQuery, EntitySchemaQueryExpression expression)

Initializes the new EntitySchemaUpperQueryFunction instance for the specified entity schema query and passed date expression.

Parameters
parentQuery Query against the schema of the entity that contains the function.
expression The query expression.
EntitySchemaUpperQueryFunction(EntitySchemaUpperQueryFunction source)

Initializes a new EntitySchemaUpperQueryFunction instance that is a clone of the passed function.

Parameters
source The EntitySchemaUpperQueryFunction function whose clone is being created.

Properties 

QueryAlias string

The alias of the function in the SQL query.

Expression EntitySchemaQueryExpression

The expression of the function arguments.

EntitySchemaCastQueryFunction class 

Terrasoft.Core.Entities namespace.

The class casts the argument expression to the specified data type.

Note. Use the .NET classes reference to access the full list of the methods, properties, parent classes, and implemented interfaces of the EntitySchemaCastQueryFunction class.

Constructors 

EntitySchemaCastQueryFunction(EntitySchemaQuery parentQuery, DBDataValueType castType)

Initializes a new EntitySchemaCastQueryFunction instance for the specified query to the schema of the object with the specified target data type.

Parameters
parentQuery Query against the schema of the entity that contains the function.
castType The target data type.
EntitySchemaCastQueryFunction(EntitySchemaQuery parentQuery, EntitySchemaQueryExpression expression, DBDataValueType castType)

Initializes a new EntitySchemaCastQueryFunction instance with the specified expression and target data type.

Parameters
parentQuery Query against the schema of the entity that contains the function.
expression The query expression.
castType The target data type.
EntitySchemaCastQueryFunction(EntitySchemaCastQueryFunction source)

Initializes a new EntitySchemaCastQueryFunction instance that is a clone of the passed function.

Parameters
source The EntitySchemaCastQueryFunction function whose clone is being created.

Properties 

QueryAlias string

The alias of the function in the SQL query.

Expression EntitySchemaQueryExpression

The expression of the function argument.

CastType DBDataValueType

The target data type.

EntitySchemaTrimQueryFunction class 

Terrasoft.Core.Entities namespace.

The class removes whitespaces from both ends of the expression.

Note. Use the .NET classes reference to access the full list of the methods, properties, parent classes, and implemented interfaces of the EntitySchemaTrimQueryFunction class.

Constructors 

EntitySchemaTrimQueryFunction(EntitySchemaQuery parentQuery)

Initializes the new EntitySchemaTrimQueryFunction instance for the specified entity schema query.

Parameters
parentQuery Query against the schema of the entity that contains the function.
EntitySchemaTrimQueryFunction(EntitySchemaQuery parentQuery, EntitySchemaQueryExpression expression)

Initializes the new EntitySchemaTrimQueryFunction instance for the specified entity schema query and passed date expression.

Parameters
parentQuery Query against the schema of the entity that contains the function.
expression The query expression.
EntitySchemaTrimQueryFunction(EntitySchemaTrimQueryFunction source)

Initializes a new EntitySchemaTrimQueryFunction instance that is a clone of the passed function.

Parameters
source The EntitySchemaTrimQueryFunction function whose clone is being created.

Properties 

QueryAlias string

The alias of the function in the SQL query.

Expression EntitySchemaQueryExpression

The expression of the function arguments.

EntitySchemaLengthQueryFunction class 

Terrasoft.Core.Entities namespace.

The class returns the length of the expression.

Note. Use the .NET classes reference to access the full list of the methods, properties, parent classes, and implemented interfaces of the EntitySchemaLengthQueryFunction class.

Constructors 

EntitySchemaLengthQueryFunction(EntitySchemaQuery parentQuery)

Initializes the new EntitySchemaLengthQueryFunction instance for the specified entity schema query.

Parameters
parentQuery Query against the schema of the entity that contains the function.
EntitySchemaLengthQueryFunction(EntitySchemaQuery parentQuery, EntitySchemaQueryExpression expression)

Initializes the new EntitySchemaLengthQueryFunction instance for the specified entity schema query and passed date expression.

Parameters
parentQuery Query against the schema of the entity that contains the function.
expression The query expression.
EntitySchemaLengthQueryFunction(EntitySchemaLengthQueryFunction source)

Initializes a new EntitySchemaLengthQueryFunction instance that is a clone of the passed function.

Parameters
source The EntitySchemaLengthQueryFunction function whose clone is being created.

Properties 

QueryAlias string

The alias of the function in the SQL query.

Expression EntitySchemaQueryExpression

The expression of the function arguments.

EntitySchemaConcatQueryFunction class 

Terrasoft.Core.Entities namespace.

The class returns a string resulting from merging the string arguments of the function.

Note. Use the .NET classes reference to access the full list of the methods, properties, parent classes, and implemented interfaces of the EntitySchemaConcatQueryFunction class.

Constructors 

EntitySchemaConcatQueryFunction(EntitySchemaQuery parentQuery)

Initializes the new EntitySchemaConcatQueryFunction instance for the specified entity schema query.

Parameters
parentQuery Query against the schema of the entity that contains the function.
EntitySchemaConcatQueryFunction(EntitySchemaQuery parentQuery, EntitySchemaQueryExpression expressions)

Initializes a new EntitySchemaConcatQueryFunction instance for the specified array of expressions and entity schema query.

Parameters
parentQuery Query against the schema of the entity that contains the function.
expressions Array of expressions.
EntitySchemaConcatQueryFunction(EntitySchemaConcatQueryFunction source)

Initializes a new EntitySchemaConcatQueryFunction instance that is a clone of the passed function.

Parameters
source The EntitySchemaConcatQueryFunction function whose clone is being created.

Properties 

QueryAlias string

The alias of the function in the SQL query.

Expressions EntitySchemaQueryExpressionCollection

Collection of expressions of function arguments.

HasExpressions bool

Indicates whether at least one item exists in the collection of expressions of the function arguments.

EntitySchemaWindowQueryFunction class 

Terrasoft.Core.Entities namespace.

The class implements an SQL window function.

Note. Use the .NET classes reference to access the full list of the methods, properties, parent classes, and implemented interfaces of the EntitySchemaWindowQueryFunction class.

Constructors 

EntitySchemaWindowQueryFunction(EntitySchemaQuery parentQuery)

Initializes the new EntitySchemaWindowQueryFunction instance for the specified entity schema query.

Parameters
parentQuery Query against the schema of the entity that contains the function.
EntitySchemaWindowQueryFunction(EntitySchemaQueryExpression function, EntitySchemaQuery esq)

Initializes the new EntitySchemaWindowQueryFunction instance for the specified entity schema query.

Parameters
function Nested query function.
esq Query against the entity schema.
EntitySchemaWindowQueryFunction(EntitySchemaQueryExpression function, EntitySchemaQuery esq, EntitySchemaQueryExpression partitionBy = null, EntitySchemaQueryExpression orderBy = null)

Initializes the new EntitySchemaWindowQueryFunction instance for the specified entity schema query.

Parameters
function Nested query function.
parentQuery Query against the schema of the entity that contains the function.
partitionBy The expression for splitting the query.
orderBy The expression for ordering the query.
EntitySchemaWindowQueryFunction(EntitySchemaQueryFunction source)

Initializes a new EntitySchemaWindowQueryFunction instance that is a clone of the passed function.

Parameters
source The EntitySchemaQueryFunction function whose clone is being created.
EntitySchemaWindowQueryFunction(EntitySchemaWindowQueryFunction source)

Initializes a new EntitySchemaWindowQueryFunction instance that is a clone of the passed function.

Parameters
source The EntitySchemaWindowQueryFunction function whose clone is being created.

Properties 

QueryAlias string

The alias of the function in the SQL query.

InnerFunction EntitySchemaQueryExpression

The function to apply.

PartitionByExpression EntitySchemaQueryExpression

Split by expression.

OrderByExpression EntitySchemaQueryExpression

Sort by expression.

EntitySchemaQueryOptions class
Advanced

The Terrasoft.Core.Entities namespace.

The Terrasoft.Core.Entities.EntitySchemaQueryOptions class configures entity schema queries.

Note. View the entire list of methods and properties of the EntitySchemaQueryOptions class, its parent classes, as well as the interfaces it implements, in the .NET class library.

Constructors 

EntitySchemaQueryOptions

Initializes a class instance. By default, the PageableRowCount property is set to 14 in the constructor.

Properties 

PageableRowCount int

The number of page records in the resulting dataset that the query returns.

PageableDirection Terrasoft.Core.DB.PageableSelectDirection

The direction of paged output.

Available values (Terrasoft.Core.DB.PageableSelectDirection)
Prior Previous page.
First First page.
Current Current page.
Next Next page.
PageableConditionValues Dictionary<string, object>

The values of the paged output conditions.

HierarchicalMaxDepth int

The maximum nesting level of a hierarchical query.

HierarchicalColumnName string

The name of the column by which to build a hierarchical query.

HierarchicalColumnValue Guid

The hierarchical column's seed value from which to build the hierarchy.