Skip to content

Blazor validation for custom class #10896

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Themikuma opened this issue Jun 5, 2019 · 3 comments
Closed

Blazor validation for custom class #10896

Themikuma opened this issue Jun 5, 2019 · 3 comments
Labels
area-blazor Includes: Blazor, Razor Components enhancement This issue represents an ask for new feature or an enhancement to an existing one ✔️ Resolution: Duplicate Resolved as a duplicate of another issue Needs: Design This issue requires design work before implementating.

Comments

@Themikuma
Copy link

I'm testing out Blazor and I've run into a validation issue. When validating a simple class I can just use annotations. If I have my own custom class inside though validation doesn't run for everything inside my custom class. The issue seems to be specific to Blazor since I can use this validation in ASP. I've got all the details in this Stack Overflow question https://stackoverflow.com/questions/56447004/blazor-validation-for-custom-class

Is this a platform limitation or am I just doing something wrong?

@mkArtakMSFT mkArtakMSFT added the area-blazor Includes: Blazor, Razor Components label Jun 5, 2019
@danroth27
Copy link
Member

Hi @Themikuma. Thanks for trying out Blazor!
By default we only validate the data annotations on the top level properties. We understand though that it's pretty common to want to validate the entire graph and we should document how best to do this. We will first need to look into what we think the best approach is.

@danroth27 danroth27 added the Needs: Design This issue requires design work before implementating. label Jun 5, 2019
@danroth27 danroth27 added this to the 3.0.0-preview8 milestone Jun 5, 2019
@mkArtakMSFT mkArtakMSFT modified the milestones: 3.0.0-preview9, 3.1.0 Jul 17, 2019
@mkArtakMSFT mkArtakMSFT added the enhancement This issue represents an ask for new feature or an enhancement to an existing one label Jul 17, 2019
@mkArtakMSFT mkArtakMSFT modified the milestones: 3.1.0, 5.0.0 Aug 12, 2019
@mkArtakMSFT mkArtakMSFT modified the milestones: 5.0.0, 5.0.0-preview1 Aug 19, 2019
@JeroMiya
Copy link

Just want to add that this also affects models annotated with the ModelMetadataType attribute. This is typical of scenarios where you would add model metadata to the partial classes generated by the Entity Framework database-first scaffolding. Although the best practice would be to have a separate DTO model, with conversions to/from the Entity Framework models, this is often overkill for smaller apps.

@danroth27
Copy link
Member

I believe this is a duplicate of #10526.

@danroth27 danroth27 added the ✔️ Resolution: Duplicate Resolved as a duplicate of another issue label Sep 16, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Dec 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components enhancement This issue represents an ask for new feature or an enhancement to an existing one ✔️ Resolution: Duplicate Resolved as a duplicate of another issue Needs: Design This issue requires design work before implementating.
Projects
None yet
Development

No branches or pull requests

4 participants