Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I use a Version property for NServicebus's NHibernate Saga Persister?
    primarykey
    data
    text
    <p>Forgive me for asking a question that might have a totally obvious answer (RTFM), but how does one go about making the "Version property" mentioned <a href="http://andreasohlund.net/2012/09/19/nservicebus-sagas-and-concurrency/" rel="nofollow noreferrer">here</a> actually work? The provided links to Ayende's site <a href="http://ayende.com/blog/3946/nhibernate-mapping-concurrency" rel="nofollow noreferrer">here</a> and the github repo <a href="https://github.com/Particular/NServiceBus/issues/649" rel="nofollow noreferrer">here</a> hint that this is possible. There is also this other SO link <a href="https://stackoverflow.com/questions/12370389/nservicebus-concurrent-access-to-saga-data">here</a> that describes the same issue but does not really have a clear solution posted. I was also unable to find NSB sample code or anything in release notes or documentation related to this feature. However, it's critical knowledge for anyone running sagas with multiple worker threads and ReadCommited.</p> <p>Is it really as simple as adding an integer property called Version to your saga data class and a timestamp/rowversion to your saga data table? Is this really in the samples somewhere and I'm just not looking in the right place?</p> <p>Also, based on the comments I've seen posted, it looks like there is a bug in NSB 3.x that involves this feature. Will I need to upgrade to 4.x to get this feature or is there an easy way to get it working in 3.x?</p> <p>Thanks!</p> <p><strong>EDIT:</strong></p> <p>Using John Simon's answer below, I ran into an bug initially using the following NSB versions:</p> <pre><code>NHibernate: 3.3.3.4001 NServiceBus: 4.3.1 NServiceBus.Host: 4.3.1 NServiceBus.Interfaces: 4.3.3 NServiceBus.NHibernate: 4.3.0 NServiceBus.StructureMap: 4.3.1 </code></pre> <p>I opened <a href="https://github.com/Particular/NServiceBus.NHibernate/issues/20" rel="nofollow noreferrer">this issue on github</a> and after some back &amp; forth, tried a dev build containing a fix and got this to work. The official fix was released in NServiceBus.NHibernate v4.4.0.</p> <p>My variation on the answer was to use this with a timestamp SQL column:</p> <pre><code>[RowVersion] public virtual byte[] Version { get; set; } </code></pre> <p>After spending a couple days hammering on it, it looks good.</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.
 

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