public override Task <object?> ExecuteAsync(IAggregateCommand command) { switch (command) { case AddField addField: return(UpdateReturn(addField, c => { GuardSchemaField.CanAdd(c, Snapshot.SchemaDef); Add(c); return Snapshot; })); case CreateSchema createSchema: return(CreateReturn(createSchema, c => { GuardSchema.CanCreate(c); Create(c); return Snapshot; })); case SynchronizeSchema synchronizeSchema: return(UpdateReturn(synchronizeSchema, c => { GuardSchema.CanSynchronize(c); Synchronize(c); return Snapshot; })); case DeleteField deleteField: return(UpdateReturn(deleteField, c => { GuardSchemaField.CanDelete(deleteField, Snapshot.SchemaDef); DeleteField(c); return Snapshot; })); case LockField lockField: return(UpdateReturn(lockField, c => { GuardSchemaField.CanLock(lockField, Snapshot.SchemaDef); LockField(c); return Snapshot; })); case HideField hideField: return(UpdateReturn(hideField, c => { GuardSchemaField.CanHide(c, Snapshot.SchemaDef); HideField(c); return Snapshot; })); case ShowField showField: return(UpdateReturn(showField, c => { GuardSchemaField.CanShow(c, Snapshot.SchemaDef); ShowField(c); return Snapshot; })); case DisableField disableField: return(UpdateReturn(disableField, c => { GuardSchemaField.CanDisable(c, Snapshot.SchemaDef); DisableField(c); return Snapshot; })); case EnableField enableField: return(UpdateReturn(enableField, c => { GuardSchemaField.CanEnable(c, Snapshot.SchemaDef); EnableField(c); return Snapshot; })); case UpdateField updateField: return(UpdateReturn(updateField, c => { GuardSchemaField.CanUpdate(c, Snapshot.SchemaDef); UpdateField(c); return Snapshot; })); case ReorderFields reorderFields: return(UpdateReturn(reorderFields, c => { GuardSchema.CanReorder(c, Snapshot.SchemaDef); Reorder(c); return Snapshot; })); case UpdateSchema updateSchema: return(UpdateReturn(updateSchema, c => { GuardSchema.CanUpdate(c); Update(c); return Snapshot; })); case PublishSchema publishSchema: return(UpdateReturn(publishSchema, c => { GuardSchema.CanPublish(c); Publish(c); return Snapshot; })); case UnpublishSchema unpublishSchema: return(UpdateReturn(unpublishSchema, c => { GuardSchema.CanUnpublish(c); Unpublish(c); return Snapshot; })); case ConfigureFieldRules configureFieldRules: return(UpdateReturn(configureFieldRules, c => { GuardSchema.CanConfigureFieldRules(c); ConfigureFieldRules(c); return Snapshot; })); case ConfigureScripts configureScripts: return(UpdateReturn(configureScripts, c => { GuardSchema.CanConfigureScripts(c); ConfigureScripts(c); return Snapshot; })); case ChangeCategory changeCategory: return(UpdateReturn(changeCategory, c => { GuardSchema.CanChangeCategory(c); ChangeCategory(c); return Snapshot; })); case ConfigurePreviewUrls configurePreviewUrls: return(UpdateReturn(configurePreviewUrls, c => { GuardSchema.CanConfigurePreviewUrls(c); ConfigurePreviewUrls(c); return Snapshot; })); case ConfigureUIFields configureUIFields: return(UpdateReturn(configureUIFields, c => { GuardSchema.CanConfigureUIFields(c, Snapshot.SchemaDef); ConfigureUIFields(c); return Snapshot; })); case DeleteSchema deleteSchema: return(Update(deleteSchema, c => { GuardSchema.CanDelete(c); Delete(c); })); default: throw new NotSupportedException(); } }