Exemplo n.º 1
0
        public SchemaDomainObject UpdateField(UpdateField command)
        {
            Guard.Valid(command, nameof(command), () => $"Cannot update schema '{Id}'");

            VerifyCreatedAndNotDeleted();

            SchemaFieldGuard.GuardCanUpdate(schema, command.FieldId);

            RaiseEvent(command, SimpleMapper.Map(command, new FieldUpdated()));

            return(this);
        }
Exemplo n.º 2
0
        public SchemaDomainObject DeleteField(DeleteField command)
        {
            Guard.NotNull(command, nameof(command));

            VerifyCreatedAndNotDeleted();

            SchemaFieldGuard.GuardCanDelete(schema, command.FieldId);

            RaiseEvent(command, new FieldDeleted());

            return(this);
        }
Exemplo n.º 3
0
        public SchemaDomainObject Add(AddField command)
        {
            Guard.Valid(command, nameof(command), () => $"Cannot add field to schema {Id}");

            VerifyCreatedAndNotDeleted();

            SchemaFieldGuard.GuardCanAdd(schema, command.Name);

            RaiseEvent(SimpleMapper.Map(command, new FieldAdded {
                FieldId = new NamedId <long>(totalFields + 1, command.Name)
            }));

            return(this);
        }