il.EmitCall(OpCodes.Callvirt,typeof(IDbCommand).GetMethod("CreateParameter"),null);// stack is now [parameters] [parameters] [parameter]
il.EmitCall(OpCodes.Callvirt,typeof(IDbCommand).GetMethod("CreateParameter"),null);// stack is now [parameters] [parameters] [parameter]
il.Emit(OpCodes.Dup);// stack is now [parameters] [parameters] [parameter] [parameter]
il.Emit(OpCodes.Dup);// stack is now [parameters] [parameters] [parameter] [parameter]
il.Emit(OpCodes.Ldstr,"@"+prop.Name);// stack is now [parameters] [parameters] [parameter] [parameter] [name]
il.Emit(OpCodes.Ldstr,prop.Name);// stack is now [parameters] [parameters] [parameter] [parameter] [name]
il.EmitCall(OpCodes.Callvirt,typeof(IDataParameter).GetProperty("ParameterName").GetSetMethod(),null);// stack is now [parameters] [parameters] [parameter]
il.EmitCall(OpCodes.Callvirt,typeof(IDataParameter).GetProperty("ParameterName").GetSetMethod(),null);// stack is now [parameters] [parameters] [parameter]
il.Emit(OpCodes.Dup);// stack is now [parameters] [parameters] [parameter] [parameter]
il.Emit(OpCodes.Dup);// stack is now [parameters] [parameters] [parameter] [parameter]
vardog=connection.Query<Dog>("select '' as Extra, 1 as Age, 0.1 as Name1 , Id = @id",new{Id=guid});
vardog=connection.Query<Dog>("select '' as Extra, 1 as Age, 0.1 as Name1 , Id = @id",new{Id=guid});
dog.Count()
dog.Count()
.IsEqualTo(1);
.IsEqualTo(1);
...
@@ -148,7 +154,7 @@ public void TestStrongType()
...
@@ -148,7 +154,7 @@ public void TestStrongType()
{
{
varguid=Guid.NewGuid();
varguid=Guid.NewGuid();
vardog=connection.Query<Dog>("select Age = @Age, Id = @Id",new{Age=(int?)null,Id=guid});
vardog=connection.Query<Dog>("select Age = @Age, Id = @Id",new{Age=(int?)null,Id=guid});
dog.Count()
dog.Count()
.IsEqualTo(1);
.IsEqualTo(1);
...
@@ -167,7 +173,7 @@ public void TestSimpleNull()
...
@@ -167,7 +173,7 @@ public void TestSimpleNull()
publicvoidTestExpando()
publicvoidTestExpando()
{
{
varrows=connection.Query("select 1 A, 2 B union all select 3, 4").ToList();
varrows=connection.Query("select 1 A, 2 B union all select 3, 4").ToList();
((int)rows[0].A)
((int)rows[0].A)
.IsEqualTo(1);
.IsEqualTo(1);
...
@@ -183,11 +189,11 @@ public void TestExpando()
...
@@ -183,11 +189,11 @@ public void TestExpando()
publicvoidTestStringList()
publicvoidTestStringList()
{
{
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"}})
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"});
.IsSequenceEqualTo(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=newstring[0]})
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=newstring[0]})
.IsSequenceEqualTo(newstring[0]);
.IsSequenceEqualTo(newstring[0]);
}
}
publicvoidTestExecuteCommand()
publicvoidTestExecuteCommand()
...
@@ -199,12 +205,12 @@ public void TestExecuteCommand()
...
@@ -199,12 +205,12 @@ public void TestExecuteCommand()