dotnet / dotnet/aspnetcore

Support property-targetted validation attributes on records

Open
#34,083 11 comments 0 reactions 0 assignees View on GitHub
area-mvc enhancement feature-model-binding
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

### 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.