Skip to content

Blazor: Record Type binding and validation for EditContext/EditForm #31604

@braidenstiller

Description

@braidenstiller

Is your feature request related to a problem? Please describe.

Please consider binding and model validation in Blazor with record types. Currently when using the EditForm/EditContext it requires a model with mutable properties for input binding. Having the EditForm/EditContext bind to a record type and emit a new instance with modified state would allow for client-side functionality like state machines, state rewinding and fast-forwarding, mutation batching and other workflows which benefit from immutable state. This functionality and workflow would be similar to the MVC 5 record type binding which allows for form fields binding, field validation and model validation.

https://docs.microsoft.com/en-us/aspnet/core/release-notes/aspnetcore-5.0?view=aspnetcore-5.0

Describe the solution you'd like

A simple and idiomatic way to bind to record types similar to the current binding syntax. Understandably the current bind syntax may not be suitable as the field would have to emit a new record instance with the changes, then alert the EditForm/EditContext to update the bound Model property, or let the user handle it emit an event to propagate the changes up (or a combination of both).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Priority:2Work that is important, but not critical for the releasearea-blazorIncludes: Blazor, Razor ComponentsenhancementThis issue represents an ask for new feature or an enhancement to an existing onefeature-blazor-builtin-componentsFeatures related to the built in components we ship or could ship in the futurefeature-model-binding
    No fields configured for Feature.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions