What .Net orms or MicroOrms support async operatio

2020-04-05 08:41发布

What ORM's support async operations and postgresql ?

I prefer simple MicroOrms like Dapper and OrmLite because they seems to have great performance and they are really simple, but they do not support async operations as far as I can tell.

Maybe I am wrong, but isn't important to make all IO bound operations async to get the full benefits of say an async web service that needs to scale?

So what are the options regarding an MicroOrm with support for both async operations and Postgresql? I have just read about a new Orm called Insight.Data, but I am unsure whether it properly supports PostgreSql.

标签: dapper
7条回答
ゆ 、 Hurt°
2楼-- · 2020-04-05 08:55

Just stumbled upon this new ORM called Insight.Database and they claim to support async queries:

List<Beer> beerMenu = await Database1.AsyncQuery<Beer>("FindBeer", new { Name = "Sly Fox" });

I did not try it yet...

查看更多
ら.Afraid
3楼-- · 2020-04-05 08:58

If you are using .NET 4.5, I wrote a fork of Dapper that adds async methods that internally call ExecuteReaderAsync. It is also available on NuGet. I haven't tested it with Postgresql but if Dapper works with it then my fork should as well.

查看更多
我想做一个坏孩纸
4楼-- · 2020-04-05 09:03

AFAIK the only RDBMS which natively supports asynchronous executions, provider side and server side (not fake ones like wrapping a call with a Task.Run()) on its reader, is SQL Server. You can see this by decompiling the specific ADO.NET data provider. The default implementation of ExecuteReaderAsync calls internally the synchronous one, if not overridden. Please double check by decompiling the specific ADO.NET provider because you may end up in doing database operations in the UI thread when using async and await.

查看更多
等我变得足够好
5楼-- · 2020-04-05 09:04

Insight.Database has full async support and works with any .NET SqlProvider. I haven't specifically tested it on postgres, but if you post an issue on the github site, I'd gladly incorporate postgres into the test suite.

https://github.com/jonwagner/Insight.Database

EDIT: Insight v3.0 and later supports most databases.

查看更多
放我归山
6楼-- · 2020-04-05 09:13

Telerik's free OpenAccess ORM supports PostgeSQL, but I can't see anything mentioned about async. Maybe you could contact them, their online support is pretty good.

查看更多
Evening l夕情丶
7楼-- · 2020-04-05 09:13

Dapper has had async support for some time, but only when targeting .NET 4.5. I could probably back-port to 4.0 using the BCL async targeting pack, but to date: I have not done so.

查看更多
登录 后发表回答