Ejemplo n.º 1
0
        public Boolean AddScope(
            DHCPv4ScopeCreateInstruction instructions)
        {
            CheckScopeCreationInstruction(instructions);
            base.Apply(new DHCPv4ScopeAddedEvent(instructions));

            return(true);
        }
Ejemplo n.º 2
0
        internal static DHCPv4Scope FromInstructions(
            DHCPv4ScopeCreateInstruction instructions,
            Action <DomainEvent> rootApplier,
            Action <NotifcationTrigger> rootNotifier,
            ILogger <DHCPv4Scope> logger
            )
        {
            DHCPv4Scope scope = new DHCPv4Scope(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);
        }
Ejemplo n.º 3
0
        public async Task <Guid?> Handle(CreateDHCPv4ScopeCommand request, CancellationToken cancellationToken)
        {
            _logger.LogDebug("Handle started");

            Guid id = Guid.NewGuid();

            DHCPv4ScopeCreateInstruction instruction = new DHCPv4ScopeCreateInstruction
            {
                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);
        }
Ejemplo n.º 4
0
 public DHCPv4ScopeAddedEvent(DHCPv4ScopeCreateInstruction instructions)
 {
     Instructions = instructions;
 }