[Question] FluentValidation and BeginCollectionItem
See original GitHub issueAnyone know if it is possible to use FluentValidation with BeginCollectionItem which appends GUIDs to the field/property names? I was able to set up the validator:
RuleForEach(x => x.Insureds).SetValidator(new InsuredInfoValidator());
public class InsuredInfoValidator : AbstractValidator<InsuredInfo>
{
public InsuredInfoValidator()
{
RuleFor(x => x.LastName).NotEmpty().WithMessage("Required");
}
}
Insureds
is my collection. The ModelState validates correctly, but the message does not get placed next to the invalid field: LastName
.
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
BeginCollectionItem and FluentValidation
Anyone know if it is possible to use FluentValidation with BeginCollectionItem which appends GUIDs to the field/property names?
Read more >Fluent Validation for .NET - RSSing.com
Is there a workaround for validating collections that using GUID indices like BeginCollectionItem does? FluentValidation validates the collection of models ...
Read more >ASP.NET Core — FluentValidation documentation
FluentValidation can be used within ASP.NET Core web applications to validate incoming models. There are two main approaches for doing this:.
Read more >Using Fluent Validation in ASP.NET Core
Configuring FluentValidation We will have to add Fluent Validation to our application. Navigate to Startup.
Read more >BeginCollectionItem 1.2.1
This Html Helper leverages the default model binder in ASP.NET MVC 2 and higher to materialize viewmodel collection properties from an HTTP POST ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for the sample. I’ll try and look through this tomorrow.
@JeremySkinner thanks for looking into it. Do you know if there is a different way I can do model binding to a list and still use FV and have the messages display? From my research, the tricky part happens when you want to delete an index. Maybe this is something that might work?: http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx/