You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: aspnetcore/tutorials/first-mvc-app/validation.md
+36-1Lines changed: 36 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,11 @@
1
1
---
2
2
title: Part 9, add validation to an ASP.NET Core MVC app
3
+
ai-usage: ai-assisted
3
4
author: wadepickett
4
5
description: Part 9 of tutorial series on ASP.NET Core MVC.
5
6
monikerRange: '>= aspnetcore-3.1'
6
7
ms.author: wpickett
7
-
ms.date: 01/22/2026
8
+
ms.date: 03/26/2026
8
9
uid: tutorials/first-mvc-app/validation
9
10
---
10
11
@@ -135,8 +136,42 @@ You can use the `DisplayFormat` attribute by itself, but it's generally a good i
135
136
* The `DataType` attribute can enable MVC to choose the right field template to render the data (the `DisplayFormat` if used by itself uses the string template).
136
137
137
138
139
+
## Apply migrations
140
+
141
+
Some validation attributes affect the database schema. For example, `[Required]` makes a column `NOT NULL` and `[StringLength(60)]` limits the column type to `nvarchar(60)`. Run a migration to keep the database schema consistent with the model.
142
+
143
+
# [Visual Studio](#tab/visual-studio)
144
+
145
+
From the **Tools** menu, select **NuGet Package Manager > Package Manager Console**.
Some validation attributes affect the database schema. For example, `[Required]` makes a column `NOT NULL` and `[StringLength(60)]` limits the column type to `nvarchar(60)`. Run a migration to keep the database schema consistent with the model.
108
+
109
+
# [Visual Studio](#tab/visual-studio)
110
+
111
+
From the **Tools** menu, select **NuGet Package Manager > Package Manager Console**.
Some validation attributes affect the database schema. For example, `[Required]` makes a column `NOT NULL` and `[StringLength(60)]` limits the column type to `nvarchar(60)`. Run a migration to keep the database schema consistent with the model.
108
+
109
+
# [Visual Studio](#tab/visual-studio)
110
+
111
+
From the **Tools** menu, select **NuGet Package Manager > Package Manager Console**.
Some validation attributes affect the database schema. For example, `[Required]` makes a column `NOT NULL` and `[StringLength(60)]` limits the column type to `nvarchar(60)`. Run a migration to keep the database schema consistent with the model.
113
+
114
+
# [Visual Studio](#tab/visual-studio)
115
+
116
+
From the **Tools** menu, select **NuGet Package Manager > Package Manager Console**.
Some validation attributes affect the database schema. For example, `[Required]` makes a column `NOT NULL` and `[StringLength(60)]` limits the column type to `nvarchar(60)`. Run a migration to keep the database schema consistent with the model.
113
+
114
+
# [Visual Studio](#tab/visual-studio)
115
+
116
+
From the **Tools** menu, select **NuGet Package Manager > Package Manager Console**.
0 commit comments