fluentvalidation Questions

2

Solved

I'd like with FluentValidation check the email format. The email is not mandatory. Then I have to check only when the property is not empty.How can I do this ? Below I check all the time. RuleFor(...
Autotransformer asked 12/4, 2016 at 9:6

3

Solved

I'm using "FluentValidation.AspNetCore" library (Version="8.6.2") for a .Net Core project. What I would like to do is to register all my Validators automatically in Startup.cs c...
Tichon asked 21/7, 2020 at 21:34

1

Solved

I'm using FluentValidation in an ASP.NET Core 6 Web API project. This works fine for most cases, so: Request body JSON syntax validation is done by ASP.NET Core. Request object property validation...
Comity asked 6/7, 2022 at 12:26

2

Solved

I have a MVC 3 site but am using the non-MVC FluentValidation dll. I've created a validator class and in the constructor put all my RuleFors and then set an attribute on my model class thus [Fluen...

4

I have WebAPI (.NET Core) and use FluentValidator to validate model, including updating. I use PATCH verb and have the following method: public IActionResult Update(int id, [FromBody] JsonPatchDoc...
Baronial asked 28/5, 2019 at 14:18

2

Solved

I've got a Domain Driven Design solution and for some reason, I'm getting this exception at RunTime when the API call is made through GateWay: One or more errors occurred. (Method not found: 'Void...
Faris asked 10/2, 2019 at 7:47

6

I have a class with a complex property: public class A { public B Prop { get; set; } } public class B { public int Id { get; set; } } I've added a validator: public class AValidator : Abstra...
Hildagarde asked 10/10, 2016 at 9:37

2

Solved

I am using fluentvalidation as follows: public class ProjectValidator : AbstractValidator<Project> { public ProjectValidator() { RuleFor(project => project.Name).NotEmpty().WithMessage...
Blanks asked 23/7, 2013 at 16:8

4

Solved

I am trying out FluentValidation on a project that contains complex view models and I read the documentation here but I don't see how to set up the rules to validate a list of objects declared in m...
Perfectly asked 23/1, 2014 at 13:36

3

Solved

I have a domain model/entity that, depending on what how it's populated needs to be validated differently. Say I come up with 3 validators like the ones below: public class Product1Validator : Abs...
Inflow asked 7/12, 2016 at 17:26

5

Solved

This is my ViewModel class: public class CreatePersonModel { public string Name { get; set; } public DateTime DateBirth { get; set; } public string Email { get; set; } } CreatePerson.cshtml ...
Eye asked 15/10, 2011 at 13:7

3

Solved

I want to add the FluentValidation Nuget package in my asp.net core app through Nuget Package Manager.While adding I get this error: Severity Code Description Project File Line Suppression State...
Dogie asked 19/6, 2018 at 13:54

1

I'm using FluentValidation to validate inputs for my ASP.NET Core 3.1 Web API. I'm doing it with the "automatic" way. So in my Startup class I have this: services.AddControllers() .AddF...

2

Solved

Before FluentValidation.NET I could give a custom label to a properly like so: [Display(Name="Blah")] public string BlahBlahBlah { get; set; } And I could consume this in several ways: @Html.La...
Burke asked 27/12, 2016 at 20:29

5

Solved

I'm trying to validate this property in MVC model, which can contain zero or more email addresses delimited by comma: public class DashboardVM { public string CurrentAbuseEmails { get; set; } .....
Rakia asked 7/9, 2012 at 14:23

2

What do you think about this idea: Some DTOs need validations that involves database interactions, so we inject DbContext or repository class inside the validator class and use it for validation. ...
Cannabis asked 23/7, 2020 at 15:50

3

Solved

I am currently using Fluent Validation instead of Data Annotations for my Web api and using swagger for API documentation. Fluent validation rules are not reflected in swagger model as i am unable ...
Hula asked 19/6, 2017 at 19:11

3

Solved

Can you validate just a single property with the Fluent Validation Library, and if so how? I thought this discussion thread from January of 2009 showed me how to do it via the following syntax: va...
Swiercz asked 17/5, 2010 at 15:11

3

Solved

Really new to C#, ASP.NET MVC and FluentValidation. i have a user model like: public class UserDetails{ public int ID { get; set; } public string UserName { get; set; } public string Email { g...
Brindabrindell asked 9/12, 2014 at 8:10

2

Solved

I have an ASP.NET MVC3 website setup using fluent validation and ninject. The validation code is working. However, I set a break point in the validation class constructor and I noticed that when I ...
Thermoelectrometer asked 18/10, 2011 at 15:53

3

Solved

I'm using ASP.NET Core, the built-in container, and MediatR 3 which supports "behavior" pipelines: public class MyRequest : IRequest<string> { // ... } public class MyRequestHandler : IReq...
Gq asked 16/2, 2017 at 19:30

2

Solved

Can FluentValidation work with hierarchical collections? Can the following object with arbitrary number of Child nodes be validated? public class Node { public string Id { get; set; } public Lis...
Tantivy asked 15/8, 2016 at 13:4

2

In FluentValidation, there are two versions of validate method: Validate and ValidateAsync. I am confused by the async version, why we need this in the normal validation API. I think async would ...
Chrysostom asked 30/11, 2016 at 3:32

3

I have an action on API controller like this: [HttpPost] public async Task<IActionResult> StartDeployment( [FromQuery]Guid deploymentId, [FromRoute]RequestInfo requestInfo, [FromBody]Depl...
Southerland asked 13/7, 2018 at 0:44

1

I learned how to use the fluent validator I would like to know if you could help me with a question. I have a personal system where in my controller the create post method has the following code: [...
Relations asked 12/3, 2021 at 20:8

© 2022 - 2025 — McMap. All rights reserved.