NHibernate LINQ + PLINQ

家住魔仙堡 提交于 2019-12-23 01:11:13

问题


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:


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.



来源:https://stackoverflow.com/questions/2780422/nhibernate-linq-plinq

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