Open wrightstork opened 5 years ago
For consistency: add-migration after applying validation rules
It's worth mentioning that some validation rules must be applied to the DB schema for consistency by adding a new migration. e.g. add-migration AddingNewRules
Mainly, the following two attributes affect the schema: 1- [Required] will alter the relevant column and make it not null 2- [StringLength(60)] will alter the type of the column and make it nvarchar(60)
I used Visual Studio Tools>NuGet Packet Manager > Packet Manager Console PM>Add-Migration AddNewValidationRules (I used a different migration name than the suggestion above left in the comments)
That scaffolds a migration.
PM> Update-Database
Working on this: https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-mvc-app/validation?view=aspnetcore-3.0