Skip to content

Support property-targetted validation attributes on records #34083

@bruno-brant

Description

@bruno-brant

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

I am trying to do use validation attributes on a record that is also used as a controller model but model binding fails with a rather cryptic error, "'Foo' has validation metadata defined on property 'Bar' that will be ignored. 'Bar' is a parameter in the record primary constructor and validation metadata must be associated with the constructor parameter."

(this has already been reported in issue #30650 but it has since been closed)

Describe the solution you'd like

ASP.NET MVC should allow me to use records that have validation attributes on properties as models.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesenhancementThis issue represents an ask for new feature or an enhancement to an existing onefeature-model-binding

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions