Пример #1
0
        public PolicyContainer AddPolicyContainer(PolicyContainer policyContainer)
        {
            if (policyContainer == null) throw new ArgumentNullException("policyContainer");

            var existingContainer = PolicyContainers.GetContainerFor(policyContainer.ControllerName, policyContainer.ActionName);
            if (existingContainer != null) return (PolicyContainer) existingContainer;

            _policyContainers.Add(policyContainer);

            return policyContainer;
        }
        private IPolicyContainer AddPolicyContainerFor(string controllerName, string actionName)
        {
            IPolicyContainer policyContainer;

            var existingContainer = _itemValues.GetContainerFor(controllerName, actionName);

            if (existingContainer != null)
            {
                policyContainer = existingContainer;
            }
            else
            {
                policyContainer = new PolicyContainer(controllerName, actionName, PolicyAppender);
                _itemValues.Add(policyContainer);
            }

            return(policyContainer);
        }
        public PolicyContainer AddPolicyContainer(PolicyContainer policyContainer)
        {
            if (policyContainer == null)
            {
                throw new ArgumentNullException(nameof(policyContainer));
            }

            var existingContainer = PolicyContainers.GetContainerFor(policyContainer.ControllerName, policyContainer.ActionName);

            if (existingContainer != null)
            {
                return((PolicyContainer)existingContainer);
            }

            _policyContainers.Add(policyContainer);

            return(policyContainer);
        }