public static bool Lock(BusinessBase obj, string sessionId) { if (IsLocked(obj)) return false; lock (_lockedItems) { var lockItem = new LockItem { ObjectType = obj.GetType(), ObjectId = obj.Id, LockedAt = DateTime.Now, SessionId = sessionId }; _lockedItems.Add(lockItem); return true; } }
public static bool Lock(BusinessBase obj, string sessionId) { if (IsLocked(obj)) { return(false); } lock (_lockedItems) { var lockItem = new LockItem { ObjectType = obj.GetType(), ObjectId = obj.Id, LockedAt = DateTime.Now, SessionId = sessionId }; _lockedItems.Add(lockItem); return(true); } }