What .Net orms or MicroOrms support async operations and PostgreSql

别说谁变了你拦得住时间么 提交于 2019-12-04 03:19:01

问题


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.


回答1:


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.




回答2:


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...




回答3:


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.




回答4:


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.




回答5:


AsyncPoco, a fork of PetaPoco, supports asynchronous operations (exclusively) and PostgeSQL.




回答6:


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.




回答7:


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.



来源:https://stackoverflow.com/questions/12343284/what-net-orms-or-microorms-support-async-operations-and-postgresql

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!