Esempio n. 1
0
        protected void HandleResolverChanged(Guid id, CreateScopeResolverInformation resolverInfo)
        {
            TScope scope    = GetScopeById(id);
            var    resolver = _resolverManager.InitializeResolver(resolverInfo);

            scope.SetResolver(resolver);
        }
Esempio n. 2
0
        public void CheckIfScopeResolverIsValid(Guid scopeId, CreateScopeResolverInformation resolverInformation)
        {
            CheckIfScopeExistsById(scopeId);

            if (resolverInformation == null)
            {
                throw new ScopeException(DHCPv4ScopeExceptionReasons.NoInput);
            }

            if (_resolverManager.IsResolverInformationValid(resolverInformation) == false)
            {
                throw new ScopeException(DHCPv4ScopeExceptionReasons.InvalidResolver);
            }

            return;
        }
Esempio n. 3
0
        public Boolean CheckIfScopeResolverHasChanged(Guid scopeId, CreateScopeResolverInformation resolverInformation)
        {
            CheckIfScopeExistsById(scopeId);

            var scope    = GetScopeById(scopeId);
            var resolver = _resolverManager.InitializeResolver(resolverInformation);

            if (scope.Resolver.GetType() != resolver.GetType())
            {
                return(true);
            }

            var existingValues = scope.Resolver.GetValues();
            var newValues      = resolver.GetValues();

            if (existingValues.Count != newValues.Count)
            {
                return(true);
            }

            var uniqueKeys = existingValues.Keys.Union(newValues.Keys).Distinct();

            if (uniqueKeys.Count() != existingValues.Keys.Count)
            {
                return(true);
            }

            foreach (var item in existingValues)
            {
                var newValue = newValues[item.Key];
                if (newValue != item.Value)
                {
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 4
0
        public IEnumerable <CreateScopeResolverInformation> ExtractResolverCreateModels(CreateScopeResolverInformation item, ISerializer serializer)
        {
            String rawvalue = item.PropertiesAndValues[_innerResolverName];
            IEnumerable <CreateScopeResolverInformation> result = serializer.Deserialze <IEnumerable <CreateScopeResolverInformation> >(rawvalue);

            return(result);
        }
Esempio n. 5
0
 public abstract Boolean UpdateScopeResolver(Guid scopeId, CreateScopeResolverInformation resolverInformation);