Lesson 12: Create Custom Validations by Inheriting from the ValidationAttribute Class

Опубликовано: 27 Июнь 2026
на канале: Paul D. Sheriff
265
13

Lesson 12: Create Custom Validations by Inheriting from the ValidationAttribute Class

In this lesson you learn about the ValidationAttribute class and how you use to build your own custom attribute classes. You create three classes to validate dates. One class validates a date is less than a maximum value specified in the attribute. One class validates a date is greater than a minimum value specified in the attribute. The last class passes in two integer values to specify how many years prior and in the future the date value entered must be within.

Content
Lesson Objectives 00:00
The ValidationAttribute Class 00:25
DEMO: Is Date Greater Than Minimum Date 00:50
DEMO: Is Date Less Than Maximum Date 05:58
DEMO: Check for a Minimum and Maximum Date 07:18
Lesson Summary 09:41

Useful Links
Samples and hands-on labs for this course: https://www.pdsa.com/YouTube
The ValidationAttribute Class: https://learn.microsoft.com/en-us/dot...

#dataannotation #validation #csharp #development #programming #dotnet #dotnetcore #dotnet6 #dotnet #dotnet8 #pauldsheriff #pluralsight #youtube

Paul.About()
Hello, my name is Paul D. Sheriff and I have a passion for teaching. I have been training developers for over 35 years through books, videos, article, blog posts, and international conferences and user groups.

Paul.Contact()
Website: https://www.pdsa.com
Email: [email protected]
LinkedIn:   / paulsheriff  
Blog: https://blogs.pdsa.com/
Pluralsight: https://app.pluralsight.com/profile/a...
YouTube Channel: @pauldsheriff