Gemstone Data Library
Show/Hide TOC

# SecureTableOperations T QueryRecords(ClaimsPrincipal, String, Boolean, Int32, Int32, RecordRestriction) Method

Queries database and returns modeled table records for the specified sorting and paging parameters.

## Definition

Namespace: Gemstone.Data.Model
Assembly: Gemstone.Data (in Gemstone.Data.dll) Version: 1.0.180 -- Release Build+0e3c143567ac1e22ccabc137e6e7d5395a9784d8
C#
View Source Request Example

    public IEnumerable<T> QueryRecords(
    	ClaimsPrincipal principal,
    	string? sortField,
    	bool ascending,
    	int page,
    	int pageSize,
    	params RecordRestriction?[]? restrictions
    )

VB
View Source Request Example

    Public Function QueryRecords (
    	principal As ClaimsPrincipal,
    	sortField As String,
    	ascending As Boolean,
    	page As Integer,
    	pageSize As Integer,
    	ParamArray restrictions As RecordRestriction()
    ) As IEnumerable(Of T)

C++
View Source Request Example

    public:
    IEnumerable<T>^ QueryRecords(
    	ClaimsPrincipal^ principal,
    	String^ sortField,
    	bool ascending,
    	int page,
    	int pageSize,
    	... array<RecordRestriction^>^ restrictions
    )

JavaScript
View Source Request Example

    function QueryRecords(principal, sortField, ascending, page, pageSize, ... restrictions);

#### Parameters

principal ClaimsPrincipal
  Claims principal which is making the request.
sortField String
  Field name to order-by.
ascending Boolean
  Sort ascending flag; set to false for descending.
page Int32
  Page number of records to return (1-based).
pageSize Int32
  Current page size.
restrictions RecordRestriction
  Record restrictions to apply, if any.

#### Return Value

IEnumerable T
An enumerable of modeled table row instances for queried records.

## Remarks

This function is used for record paging. Primary keys are cached server-side, typically per user session, to maintain desired per-page sort order. Call ClearPrimaryKeyCache to manually clear cache when table contents are known to have changed.

If any of the restrictions parameters reference a table field that is modeled with either an EncryptDataAttribute or FieldDataTypeAttribute, then the function GetInterpretedFieldValue(String, Object) will need to be called, replacing the target parameter with the returned value so that the field value will be properly set prior to executing the database function.

If the specified sortField has been marked with EncryptDataAttribute, establishing the primary key cache operation will take longer to execute since query data will need to be downloaded locally and decrypted so the proper sort order can be determined.

## See Also

#### Reference

SecureTableOperationsT Class
QueryRecords Overload
Gemstone.Data.Model Namespace