Exemple #1
0
        public ReflectGroup GetValue(string groupName)
        {
            #region Contracts

            if (string.IsNullOrEmpty(groupName) == true)
            {
                throw new ArgumentNullException();
            }

            #endregion

            lock (_syncRoot)
            {
                // Cache
                if (_cacheGroupName == groupName)
                {
                    return(_cacheGroupInstance);
                }
                _cacheGroupName     = groupName;
                _cacheGroupInstance = _repository.GetValue(groupName);

                // Return
                return(_cacheGroupInstance);
            }
        }
        // Methods
        public void Add(string groupName)
        {
            #region Contracts

            if (string.IsNullOrEmpty(groupName) == true) throw new ArgumentNullException();

            #endregion

            lock (_syncRoot)
            {
                // Cache
                _cacheGroupName = null;
                _cacheGroupInstance = null;

                // Repository
                _repository.Add(groupName);
            }
        }
Exemple #3
0
        public void Remove(string groupName)
        {
            #region Contracts

            if (string.IsNullOrEmpty(groupName) == true)
            {
                throw new ArgumentNullException();
            }

            #endregion

            lock (_syncRoot)
            {
                // Cache
                _cacheGroupName     = null;
                _cacheGroupInstance = null;

                // Repository
                _repository.Remove(groupName);
            }
        }
        public ReflectGroup GetValue(string groupName)
        {
            #region Contracts

            if (string.IsNullOrEmpty(groupName) == true) throw new ArgumentNullException();

            #endregion

            lock (_syncRoot)
            {
                // Cache
                if (_cacheGroupName == groupName) return _cacheGroupInstance;
                _cacheGroupName = groupName;
                _cacheGroupInstance = _repository.GetValue(groupName);

                // Return
                return _cacheGroupInstance;
            }
        }