Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Mastering Entity Framework Core 2.0

You're reading from   Mastering Entity Framework Core 2.0 Dive into entities, relationships, querying, performance optimization, and more, to learn efficient data-driven development

Arrow left icon
Product type Paperback
Published in Dec 2017
Publisher Packt
ISBN-13 9781788294133
Length 386 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Prabhakaran Anbazhagan Prabhakaran Anbazhagan
Author Profile Icon Prabhakaran Anbazhagan
Prabhakaran Anbazhagan
Arrow right icon
View More author details
Toc

Table of Contents (20) Chapters Close

Title Page
Credits
About the Author
About the Reviewers
www.PacktPub.com
Customer Feedback
Dedication
Preface
1. Kickstart - Introduction to Entity Framework Core FREE CHAPTER 2. The Other Way Around – Database First Approach 3. Relationships – Terminology and Conventions 4. Building Relationships – Understanding Mapping 5. Know the Validation – Explore Inbuilt Validations 6. Save Yourself – Hack Proof Your Entities 7. Going Raw – Leveraging SQL Queries in LINQ 8. Query Is All We Need – Query Object Pattern 9. Fail Safe Mechanism – Transactions 10. Make It Real – Handling Concurrencies 11. Performance – It's All About Execution Time 12. Isolation – Building a Multi-Tenant Database

Required field validation


We will start with the Required built-in validation which allows validators to check whether the field has a value or not. The required validation is necessary to ensure that the mandatory fields are filled in or updated by the user before transmitting the data to the server for further processing.

The following steps will help us in understanding how validation works:

  1. The  Required field validator is added using data annotation in the model.

  2. The MVC engine performs validation on both client-side and server-side using this configuration.
  3. When MVC engine generates the form view with the input field, it also scaffolds the <span> element along with each input field to hold error messages.

  4. When we run the application and submit the form without providing any value in the input field, which has aria-required field validation, a validation error would be added to the model state errors list.

  5. The errors would be displayed in the <span> associated with each element...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime
Visually different images