SqlMapperQuery Method (IDbConnection, Type, String, Object, IDbTransaction, Boolean, NullableInt32, NullableCommandType) |
Executes a query, returning the data typed as per the Type suggested
Namespace: DapperAssembly: VirtualRadar.Database (in VirtualRadar.Database.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax public static IEnumerable<Object> Query(
this IDbConnection cnn,
Type type,
string sql,
Object param = null,
IDbTransaction transaction = null,
bool buffered = true,
Nullable<int> commandTimeout = null,
Nullable<CommandType> commandType = null
)
<ExtensionAttribute>
Public Shared Function Query (
cnn As IDbConnection,
type As Type,
sql As String,
Optional param As Object = Nothing,
Optional transaction As IDbTransaction = Nothing,
Optional buffered As Boolean = true,
Optional commandTimeout As Nullable(Of Integer) = Nothing,
Optional commandType As Nullable(Of CommandType) = Nothing
) As IEnumerable(Of Object)
public:
[ExtensionAttribute]
static IEnumerable<Object^>^ Query(
IDbConnection^ cnn,
Type^ type,
String^ sql,
Object^ param = nullptr,
IDbTransaction^ transaction = nullptr,
bool buffered = true,
Nullable<int> commandTimeout = nullptr,
Nullable<CommandType> commandType = nullptr
)
[<ExtensionAttribute>]
static member Query :
cnn : IDbConnection *
type : Type *
sql : string *
?param : Object *
?transaction : IDbTransaction *
?buffered : bool *
?commandTimeout : Nullable<int> *
?commandType : Nullable<CommandType>
(* Defaults:
let _param = defaultArg param null
let _transaction = defaultArg transaction null
let _buffered = defaultArg buffered true
let _commandTimeout = defaultArg commandTimeout null
let _commandType = defaultArg commandType null
*)
-> IEnumerable<Object>
Parameters
- cnn
- Type: System.DataIDbConnection
- type
- Type: SystemType
- sql
- Type: SystemString
- param (Optional)
- Type: SystemObject
- transaction (Optional)
- Type: System.DataIDbTransaction
- buffered (Optional)
- Type: SystemBoolean
- commandTimeout (Optional)
- Type: SystemNullableInt32
- commandType (Optional)
- Type: SystemNullableCommandType
Return Value
Type:
IEnumerableObjectA sequence of data of the supplied type; if a basic type (int, string, etc) is queried then the data from the first column in assumed, otherwise an instance is
created per row, and a direct column-name===member-name mapping is assumed (case insensitive).
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
IDbConnection. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
See Also