Stats

298 Contributors: 3 Tuesday, July 11, 2017
Licensed under: CC-BY-SA
Not affiliated with Stack Overflow
Rip Tutorial: riptutorial@gmail.com
Roadmap: roadmap
Download eBook

Parameter Syntax Reference

Download dapper eBook

Parameters

ParameterDetails
this cnnThe underlying database connection - the this denotes an extension method; the connection does not need to be open - if it is not open, it is opened and closed automatically.
<T> / Type(optional) The type of object to return; if the non-generic / non-Type API is used, a dynamic object is returned per row, simulating a property named per column name returned from the query (this dynamic object also implements IDicionary<string,object>).
sqlThe SQL to execute
param(optional) The parameters to include.
transaction(optional) The database transaction to associate with the command
buffered(optional) Whether to pre-consume the data into a list (the default), versus exposing an open IEnumerable over the live reader
commandTimeout(optional) The timeout to use on the command; if not specified, SqlMapper.Settings.CommandTimeout is assumed (if specified)
commandTypeThe type of command being performed; defaults to CommandText

Remarks

The syntax for expressing parameters varies between RDBMS. All the examples above use SQL Server syntax, i.e. @foo; however, ?foo and :foo should also work fine.

Related Examples