Is there a way to use FluentValidation with EntityFramework codefirst in asp.net core?

asp.net-core entity-framework-core fluentvalidation

Question

I am learning and working on CQRS with MediatR. It gives an oppurtunity to have clean architecture.

So to put all my validation out of my UI I try to use FluentValidation (https://github.com/JeremySkinner/FluentValidation).

But I could not find the way to use it with Entity Framework migrations in documents or on google.

Is there a way?

1
1
12/24/2018 7:11:31 PM

Popular Answer

Validations that you write in FluentValidation are just for client-side, not server-side validations, and validations you write in Fluent-API are just for defining database tables constraints.

The idea of using Fluent-API + Fluent-Validation instead of DataAnnotations is that you separated Client-Side Validation and Server-Side table constraints.

This video will also help you to get the idea.

1
12/27/2018 7:46:06 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow