mirror of
https://github.com/DapperLib/Dapper.git
synced 2026-10-29 05:10:10 +08:00
test for multi command with a strong type
This commit is contained in:
@@ -226,6 +226,25 @@ namespace SqlMapper
|
||||
sum.IsEqualTo(10);
|
||||
}
|
||||
|
||||
class Student
|
||||
{
|
||||
public string Name {get; set;}
|
||||
public int Age { get; set; }
|
||||
}
|
||||
|
||||
public void TestExecuteMultipleCommandStrongType()
|
||||
{
|
||||
connection.Execute("create table #t(Name nvarchar(max), Age int)");
|
||||
int tally = connection.Execute(@"insert #t (Name,Age) values(@Name, @Age)", new List<Student>
|
||||
{
|
||||
new Student{Age = 1, Name = "sam"},
|
||||
new Student{Age = 2, Name = "bob"}
|
||||
});
|
||||
int sum = connection.Query<int>("select sum(Age) from #t drop table #t").First();
|
||||
tally.IsEqualTo(2);
|
||||
sum.IsEqualTo(3);
|
||||
}
|
||||
|
||||
public void TestExecuteMultipleCommandObjectArray()
|
||||
{
|
||||
connection.Execute("create table #t(i int)");
|
||||
|
||||
Reference in New Issue
Block a user