NHibernate Linq queries not returning data saved in the same transaction

Posted by Andrew on Stack Overflow See other posts from Stack Overflow or by Andrew
Published on 2010-05-11T05:24:20Z Indexed on 2010/05/11 7:24 UTC
Read the original article Hit count: 257

Filed under:
|
|
|

Hi,

I have a situation where I am using NHibernate in a WCF service and using a TransactionScope for the transaction management. NHibernate enlists in the ambient transaction fine, but, any changes I make and save inside the transaction, are not visible to any queries I make while still in that transaction. So if I add an entity and session.save() it, then further on in the code, there is a linq query against that entities table, the entity I just added is not returned.

Strangely this seems to work fine if I use explicit NHibernate transactions in my tests.

Anyone have any ideas as to why and what I can do about it?

Many thanks

Andrew

© Stack Overflow or respective owner

Related posts about nhibernate

Related posts about transaction