NHibernate LINQ + PLINQ [英] NHibernate LINQ + PLINQ
问题描述
我刚刚开始阅读PLINQ,发现它很有趣.
i've just started reading up on PLINQ and find it fasinating.
我在项目中使用NHib-> Linq-有人知道NHLinq使用PLINQ类型查询是否有好处/问题吗?
I'm using NHib->Linq in my projects - does anyone know if there's any benefit/problems using PLINQ type queries with NHLinq?
w://
推荐答案
如果您尝试使用PLINQ并行化几个NHibernate查询,请记住NHibernate的ISession不是线程安全的.您必须为PLINQ循环的每个步骤使用一个新的ISession,因为每个步骤都可能在另一个线程中运行.
If you're trying to parallelize several NHibernate queries with PLINQ, keep in mind that NHibernate's ISession is not thread-safe. You have to use a new ISession for each step of the PLINQ loop, since each step can potentially run in another thread.
如果您试图在单个NHibernate查询中最多使用 内的PLINQ构造,您将得到一个异常,因为SQL本身没有任何并行化构造.
If you're trying to use PLINQ constructs within a single NHibernate query at best you'll get an exception since SQL itself does not have any parallelizing constructs.
这篇关于NHibernate LINQ + PLINQ的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!