Skip to content

ListRequestHandlerBase<TRow,TListRequest,TListResponse> class

namespace: Serenity.Services   assemblySerenity.Net.Services

Abstract base class for list request handlers that share state and mode neutral helper methods between synchronous and asynchronous list request handlers.

public abstract class ListRequestHandlerBase<TRow, TListRequest, TListResponse> : 
    IListRequestHandler
    where TRow : class, IRow, new()
    where TListRequest : ListRequest
    where TListResponse : ListResponse<TRow>, new()
parameter description
TRow Entity type
TListRequest List request type
TListResponse List response type
context Request context

Public Members

name description
Cache { get; } Gets the two level cache from the request context.
Connection { get; protected set; } Gets the current connection.
Context { get; } Gets the request context.
DistinctFields { get; protected set; } Gets the list of distinct fields.
Localizer { get; } Gets the localizer from the request context.
Permissions { get; } Gets the permission service from the request context.
Query { get; protected set; } Gets the select query.
Request { get; protected set; } Gets the request object.
Response { get; protected set; } Gets the response object.
Row { get; protected set; } Gets the entity used for querying / metadata lookup.
StateBag { get; } A state bag for behaviors to preserve state among their methods. It will be cleared before each request, e.g. Process call.
User { get; } Gets the current user from the request context.
GetDistinctFields() Gets an array of distinct fields by checking Request.DistinctFields. It might be different than the passed list, if the list contains an invalid field or a field that is not allowed to be selected, like NotMapped and Never etc.
IgnoreEqualityFilter(…) Adds the field to the list of ignored equality filters, so that having this field in the Request.EqualityFilter won't raise an exception

Protected Members

name description
ListRequestHandlerBase(…) Abstract base class for list request handlers that share state and mode neutral helper methods between synchronous and asynchronous list request handlers.
ignoredEqualityFilters- Set of ignored equality filter entries.
lookupAccessMode- True if the list handler is in lookup access mode, e.g. it only allows access to lookup fields.
virtual AddFieldContainsCriteria(…) Applies a contains criteria based on containsText, id (if the contains text can be parsed to an integer ID), searchType and numericOnly parameters.
virtual AllowSelectField(…) Returns true if the field should be allowed to be selected, based on is read permission, selectlevel.never flag, and lookup access mode
virtual ApplyContainsText(…) Applies contains text filter to the query
virtual ApplyCriteria(…) Applies the Request.Criteria to the query if it is not null or empty, and replaced field references with their corresponding expressions by calling ReplaceFieldExpressions
virtual ApplyEqualityFilter(…) Applies the Request.Equality filter to the query
virtual ApplyFieldContainsText(…) Applies a field contains criteria to the query by calling AddFieldContainsCriteria
virtual ApplyFieldEqualityFilter(…) Applies a field equality filter, e.g. one that is passed via Request.EqualityFilter to the query. It validates field flags like DenyFiltering and NotMapped and Never to check if the field is allowed to be filtered.
virtual ApplyIncludeDeletedFilter(…) Applies include deleted filter to the query if Request.IncludeDeleted is true
virtual ApplyKeyOrder(…) Applies the key order which is ID field (IIdRow)
virtual ApplySort(…) Applies the Request.Sort order to the query. Sorts by GetNativeSort if no sort columns are passed, or the list is empty.
virtual ApplySortBy(…) Applies a sort order to the query
virtual CreateQuery() Creates a query instance with the dialect for current connection.
virtual GetBehaviors() Gets the list of list behaviors.
virtual GetNativeSort() Gets the native sort order, which includes name field by default, unless the row has [SortOrder] attributes.
virtual GetQuickSearchFields(…) Gets the list of quick search fields (QuickSearchAttribute) based on the containsField argument.
IsEmptyEqualityFilterValue(…) Checks if the equality filter value is empty. It returns true for null, empty string, or empty IEnumerable.
IsIncluded(…) Returns true if field is included in IncludeColumns (2 methods)
abstract MapFieldExpression(…) Maps a field using IListFieldMappingBehavior's if any
virtual ProcessEntity(…) Can be overridden in a derived class to make some changes in a returned entity just before it gets added to the Response.Entities list.
virtual ReplaceFieldExpressions(…) Replaces field references, e.g. property names and field name with their corresponding expression by using the CriteriaFieldExpressionReplacer
virtual SelectField(…) Calls query.Select(field)
virtual SelectFields(…) Calls query.Select(field) for all the fields without NotMapped, and if AllowSelectField and ShouldSelectField returns true.
virtual ShouldSelectField(…) Returns true if the field should be selected, based on current ColumnSelection, field MinSelectLevelAttribute, the field being a not mapped (NotMappedAttribute) field, table field, or a view / expression field.
virtual ToCriteria(…) Converts the field to criteria, using IListFieldMappingBehavior's if any
virtual ValidatePermissions() Validates if the user is allowed to query this entity type by checking ReadPermissionAttribute and ServiceLookupPermissionAttribute if the request is in lookup access mode.

Exceptions

exception condition
ArgumentNullException context is null.

Remarks

Initializes a new instance of the class.

See Also