Example #1
0
        public Boolean AddScope(
            DHCPv6ScopeCreateInstruction instructions)
        {
            CheckScopeCreationInstruction(instructions);
            base.Apply(new DHCPv6ScopeAddedEvent(instructions));

            return(true);
        }
Example #2
0
        internal static DHCPv6Scope FromInstructions(
            DHCPv6ScopeCreateInstruction instructions,
            Action <DomainEvent> rootApplier,
            Action <NotifcationTrigger> rootNotifier,
            ILogger <DHCPv6Scope> logger
            )
        {
            DHCPv6Scope scope = new DHCPv6Scope(instructions.Id, rootApplier, rootNotifier)
            {
                Name        = new ScopeName(instructions.Name),
                Description = new ScopeDescription(instructions.Description),
                Properties  = instructions.ScopeProperties,
                AddressRelatedProperties = instructions.AddressProperties,
            };

            scope._logger = logger;

            return(scope);
        }
Example #3
0
        public async Task <Guid?> Handle(CreateDHCPv6ScopeCommand request, CancellationToken cancellationToken)
        {
            _logger.LogDebug("Handle started");

            Guid id = Guid.NewGuid();

            DHCPv6ScopeCreateInstruction instruction = new DHCPv6ScopeCreateInstruction
            {
                Id                  = id,
                Name                = request.Name,
                Description         = request.Description,
                ParentId            = request.ParentId,
                AddressProperties   = GetScopeAddressProperties(request),
                ResolverInformation = GetResolverInformation(request),
                ScopeProperties     = GetScopeProperties(request),
            };

            _rootScope.AddScope(instruction);

            await _store.Save(_rootScope);

            return(id);
        }
Example #4
0
 public DHCPv6ScopeAddedEvent(DHCPv6ScopeCreateInstruction instructions)
 {
     Instructions = instructions;
 }