Login

Username

Password





Register   Reset password

This is a read-only archive of the forum.

# geckex 7/1/2007 4:26 AM
Hi - new to all things Cuyahoga but very impressed with what I have seen of the architecture so far (manically reading through The Castle to try and understand what's going on).

Anyways - quick question on the NHibernation implementation - the SaveObject methods is not setting the timestamp for opitmistic concurrency - what's the reason for this?

		public virtual void SaveObject(object obj)
		{
			ITransaction trn = this._activeSession.BeginTransaction();
			try
			{
//				// Try to find a UpdateTimestamp property and when found, set it to the current date/time.
//				PropertyInfo pi = obj.GetType().GetProperty("UpdateTimestamp");
//				if (pi != null)
//				{
//					pi.SetValue(obj, DateTime.Now, null);
//				}
				this._activeSession.Save(obj);
				trn.Commit();
			}
			catch (Exception ex)
			{
				trn.Rollback();
				throw ex;
			}
		}
# martijnb 7/1/2007 10:49 PM
Ouch, you ran into some very old code that should have been removed a long time ago (although it's commented out).
In the early days of Cuyahoga we had the issue that the updatetimestamps weren't properly set automatically by NHibernate (something with the 1-1-1753 minimum date on SQL Server, I believe).

It now just works properly and the code that is commented out should be deleted. The answer why this hasn't been done, probably lies in the fact that CoreRepository as a whole is deprecated and replaced by separate business components like ISiteService etc..