Table of Contents

Interface IModelExtensionCommandHandler<TModel, TExtensionModel>

Namespace
Dynamicweb.CoreUI.Data
Assembly
Dynamicweb.CoreUI.dll

Handles the persistence of a model extension's fields whenever a command carrying TModel is executed.

public interface IModelExtensionCommandHandler<TModel, TExtensionModel> where TModel : DataViewModelBase, new() where TExtensionModel : class, new()

Type Parameters

TModel

The model this extension applies to.

TExtensionModel

The extension's own data, added to TModel's edit screen by a matching EditScreenModelExtensionInjector<TScreen, TModel, TExtensionModel>.

Remarks

Registered against TModel, not any one command - unlike ICommandHandler<TCommand, TModel>, which is strictly one handler per command, several independent extensions can each persist their own fields from a single save, and a single extension applies no matter which command posted to TModel is handling the save. A handler only runs when its extension's fields were actually present in the posted request; an extension that does not apply to a given record (because its injector did not render any editors for it) never triggers a handler call.

Methods

Handle(CommandBase<TModel>, TModel, TExtensionModel)

Persists extension for model after command has successfully handled the core model.

void Handle(CommandBase<TModel> command, TModel model, TExtensionModel extension)

Parameters

command CommandBase<TModel>

The command that was executed. Not constrained to any one command type, since the extension applies to TModel regardless of which command carried it.

model TModel

The saved model.

extension TExtensionModel

The extension's posted, merged data.

Load(TModel)

Loads the extension's current persisted value for model, used both to render the edit screen and as the "original" side of the command log diff.

TExtensionModel Load(TModel model)

Parameters

model TModel

The model being edited or saved.

Returns

TExtensionModel
To top