Fluent Validation in C# - The Powerful Yet Easy Data Validation Tool

preview_player
Показать описание

Data validation is extremely important. The problem is that it can create a lot of excess code. Plus you end up in the position of having similar validation code throughout your application, violating the DRY principle. In this video, I am going to introduce you to Fluent Validation, a free tool to help make your validation clean, easy to create, and easy to maintain. As a bonus, it even works on models that you don't own and cannot change.

0:00 - Intro
1:00 - Demo application walk-through
2:56 - User input validation
6:04 - Where to put data validation
7:07 - Fluent Validation: adding a reference
9:19 - Implementing Fluent Validation
18:23 - More rules for validation: String length
20:00 - Validation custom error messages
22:28 - Cascading validation errors
23:29 - Input validation: allowed characters
28:44 - Fluent Validation built-in variable names: updating error messages
34:08 - CascadeMode scope
35:49 - DateTime validation
40:41 - Recap and concluding remarks
Рекомендации по теме
Комментарии
Автор

My favorite youtube programming channel.

steejayk
Автор

Wow!! I wasted a whole day looking for ways to validate. Your explanation is so easy to understand and Thank you so much for this video :)

sugamsingh
Автор

Guys, I think Tim deserves so much support on patreon, he is an amazing teacher. Thanks Tim!!

Francisco-Gutierrez
Автор

Amazing tutorial. I've just recently discovered this package and couldn't find anywhere, where someone was explaining exactly how to use this package. Awesome. Thank you!

BlackFire
Автор

Thanks Tim, you are really talented, not only in programming but also in explaining it.

rimmongeorge
Автор

This is a lesson I've overlooked over and over and guess what, I am actually redoing validation in my Application albeit a year after deployment! Well, Thank you Tim!

DrWambua
Автор

This is freaking awesome. I literally just finished writing my validator, where a single fuction is over 100 lines... But this... this... omnomnom. Thank you!

behi
Автор

Fluent validation is very useful I have used it in my project as server-side validation. Thank you Tim for
most valuable content and learning video .

ganeshb
Автор

This fantastic stuff, really made me rethink how I do validation, I was just using if statments every where, this is much better, thank you sir!

devoiddude
Автор

Great video again.

Picked up the SQLite database course and about 1/4 way through. Highly recommend it to anyone seriously learning C# in their free time, with a bit of cash to spare.

acidhauss
Автор

This one is worth the price of admission!! Great video and good information.

pierreplourde
Автор

I don’t have comments, I’m speechless Sir!!!

rashidselemani
Автор

Tim, I have found that having three edit levels works very well for me. One is a mechanical edit level, one is a logical edit level and the third is an edit related to a specific type of data. A mechanical edit ensures numeric fields contain numbers. Alpha fields contain any characters. The next level for data validation is to check for logical values. The first name must contain at least 1 character, the last name must contain at least 1 character, the City must contain at least 1 character, the State abbr must be 2 characters and in the standard list of State abbreviations, and the Zip Code must be 5, 9 or 10 digits if U.S. or 6 alpha-numeric characters if Canadian. Other fields may have minimum and maximum lengths (0, 30) like an address. All of the edits, both mechanical and logical can be included in the same class that can be shared between all web applications that handle input data. The logical edits can access data tables, etc. to validate different inputs.

bowlesed
Автор

Hey Tim this was another awesome video and have learned a lot of great concepts and tools from you. Would you please be able to do a tutorial on how to create reports in a C# application? Maybe using visual studio report writer or a third party nugget package. I have not seen any good information on creating reports in visual studio.

karendoran
Автор

It's a very understandable video, but this is all about the package FluentValidation. For your next video please explain about DataAnnotations, all of this you can do it with DataAnnotations and use a validator, then you can make a foreach and with an errorprovider set the error for each control and you can use the same class on a web project without modifications.
I’d like to learn more about DataAnnotations, thank you for your videos.

menendeze
Автор

Great exercise on validation checks, and easily adaptable for my changes, this couldn't have come at a better time. Thanks for all your tutorials 👍🏽

DameLyf
Автор

Also in this week I've learned something new. Thank you Tim.

LuigiZambetti
Автор

An excellent extension homework to your SQLite Application from start to finish course. My thoughts had been thinking about robust data validation and along comes this tutorial. Thanks for the great video.

saturdayscience
Автор

Thanks Tim for super video. What do you suggest for those of us who can't use or not allowed to use such 3rd party tools at workplace. This works for our hobby projects.

vinuhosanagar
Автор

Upwoting this video before I see it since I know it will be good.

CRBarchager