NHibernate LINQ + PLINQ

2019-06-05 01:26发布

i've just started reading up on PLINQ and find it fasinating.

I'm using NHib->Linq in my projects - does anyone know if there's any benefit/problems using PLINQ type queries with NHLinq?

w://

1条回答
闹够了就滚
2楼-- · 2019-06-05 01:49

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.

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.

查看更多
登录 后发表回答