Chapter 3. Validation and Changes

In this chapter, we will cover the following topics:

  • Validating simple properties
  • Validating the whole entity
  • Validating groups of entities
  • Intercepting saving changes
  • Intercepting property changes
  • Setting the state of an entity
  • Improving MVC UI with Entity Framework validation
  • Inserting, updating, and deleting entities with stored procedures
  • Updating the database from model changes
  • Dumping the SQL script for the database creation

Introduction

In this chapter, we will be looking at how we can make Entity Framework validate our entities for us. Of course, we don't want to be inserting bad data into the database, and Entity Framework can help us with that by intercepting data before it is sent to the database.

After that, we ...

Get Entity Framework Core Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.