Ejemplo n.º 1
0
        private void GetLocks()
        {
            foreach (var entity in CurrentTransaction.ToAdd)
            {
                entity.Value.TransactionId = CurrentTransaction.Id;
                FechadurasAdquiridas.Add(entity.Key, entity.Value);
                EstaLiberado = true;
            }

            foreach (var entity in CurrentTransaction.ToSave)
            {
                entity.Value.TransactionId = CurrentTransaction.Id;

                if (!this.IMDB.Lock(entity.Value, CurrentTransaction.Id))
                {
                    throw new ApplicationException(String.Format("Commit ({0}) - GetLocks", this.CurrentTransaction.Id));
                }

                FechadurasAdquiridas.Add(entity.Key, entity.Value);
                EstaLiberado = true;
            }

            foreach (var entity in CurrentTransaction.ToRemove)
            {
                entity.Value.TransactionId = CurrentTransaction.Id;

                if (!this.IMDB.Lock(entity.Value, CurrentTransaction.Id))
                {
                    throw new ApplicationException(String.Format("Commit ({0}) - GetLocks", this.CurrentTransaction.Id));
                }

                FechadurasAdquiridas.Add(entity.Key, entity.Value);
                EstaLiberado = true;
            }
        }