Data Annotations

Introduction to Model Validation in ASP.NET Core
ASP.NET Core

Model Validation in ASP.NET Core MVC

In this tutorial, we look at how ASP.NET core Model Validation works. Often the data entered by the user is not valid and cannot be saved into the database. The entered data may contain a typo or user may intentionally enter the inappropriate data. Hence, we need to validate the user input before storing it in the database. The ASP.NET Core gives us Model Validator, which uses the validation attributes to validate the model, which makes our task easier. We also take a look at ModelState and how to use it. Finally, we look at the list of Validation attributes.

InverseProperty Attribute Entity Framework Code First
Entity Framework

InverseProperty Attribute Entity Framework

The InverserProperty informs the EF, which navigational property it relates to on the other side of the relationship. If two entities have a single relationship between them, the EF convention correctly identities them. But it fails when there are multiple relationships between entities. In such cases, we use the InverserProperty to help the EF correctly identify the relationship.

Scroll to Top