コード例 #1
0
        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;
            }
        }
コード例 #2
0
        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);
            }
        }