Ejemplo n.º 1
0
        public IHashCalculation Create(HashType key)
        {
            if (!_hashCalculations.ContainsKey(key))
            {
                throw new HashAlgorithmNotSupportedException(key);
            }

            lock (_sync)
            {
                if (_hashCalculations[key].Count > 1)
                {
                    return(_hashCalculations[key].Pop());
                }

                IHashCalculation calculationTemp = _hashCalculations[key].Pop();
                IHashCalculation calculation     = (IHashCalculation)_applicationContext.Container.Resolve(calculationTemp.GetType());
                _hashCalculations[key].Push(calculationTemp);
                return(calculation);
            }
        }