Skip to content

Instantly share code, notes, and snippets.

@Tigraine
Created September 11, 2010 00:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tigraine/574588 to your computer and use it in GitHub Desktop.
Save Tigraine/574588 to your computer and use it in GitHub Desktop.
A Message gets handled through NSB and the following code is run:
public void Handle(UpdateProductData message)
{
var product = session.Get<Product>(message.ProductDto.Id);
product.Name = message.ProductDto.Name;
product.PartNumber = message.ProductDto.PartNumber;
product.Price = message.ProductDto.Price;
session.Update(product);
Logger.InfoFormat("Updated Product {0}", product.Id);
}
While looking at NHProf I always see the SELECT being run, but only once every 3 sessions or so I get the UPDATE too (always changing data of course, so the object should be dirty).
Because of NServiceBus the whole method is wrapped in a distributed transaction with isolation level: Serializable and is always committed after the handler is run (checked this with NHprof)
I looked at the ISession.IsDirty() and it's consistent with issuing the UPDATE, just totally wrong because whenever I ran that method something had changed so the session should have been dirty.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment