在 Dapper 中使用 Async Await 关键字 [英] Using Async Await keywords with Dapper

查看:43
本文介绍了在 Dapper 中使用 Async Await 关键字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 micro-orm 并决定使用 Dapper.

I want to use a micro-orm and decided to go with Dapper.

但似乎找不到任何提及它支持新的 async/await 语法的内容.异步查询对我很重要.

But can't seem to find any mentions of it supporting the new async/await syntax. Async queries are important for me.

有人可以提供使用等待关键字使用 Dapper 进行异步查询的代码示例吗?

Can someone provide a code example of an async query being made with Dapper using the await keyword ?

推荐答案

Dapper 在面向 .NET 4.5 时完全支持 TPL 使用,通过以 *Async - QueryAsync 等结尾的方法.具体来说,.NET 4.5 构建包括 这组额外的方法

Dapper when targeting .NET 4.5 has full support for TPL usage, via the methods ending in *Async - QueryAsync etc. Specifically, the .NET 4.5 build includes this extra set of methods

这篇关于在 Dapper 中使用 Async Await 关键字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆