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); }
public SchemaDomainObject DeleteField(DeleteField command) { Guard.NotNull(command, nameof(command)); VerifyCreatedAndNotDeleted(); SchemaFieldGuard.GuardCanDelete(schema, command.FieldId); RaiseEvent(command, new FieldDeleted()); return(this); }
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); }