Dapper.NET
Använda Async
Sök…
Ringa en lagrad procedur
public async Task<Product> GetProductAsync(string productId)
{
using (_db)
{
return await _db.QueryFirstOrDefaultAsync<Product>("usp_GetProduct", new { id = productId },
commandType: CommandType.StoredProcedure);
}
}
Ring en lagrad procedur och ignorerar resultatet
public async Task SetProductInactiveAsync(int productId)
{
using (IDbConnection con = new SqlConnection("myConnectionString"))
{
await con.ExecuteAsync("SetProductInactive", new { id = productId },
commandType: CommandType.StoredProcedure);
}
}
Modified text is an extract of the original Stack Overflow Documentation
Licensierat under CC BY-SA 3.0
Inte anslutet till Stack Overflow