Search⌘ K

Models in ASP.NET

Explore how to define and use model classes in ASP.NET Core MVC to map data to databases. Learn about primary keys, property types, and enforcing data validation using attributes.

We'll cover the following...

Model classes allow you to map data to your database. A model class usually consists of properties along with their “getter” and “setters”.

The number of model classes and types of properties in those model classes depends on your application requirements. For example, if your application is managing employee data, then your model classes could be Employee, Department, and Rank among others.

One of the most common model classes in any application is a User model class. In this ...