Class ModelEditPage<TModel>
Represents page used to edit object models.
public abstract class ModelEditPage<TModel> : EditPageBase, IPage where TModel : new()
Type Parameters
TModelModel to edit.
- Inheritance
-
objectModelEditPage<TModel>
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
ModelEditPage(IFormItemCollectionProvider, IFormDataBinder)
Initializes an instance of the ModelEditPage<TModel> class.
protected ModelEditPage(IFormItemCollectionProvider formItemCollectionProvider, IFormDataBinder formDataBinder)
Parameters
formItemCollectionProviderIFormItemCollectionProviderForm item collection provider that creates form items from model(
TModel).formDataBinderIFormDataBinderForm data binder.
Properties
Model
Gets edited model that represents the form.
protected abstract TModel Model { get; }
Property Value
- TModel
SuccessMessageKey
Gets or sets the success message displayed after submitting the form.
protected virtual string SuccessMessageKey { get; }
Property Value
- string
Methods
BindComponentsToModel(TModel, ICollection<IFormComponent>)
Binds values of components to edited model.
protected void BindComponentsToModel(TModel model, ICollection<IFormComponent> components)
Parameters
modelTModelModel to bind values retrieved from form components.
componentsICollection<IFormComponent>Form components to bind data from.
Change(FormChangeCommandArguments)
Handles the form change command. The command is invoked whenever visibility conditions of the form need to be reevaluated to re-render the form.
[PageCommand(Permission = "Update")]
public override Task<ICommandResponse<FormChangeResult>> Change(FormChangeCommandArguments args)
Parameters
argsFormChangeCommandArgumentsForm change arguments.
Returns
- Task<ICommandResponse<FormChangeResult>>
Returns the form change result.
ConfigurePage()
Set up page's configuration. Configures the submit action.
public override Task ConfigurePage()
Returns
- Task
ConfigureTemplateProperties(EditTemplateClientProperties)
Transforms the configuration to template properties.
public override Task<EditTemplateClientProperties> ConfigureTemplateProperties(EditTemplateClientProperties properties)
Parameters
propertiesEditTemplateClientProperties
Returns
Remarks
Performs also permission evaluation.
GetClientFormItems(IEnumerable<IFormItem>)
Returns a collection of client item properties for given form items.
protected virtual Task<ICollection<IFormItemClientProperties>> GetClientFormItems(IEnumerable<IFormItem> formItems)
Parameters
formItemsIEnumerable<IFormItem>Form items.
Returns
- Task<ICollection<IFormItemClientProperties>>
GetFormItems()
protected override Task<ICollection<IFormItem>> GetFormItems()
Returns
- Task<ICollection<IFormItem>>
Remarks
Override the method in case when additional set-up of form components is required.
GetFormItemsClientProperties()
Returns properties describing client form items for Model.
protected override Task<IEnumerable<IFormItemClientProperties>> GetFormItemsClientProperties()
Returns
- Task<IEnumerable<IFormItemClientProperties>>
GetObjectDisplayName(TModel)
Gets object display name to be used in breadcrumbs, navigation items etc. if they have to be updated after the Submit(FormSubmissionCommandArguments) command success.
protected virtual Task<string> GetObjectDisplayName(TModel model)
Parameters
modelTModelCurrently processed model.
Returns
- Task<string>
The object display name to be used in breadcrumbs, navigation items etc., or null, should the display name not be changed after the Submit(FormSubmissionCommandArguments) command success.
- See Also
InitializeContext()
Initializes form context.
protected override Task<IFormContext> InitializeContext()
Returns
- Task<IFormContext>
ProcessFormData(TModel, ICollection<IFormItem>)
Stores the model and creates a response for the Submit(FormSubmissionCommandArguments) command.
protected virtual Task<ICommandResponse> ProcessFormData(TModel model, ICollection<IFormItem> formItems)
Parameters
modelTModelModel to be stored.
formItemsICollection<IFormItem>Form items with bound component values.
Returns
- Task<ICommandResponse>
The response to be used for the Submit(FormSubmissionCommandArguments) command.
SubmitInternal(FormSubmissionCommandArguments, ICollection<IFormItem>, IFormFieldValueProvider)
Handles the internal specific processing of form submit command.
protected override Task<ICommandResponse> SubmitInternal(FormSubmissionCommandArguments args, ICollection<IFormItem> items, IFormFieldValueProvider formFieldValueProvider)
Parameters
argsFormSubmissionCommandArgumentsForm submission arguments.
itemsICollection<IFormItem>Form items with bound component values.
formFieldValueProviderIFormFieldValueProviderProvider of form field values.
Returns
- Task<ICommandResponse>
Returns the form submission result.
Remarks
This method is called by the default implementation of the Submit(FormSubmissionCommandArguments) method.
- See Also
ValidatePage()
Validates the page state prior invocation of the ConfigurePage() method.
public override Task<PageValidationResult> ValidatePage()
Returns
- Task<PageValidationResult>