Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>My understanding of the JobStoreCMT is that you declare all of your transactions using the classes in System.Transactions namespace that was introduced in .NET 2.0. Fortunately NHibernate operates well with these transactions as well, so you would put your Quartz operations and NHibernate operations in a single TransactionScope, like the following:</p> <pre><code>using (var ts = new TransactionScope()) { // do something with your scheduler here, eg _scheduler.ScheduleJob(someJobDetail, someTrigger); // create an NHibernate session that will be part of the same transaction using (var session = _sessionFactory.OpenSession()) { // perform actions on session here, but do *not* make use of // NHibernate transaction methods, such as ISession.BeginTransaction(), // because the transaction is controlled via the TransactionScope instance. } ts.Complete(); } </code></pre> <p>The code above assumes that elsewhere the following vars are declared and initialized:</p> <pre><code>Quartz.IScheduler _scheduler; NHibernate.ISessionFactory _sessionFactory; </code></pre> <p>The above code sample is not packed with detail, but this is the general idea.</p> <p>One problem you may run into is that the above code will require a distributed transaction because the Quartz JobStoreCMT class creates one database connection, and the NHibernate session creates another database connection. Although it is possible (with SQL Server, at least) to have two different database connections share the same transaction, my understanding is that the current implementation of System.Transactions will upgraded the transaction to a distributed transaction with the opening of the second connection. This will have a significant effect on performance as a distributed transaction is significantly slower than a simple transaction.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload