Click or drag to resize

TableOperationsTQueryRecordWhere Method

Queries database and returns a single modeled table record for the specified SQL filter expression and parameters.

Namespace: GSF.Data.Model
Assembly: GSF.Core (in GSF.Core.dll) Version: 2.4.181-beta
Syntax
public T QueryRecordWhere(
	string filterExpression,
	params Object[] parameters
)
View Source

Parameters

filterExpression  String
Filter SQL expression for restriction as a composite format string - does not include WHERE. When escaping is needed for field names, use standard ANSI quotes.
parameters  Object
Restriction parameter values.

Return Value

T
A single modeled table record for the queried record.
Remarks

If no record is found for specified filter expression and parameters, null will be returned.

Each indexed parameter, e.g., "{0}", in the composite format filterExpression will be converted into query parameters where each of the corresponding values in the parameters collection will be applied as IDbDataParameter values to an executed IDbCommand query.

If any of the specified 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 needed, field names that are escaped with standard ANSI quotes in the filter expression will be updated to reflect what is defined in the user model.

This is a convenience call to QueryRecords(String, RecordRestriction, Int32) specifying the RecordRestriction parameter with a limit of 1 record.

See Also