public static bool NeedReload(this XPObjectSpace objectSpace, object currentObject) { XPMemberInfo optimisticLockFieldInfo; XPClassInfo classInfo = GetClassInfo(objectSpace, currentObject, out optimisticLockFieldInfo); Boolean isObjectChangedByAnotherUser = false; if (!objectSpace.IsDisposedObject(currentObject) && !objectSpace.IsNewObject(currentObject) && (optimisticLockFieldInfo != null)) { Object keyPropertyValue = objectSpace.GetKeyValue(currentObject); Object lockFieldValue = optimisticLockFieldInfo.GetValue(currentObject); if (lockFieldValue != null) { if (objectSpace.Session.FindObject(currentObject.GetType(), new GroupOperator( new BinaryOperator(objectSpace.GetKeyPropertyName(currentObject.GetType()), keyPropertyValue), new BinaryOperator(classInfo.OptimisticLockFieldName, lockFieldValue)), true) == null) { isObjectChangedByAnotherUser = true; } } else { if (objectSpace.Session.FindObject(currentObject.GetType(), new GroupOperator( new BinaryOperator(objectSpace.GetKeyPropertyName(currentObject.GetType()), keyPropertyValue), new NullOperator(classInfo.OptimisticLockFieldName)), true) == null) { isObjectChangedByAnotherUser = true; } } } return(isObjectChangedByAnotherUser); }