PageModel and IValidatableObject - validation is not invoked
Asked Answered
A

0

6

I tried to implement IValidatableObject on my Razor Page model in ASPNET Core 2.

I was surprised that the Validate method was not invoked. Moving all [BindableProperty]s to a new type implementing IValidatableObject did work, however.

Is this the only way? It would be nice to be able to implement IValidatableObject directly on my .Microsoft.AspNetCore.Mvc.RazorPages.PageModel type.

Angel answered 17/10, 2018 at 12:50 Comment(2)
Looks like enabling this is being considered for ASP.NET Core 3.0: github.com/aspnet/Mvc/issues/7919Ditch
Did you find an answer to this?Polarization

© 2022 - 2024 — McMap. All rights reserved.