我怎样才能运行NHibenate查询请求异步? [英] How can I run NHibenate queries asynchronously?

查看:235
本文介绍了我怎样才能运行NHibenate查询请求异步?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要提高服务器应用程序可扩展性的一个方法是运行IO绑定操作(读取文件,插座,Web请求,数据库请求等)异步。这并不意味着当执行操作,它只会阻塞线程的线程池运行它们。正确的方法是使用异步API(BeginRead的,BeginGetResponse,BeginExecuteReader等​​)。问题是很好的描述 CLR六C#的书。

One way to increase scalability of the server application is to run IO-bound operation (reading files, sockets, web requests, database requests etc) asynchronously. This does not mean run them in the ThreadPool which will just block threads while operation is being executed. The correct way is to use asynchronous API (BeginRead, BeginGetResponse, BeginExecuteReader etc). The problem is well described in CLR vi C# book.

下面是一些文章<一个href="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2007/12/06/10008.aspx">asynchronous在LINQ查询到SQL 。

是执行NHibernate的查询asynchonously什么方法?怎么样的LINQ to NHibernate的?

Are any ways to execute Nhibernate query asynchonously? What about Linq to NHibernate?

感谢您, 安德烈

推荐答案

不幸的是,没有。 NHibernate的不公开的L2S的方式做的命令执行的内部实现。

Unfortunately, no. NHibernate does not expose the internal implementation of the command execution in the way L2S does.

您将不得不使用线程池或创建一个补丁NH添加异步查询支持。这将是非常欢迎的社会,将使一个很好的锻炼(但不是微不足道的话)

You'll have to use the threadpool OR create a patch for NH to add asynchronous query support. That would be very welcome by the community and would make for a nice exercise (but it's not trivial at all)

这篇关于我怎样才能运行NHibenate查询请求异步?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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