📜  querymultiple dapper c# 代码示例

📅  最后修改于: 2022-03-11 14:48:45.294000             🧑  作者: Mango

代码示例1
string sql = "SELECT * FROM Invoice WHERE InvoiceID = @InvoiceID; SELECT * FROM InvoiceItem WHERE InvoiceID = @InvoiceID;";

using (var connection = My.ConnectionFactory())
{
    connection.Open();

    using (var multi = connection.QueryMultiple(sql, new {InvoiceID = 1}))
    {
        var invoice = multi.Read().First();
        var invoiceItems = multi.Read().ToList();
    }
}