Hi All,
I have a question about transactions and concurrency. I have an application where several different threads can access different entities that are being persisted (to SQL Server).
I'm planning on using a single ADO connection, and having every thread open up an ISession and call a ISession.BeginTransaction() before modifying any entities. When the thread is done modifying entities it will Flush() the ISession and Commit() the ITransaction.
Does this pattern seem reasonable? Any opinions out there on whether this is a fairly normal way of doing things, or a hideously bad idea would be appreciated :)
If so, does this seem reasonable to do over a single ADO connection? It will result in multiple ISession's over the connection (and the NHibernate docs seem to warn against this) but each ISession is within the context of its own transaction.
I want to use a single ADO connection because it may be that some of these entities will be doing their own hand rolled DB updates/inserts/deletes and I want a single connection to get Commit()'d.
Many thanks
|