DbCommandBuilder SelectTemplate Property NReco.Data Class Library Documentation
Gets or sets template for SQL SELECT query.

Namespace: NReco.Data
Assembly: NReco.Data (in NReco.Data.dll) Version: 1.0.2
Syntax

public string SelectTemplate { get; set; }

Property Value

Type: String
Remarks

Template is processed with StringTemplate. List of available variables: @columns (comma-separated list of fields from Query or '*')@table (table name, possibly with alias like 'users u')@where (query conditions, may be empty)@orderby (order by expression, may be empty)@recordoffset (starting record index offset, 0 by default)@recordcount (max number of records to return, empty if not specified)@recordtop (recordoffset+recordcount, empty if recordcount is not specified)@<extendedPropertyKey> (value from Query.ExtendedProperties dictionary) @record* variables are useful for database-specific paging optimizations, for example:
// MS SQL TOP syntax
DbCommandBuilder cmdBuilder;
cmdBuilder = "SELECT @recordtop[TOP {0}] @columns FROM @table@where[ WHERE {0}]@orderby[ ORDER BY {0}]";
// PostgreSql LIMIT and OFFSET syntax
DbCommandBuilder cmdBuilder;
cmdBuilder = "SELECT @columns FROM @table@where[ WHERE {0}]@orderby[ ORDER BY {0}] @recordcount[LIMIT {0}] @recordoffset[OFFSET {0}]";
Note that if offset is applied on DB level and ApplyOffset should be false.
See Also