/// Enumerates the query, keeping the reader open after it is called. Use when iterating through huge result sets . You should usually use ExecuteMapperQuery instead.
/// Return a list of dynamic objects, reader is closed after the call
/// Enumerates the query, keeping the reader open after it is called. Use when iterating through huge result sets. You should usually use ExecuteMapperQuery instead
/// Return a typed list of objects, reader is closed after the call
/// Return a list of dynamic objects, reader is closed after the call
/// Enumerates the query, keeping the reader open after it is called. Use when iterating through huge result sets . You should usually use ExecuteMapperQuery instead.
/// Return a typed list of objects, reader is closed after the call
/// Enumerates the query, keeping the reader open after it is called. Use when iterating through huge result sets. You should usually use ExecuteMapperQuery instead
connection.ExecuteMapperQuery<int>("select 1 union all select 2 union all select 3")
connection.Query<int>("select 1 union all select 2 union all select 3")
.IsSequenceEqualTo(new[]{1,2,3});
}
publicvoidPassInIntArray()
{
connection.ExecuteMapperQuery<int>("select * from (select 1 as Id union all select 2 union all select 3) as X where Id in @Ids",new{Ids=newint[]{1,2,3}.AsEnumerable()})
connection.Query<int>("select * from (select 1 as Id union all select 2 union all select 3) as X where Id in @Ids",new{Ids=newint[]{1,2,3}.AsEnumerable()})
varrows=connection.ExecuteMapperQuery("select 1 A, 2 B union all select 3, 4");
varrows=connection.Query("select 1 A, 2 B union all select 3, 4").ToList();
((int)rows[0].A)
.IsEqualTo(1);
...
...
@@ -152,13 +152,13 @@ public void TestExpando()
publicvoidTestStringList()
{
connection.ExecuteMapperQuery<string>("select * from (select 'a' as x union all select 'b' union all select 'c') as T where x in @strings",new{strings=new[]{"a","b","c"}})
connection.Query<string>("select * from (select 'a' as x union all select 'b' union all select 'c') as T where x in @strings",new{strings=new[]{"a","b","c"}})
.IsSequenceEqualTo(new[]{"a","b","c"});
}
publicvoidTestExecuteCommand()
{
connection.ExecuteMapperCommand(@"
connection.Execute(@"
set nocount on
create table #t(i int)
set nocount off
...
...
@@ -171,7 +171,7 @@ public void TestExecuteCommand()