Aspnetcore.docs: Custom Validation -> Decorate Member?

Created on 17 Sep 2018  Â·  5Comments  Â·  Source: dotnet/AspNetCore.Docs

Reference: Custom Validation

It seems like, this attribute would be put on the class, not the member, right? BTW, I think that would be good include the usage in the docs, thoughts? 💭

[ClassicMovie]
public class Movie {

    ...

    [WhyCant_I_PutA_CustomAttributeHere?]
    public int Year { get; set; }
}

Assuming I put the custom attribute on the class, it seems inconsistent. I can decorate members with [Required]. Why can't I decorate a member? (not a doc issue 😊, I know)


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

P3 Source - Docs.ms

All 5 comments

Validation goes on the property, not on the class. We should probably mention that.

I see, thanks!

I'm happy to take a stab at that if you would like?

@spottedmahn that would be great.

Sorry @spottedmahn - I'm working on the doc and thought I would just take care of this one.

nice, thanks @daveabrock!

Was this page helpful?
0 / 5 - 0 ratings